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