| 
 
 473   _live_nmethod(nullptr),
 474 #endif // INCLUDE_JVMCI
 475 
 476   _exception_oop(oop()),
 477   _exception_pc(nullptr),
 478   _exception_handler_pc(nullptr),
 479 
 480   _jni_active_critical(0),
 481   _pending_jni_exception_check_fn(nullptr),
 482   _depth_first_number(0),
 483 
 484   // JVMTI PopFrame support
 485   _popframe_condition(popframe_inactive),
 486   _frames_to_pop_failed_realloc(0),
 487 
 488   _cont_entry(nullptr),
 489   _cont_fastpath(nullptr),
 490   _cont_fastpath_thread_state(1),
 491   _unlocked_inflated_monitor(nullptr),
 492 
 493   _preempt_alternate_return(nullptr),
 494   _preemption_cancelled(false),
 495   _pending_interrupted_exception(false),
 496 
 497   _handshake(this),
 498   _suspend_resume_manager(this, &_handshake._lock),
 499 
 500   _popframe_preserved_args(nullptr),
 501   _popframe_preserved_args_size(0),
 502 
 503   _jvmti_thread_state(nullptr),
 504   _interp_only_mode(0),
 505   _should_post_on_exceptions_flag(JNI_FALSE),
 506   _thread_stat(new ThreadStatistics()),
 507 
 508   _parker(),
 509 
 510   _class_to_be_initialized(nullptr),
 511   _class_being_initialized(nullptr),
 512 
 
 
 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 
 | 
 
 473   _live_nmethod(nullptr),
 474 #endif // INCLUDE_JVMCI
 475 
 476   _exception_oop(oop()),
 477   _exception_pc(nullptr),
 478   _exception_handler_pc(nullptr),
 479 
 480   _jni_active_critical(0),
 481   _pending_jni_exception_check_fn(nullptr),
 482   _depth_first_number(0),
 483 
 484   // JVMTI PopFrame support
 485   _popframe_condition(popframe_inactive),
 486   _frames_to_pop_failed_realloc(0),
 487 
 488   _cont_entry(nullptr),
 489   _cont_fastpath(nullptr),
 490   _cont_fastpath_thread_state(1),
 491   _unlocked_inflated_monitor(nullptr),
 492 
 493   _can_call_java(true),
 494 
 495   _preempt_alternate_return(nullptr),
 496   _preemption_cancelled(false),
 497   _pending_interrupted_exception(false),
 498 
 499   _handshake(this),
 500   _suspend_resume_manager(this, &_handshake._lock),
 501 
 502   _popframe_preserved_args(nullptr),
 503   _popframe_preserved_args_size(0),
 504 
 505   _jvmti_thread_state(nullptr),
 506   _interp_only_mode(0),
 507   _should_post_on_exceptions_flag(JNI_FALSE),
 508   _thread_stat(new ThreadStatistics()),
 509 
 510   _parker(),
 511 
 512   _class_to_be_initialized(nullptr),
 513   _class_being_initialized(nullptr),
 514 
 
 
 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 
 |