481 _exception_oop(oop()),
482 _exception_pc(nullptr),
483 _exception_handler_pc(nullptr),
484 _is_method_handle_return(0),
485
486 _jni_active_critical(0),
487 _pending_jni_exception_check_fn(nullptr),
488 _depth_first_number(0),
489
490 // JVMTI PopFrame support
491 _popframe_condition(popframe_inactive),
492 _frames_to_pop_failed_realloc(0),
493
494 _cont_entry(nullptr),
495 _cont_fastpath(nullptr),
496 _cont_fastpath_thread_state(1),
497 _held_monitor_count(0),
498 _jni_monitor_count(0),
499 _unlocked_inflated_monitor(nullptr),
500
501 _preempt_alternate_return(nullptr),
502 _preemption_cancelled(false),
503 _pending_interrupted_exception(false),
504
505 _handshake(this),
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(),
516
517 _class_to_be_initialized(nullptr),
518 _class_being_initialized(nullptr),
519
520 _SleepEvent(ParkEvent::Allocate(this)),
966 if (free_handle_block() != nullptr) {
967 JNIHandleBlock* block = free_handle_block();
968 set_free_handle_block(nullptr);
969 JNIHandleBlock::release_block(block);
970 }
971
972 // These have to be removed while this is still a valid thread.
973 _stack_overflow_state.remove_stack_guard_pages();
974
975 if (UseTLAB) {
976 tlab().retire();
977 }
978
979 if (JvmtiEnv::environments_might_exist()) {
980 JvmtiExport::cleanup_thread(this);
981 }
982
983 // We need to cache the thread name for logging purposes below as once
984 // we have called on_thread_detach this thread must not access any oops.
985 char* thread_name = nullptr;
986 if (log_is_enabled(Debug, os, thread, timer)) {
987 ResourceMark rm(this);
988 thread_name = os::strdup(name());
989 }
990
991 if (log_is_enabled(Info, os, thread)) {
992 ResourceMark rm(this);
993 log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).",
994 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
995 name(), os::current_thread_id());
996 }
997
998 if (log_is_enabled(Debug, os, thread, timer)) {
999 _timer_exit_phase3.stop();
1000 _timer_exit_phase4.start();
1001 }
1002
1003 #if INCLUDE_JVMCI
1004 if (JVMCICounterSize > 0) {
1005 if (jvmci_counters_include(this)) {
1006 for (int i = 0; i < JVMCICounterSize; i++) {
1007 _jvmci_old_thread_counters[i] += _jvmci_counters[i];
1008 }
1009 }
1010 }
1011 #endif // INCLUDE_JVMCI
1012
1013 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
1014 // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
1015 Threads::remove(this, daemon);
1016
1017 if (log_is_enabled(Debug, os, thread, timer)) {
1018 _timer_exit_phase4.stop();
1019 log_debug(os, thread, timer)("name='%s'"
1020 ", exit-phase1=" JLONG_FORMAT
1021 ", exit-phase2=" JLONG_FORMAT
1022 ", exit-phase3=" JLONG_FORMAT
1023 ", exit-phase4=" JLONG_FORMAT,
1024 thread_name,
1025 _timer_exit_phase1.milliseconds(),
1026 _timer_exit_phase2.milliseconds(),
1027 _timer_exit_phase3.milliseconds(),
1028 _timer_exit_phase4.milliseconds());
1029 os::free(thread_name);
1030 }
1031 }
1032
|
481 _exception_oop(oop()),
482 _exception_pc(nullptr),
483 _exception_handler_pc(nullptr),
484 _is_method_handle_return(0),
485
486 _jni_active_critical(0),
487 _pending_jni_exception_check_fn(nullptr),
488 _depth_first_number(0),
489
490 // JVMTI PopFrame support
491 _popframe_condition(popframe_inactive),
492 _frames_to_pop_failed_realloc(0),
493
494 _cont_entry(nullptr),
495 _cont_fastpath(nullptr),
496 _cont_fastpath_thread_state(1),
497 _held_monitor_count(0),
498 _jni_monitor_count(0),
499 _unlocked_inflated_monitor(nullptr),
500
501 _can_call_java(true),
502
503 _preempt_alternate_return(nullptr),
504 _preemption_cancelled(false),
505 _pending_interrupted_exception(false),
506
507 _handshake(this),
508
509 _popframe_preserved_args(nullptr),
510 _popframe_preserved_args_size(0),
511
512 _jvmti_thread_state(nullptr),
513 _interp_only_mode(0),
514 _should_post_on_exceptions_flag(JNI_FALSE),
515 _thread_stat(new ThreadStatistics()),
516
517 _parker(),
518
519 _class_to_be_initialized(nullptr),
520 _class_being_initialized(nullptr),
521
522 _SleepEvent(ParkEvent::Allocate(this)),
968 if (free_handle_block() != nullptr) {
969 JNIHandleBlock* block = free_handle_block();
970 set_free_handle_block(nullptr);
971 JNIHandleBlock::release_block(block);
972 }
973
974 // These have to be removed while this is still a valid thread.
975 _stack_overflow_state.remove_stack_guard_pages();
976
977 if (UseTLAB) {
978 tlab().retire();
979 }
980
981 if (JvmtiEnv::environments_might_exist()) {
982 JvmtiExport::cleanup_thread(this);
983 }
984
985 // We need to cache the thread name for logging purposes below as once
986 // we have called on_thread_detach this thread must not access any oops.
987 char* thread_name = nullptr;
988 if (log_is_enabled(Debug, os, thread, timer) || (CountBytecodesPerThread && log_is_enabled(Info, init))) {
989 ResourceMark rm(this);
990 thread_name = os::strdup(name());
991 }
992
993 if (log_is_enabled(Info, os, thread)) {
994 ResourceMark rm(this);
995 log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).",
996 exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
997 name(), os::current_thread_id());
998 }
999
1000 if (log_is_enabled(Debug, os, thread, timer)) {
1001 _timer_exit_phase3.stop();
1002 _timer_exit_phase4.start();
1003 }
1004
1005 #if INCLUDE_JVMCI
1006 if (JVMCICounterSize > 0) {
1007 if (jvmci_counters_include(this)) {
1008 for (int i = 0; i < JVMCICounterSize; i++) {
1009 _jvmci_old_thread_counters[i] += _jvmci_counters[i];
1010 }
1011 }
1012 }
1013 #endif // INCLUDE_JVMCI
1014
1015 if (bc_counter_value() > 0) {
1016 log_info(init)("Thread '%s': " JLONG_FORMAT " bytecodes executed (during clinit: " JLONG_FORMAT ")",
1017 thread_name, bc_counter_value(), clinit_bc_counter_value());
1018 }
1019
1020 // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
1021 // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
1022 Threads::remove(this, daemon);
1023
1024 if (log_is_enabled(Debug, os, thread, timer)) {
1025 _timer_exit_phase4.stop();
1026 log_debug(os, thread, timer)("name='%s'"
1027 ", exit-phase1=" JLONG_FORMAT
1028 ", exit-phase2=" JLONG_FORMAT
1029 ", exit-phase3=" JLONG_FORMAT
1030 ", exit-phase4=" JLONG_FORMAT,
1031 thread_name,
1032 _timer_exit_phase1.milliseconds(),
1033 _timer_exit_phase2.milliseconds(),
1034 _timer_exit_phase3.milliseconds(),
1035 _timer_exit_phase4.milliseconds());
1036 os::free(thread_name);
1037 }
1038 }
1039
|