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