474 _live_nmethod(nullptr),
475 #endif // INCLUDE_JVMCI
476
477 _exception_oop(oop()),
478 _exception_pc(nullptr),
479 _exception_handler_pc(nullptr),
480
481 _jni_active_critical(0),
482 _pending_jni_exception_check_fn(nullptr),
483 _depth_first_number(0),
484
485 // JVMTI PopFrame support
486 _popframe_condition(popframe_inactive),
487 _frames_to_pop_failed_realloc(0),
488
489 _cont_entry(nullptr),
490 _cont_fastpath(nullptr),
491 _cont_fastpath_thread_state(1),
492 _unlocked_inflated_monitor(nullptr),
493
494 _preempt_alternate_return(nullptr),
495 _preemption_cancelled(false),
496 _pending_interrupted_exception(false),
497 _at_preemptable_init(false),
498 DEBUG_ONLY(_preempt_init_klass(nullptr) COMMA)
499 DEBUG_ONLY(_interp_at_preemptable_vmcall_cnt(0) COMMA)
500 DEBUG_ONLY(_interp_redoing_vm_call(false) COMMA)
501
502 _handshake(this),
503 _suspend_resume_manager(this, &_handshake._lock),
504
505 _popframe_preserved_args(nullptr),
506 _popframe_preserved_args_size(0),
507
508 _jvmti_thread_state(nullptr),
509 _interp_only_mode(0),
510 _should_post_on_exceptions_flag(JNI_FALSE),
511 _thread_stat(new ThreadStatistics()),
512
513 _parker(),
944 if (free_handle_block() != nullptr) {
945 JNIHandleBlock* block = free_handle_block();
946 set_free_handle_block(nullptr);
947 JNIHandleBlock::release_block(block);
948 }
949
950 // These have to be removed while this is still a valid thread.
951 _stack_overflow_state.remove_stack_guard_pages();
952
953 if (UseTLAB) {
954 retire_tlab();
955 }
956
957 if (JvmtiEnv::environments_might_exist()) {
958 JvmtiExport::cleanup_thread(this);
959 }
960
961 // We need to cache the thread name for logging purposes below as once
962 // we have called on_thread_detach this thread must not access any oops.
963 char* thread_name = nullptr;
964 if (log_is_enabled(Debug, os, thread, timer)) {
965 ResourceMark rm(this);
966 thread_name = os::strdup(name());
967 }
968
969 if (log_is_enabled(Info, os, thread)) {
970 ResourceMark rm(this);
971 log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).",
972 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
973 name(), os::current_thread_id());
974 }
975
976 if (log_is_enabled(Debug, os, thread, timer)) {
977 _timer_exit_phase3.stop();
978 _timer_exit_phase4.start();
979 }
980
981 #if INCLUDE_JVMCI
982 if (JVMCICounterSize > 0) {
983 if (jvmci_counters_include(this)) {
984 for (int i = 0; i < JVMCICounterSize; i++) {
985 _jvmci_old_thread_counters[i] += _jvmci_counters[i];
986 }
987 }
988 }
989 #endif // INCLUDE_JVMCI
990
991 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
992 // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
993 Threads::remove(this, daemon);
994
995 if (log_is_enabled(Debug, os, thread, timer)) {
996 _timer_exit_phase4.stop();
997 log_debug(os, thread, timer)("name='%s'"
998 ", exit-phase1=" JLONG_FORMAT
999 ", exit-phase2=" JLONG_FORMAT
1000 ", exit-phase3=" JLONG_FORMAT
1001 ", exit-phase4=" JLONG_FORMAT,
1002 thread_name,
1003 _timer_exit_phase1.milliseconds(),
1004 _timer_exit_phase2.milliseconds(),
1005 _timer_exit_phase3.milliseconds(),
1006 _timer_exit_phase4.milliseconds());
1007 os::free(thread_name);
1008 }
1009 }
1010
|
474 _live_nmethod(nullptr),
475 #endif // INCLUDE_JVMCI
476
477 _exception_oop(oop()),
478 _exception_pc(nullptr),
479 _exception_handler_pc(nullptr),
480
481 _jni_active_critical(0),
482 _pending_jni_exception_check_fn(nullptr),
483 _depth_first_number(0),
484
485 // JVMTI PopFrame support
486 _popframe_condition(popframe_inactive),
487 _frames_to_pop_failed_realloc(0),
488
489 _cont_entry(nullptr),
490 _cont_fastpath(nullptr),
491 _cont_fastpath_thread_state(1),
492 _unlocked_inflated_monitor(nullptr),
493
494 _can_call_java(true),
495
496 _preempt_alternate_return(nullptr),
497 _preemption_cancelled(false),
498 _pending_interrupted_exception(false),
499 _at_preemptable_init(false),
500 DEBUG_ONLY(_preempt_init_klass(nullptr) COMMA)
501 DEBUG_ONLY(_interp_at_preemptable_vmcall_cnt(0) COMMA)
502 DEBUG_ONLY(_interp_redoing_vm_call(false) COMMA)
503
504 _handshake(this),
505 _suspend_resume_manager(this, &_handshake._lock),
506
507 _popframe_preserved_args(nullptr),
508 _popframe_preserved_args_size(0),
509
510 _jvmti_thread_state(nullptr),
511 _interp_only_mode(0),
512 _should_post_on_exceptions_flag(JNI_FALSE),
513 _thread_stat(new ThreadStatistics()),
514
515 _parker(),
946 if (free_handle_block() != nullptr) {
947 JNIHandleBlock* block = free_handle_block();
948 set_free_handle_block(nullptr);
949 JNIHandleBlock::release_block(block);
950 }
951
952 // These have to be removed while this is still a valid thread.
953 _stack_overflow_state.remove_stack_guard_pages();
954
955 if (UseTLAB) {
956 retire_tlab();
957 }
958
959 if (JvmtiEnv::environments_might_exist()) {
960 JvmtiExport::cleanup_thread(this);
961 }
962
963 // We need to cache the thread name for logging purposes below as once
964 // we have called on_thread_detach this thread must not access any oops.
965 char* thread_name = nullptr;
966 if (log_is_enabled(Debug, os, thread, timer) || (CountBytecodesPerThread && log_is_enabled(Info, init))) {
967 ResourceMark rm(this);
968 thread_name = os::strdup(name());
969 }
970
971 if (log_is_enabled(Info, os, thread)) {
972 ResourceMark rm(this);
973 log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).",
974 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
975 name(), os::current_thread_id());
976 }
977
978 if (log_is_enabled(Debug, os, thread, timer)) {
979 _timer_exit_phase3.stop();
980 _timer_exit_phase4.start();
981 }
982
983 #if INCLUDE_JVMCI
984 if (JVMCICounterSize > 0) {
985 if (jvmci_counters_include(this)) {
986 for (int i = 0; i < JVMCICounterSize; i++) {
987 _jvmci_old_thread_counters[i] += _jvmci_counters[i];
988 }
989 }
990 }
991 #endif // INCLUDE_JVMCI
992
993 if (bc_counter_value() > 0) {
994 log_info(init)("Thread '%s': " JLONG_FORMAT " bytecodes executed (during clinit: " JLONG_FORMAT ")",
995 thread_name, bc_counter_value(), clinit_bc_counter_value());
996 }
997
998 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
999 // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
1000 Threads::remove(this, daemon);
1001
1002 if (log_is_enabled(Debug, os, thread, timer)) {
1003 _timer_exit_phase4.stop();
1004 log_debug(os, thread, timer)("name='%s'"
1005 ", exit-phase1=" JLONG_FORMAT
1006 ", exit-phase2=" JLONG_FORMAT
1007 ", exit-phase3=" JLONG_FORMAT
1008 ", exit-phase4=" JLONG_FORMAT,
1009 thread_name,
1010 _timer_exit_phase1.milliseconds(),
1011 _timer_exit_phase2.milliseconds(),
1012 _timer_exit_phase3.milliseconds(),
1013 _timer_exit_phase4.milliseconds());
1014 os::free(thread_name);
1015 }
1016 }
1017
|