< prev index next >

src/hotspot/share/runtime/javaThread.cpp

Print this page

 476   _exception_oop(oop()),
 477   _exception_pc(nullptr),
 478   _exception_handler_pc(nullptr),
 479   _is_method_handle_return(0),
 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   _held_monitor_count(0),
 493   _jni_monitor_count(0),
 494   _unlocked_inflated_monitor(nullptr),
 495 


 496   _preempt_alternate_return(nullptr),
 497   _preemption_cancelled(false),
 498   _pending_interrupted_exception(false),
 499 
 500   _handshake(this),
 501   _suspend_resume_manager(this, &_handshake._lock),
 502 
 503   _popframe_preserved_args(nullptr),
 504   _popframe_preserved_args_size(0),
 505 
 506   _jvmti_thread_state(nullptr),
 507   _interp_only_mode(0),
 508   _should_post_on_exceptions_flag(JNI_FALSE),
 509   _thread_stat(new ThreadStatistics()),
 510 
 511   _parker(),
 512 
 513   _class_to_be_initialized(nullptr),
 514   _class_being_initialized(nullptr),
 515 

 964   if (free_handle_block() != nullptr) {
 965     JNIHandleBlock* block = free_handle_block();
 966     set_free_handle_block(nullptr);
 967     JNIHandleBlock::release_block(block);
 968   }
 969 
 970   // These have to be removed while this is still a valid thread.
 971   _stack_overflow_state.remove_stack_guard_pages();
 972 
 973   if (UseTLAB) {
 974     retire_tlab();
 975   }
 976 
 977   if (JvmtiEnv::environments_might_exist()) {
 978     JvmtiExport::cleanup_thread(this);
 979   }
 980 
 981   // We need to cache the thread name for logging purposes below as once
 982   // we have called on_thread_detach this thread must not access any oops.
 983   char* thread_name = nullptr;
 984   if (log_is_enabled(Debug, os, thread, timer)) {
 985     ResourceMark rm(this);
 986     thread_name = os::strdup(name());
 987   }
 988 
 989   if (log_is_enabled(Info, os, thread)) {
 990     ResourceMark rm(this);
 991     log_info(os, thread)("JavaThread %s (name: \"%s\", tid: %zu).",
 992                          exit_type == JavaThread::normal_exit ? "exiting" : "detaching",
 993                          name(), os::current_thread_id());
 994   }
 995 
 996   if (log_is_enabled(Debug, os, thread, timer)) {
 997     _timer_exit_phase3.stop();
 998     _timer_exit_phase4.start();
 999   }
1000 
1001 #if INCLUDE_JVMCI
1002   if (JVMCICounterSize > 0) {
1003     if (jvmci_counters_include(this)) {
1004       for (int i = 0; i < JVMCICounterSize; i++) {
1005         _jvmci_old_thread_counters[i] += _jvmci_counters[i];
1006       }
1007     }
1008   }
1009 #endif // INCLUDE_JVMCI
1010 





1011   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
1012   // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
1013   Threads::remove(this, daemon);
1014 
1015   if (log_is_enabled(Debug, os, thread, timer)) {
1016     _timer_exit_phase4.stop();
1017     log_debug(os, thread, timer)("name='%s'"
1018                                  ", exit-phase1=" JLONG_FORMAT
1019                                  ", exit-phase2=" JLONG_FORMAT
1020                                  ", exit-phase3=" JLONG_FORMAT
1021                                  ", exit-phase4=" JLONG_FORMAT,
1022                                  thread_name,
1023                                  _timer_exit_phase1.milliseconds(),
1024                                  _timer_exit_phase2.milliseconds(),
1025                                  _timer_exit_phase3.milliseconds(),
1026                                  _timer_exit_phase4.milliseconds());
1027     os::free(thread_name);
1028   }
1029 }
1030 

 476   _exception_oop(oop()),
 477   _exception_pc(nullptr),
 478   _exception_handler_pc(nullptr),
 479   _is_method_handle_return(0),
 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   _held_monitor_count(0),
 493   _jni_monitor_count(0),
 494   _unlocked_inflated_monitor(nullptr),
 495 
 496   _can_call_java(true),
 497 
 498   _preempt_alternate_return(nullptr),
 499   _preemption_cancelled(false),
 500   _pending_interrupted_exception(false),
 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(),
 514 
 515   _class_to_be_initialized(nullptr),
 516   _class_being_initialized(nullptr),
 517 

 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     retire_tlab();
 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) || (CountBytecodesPerThread && log_is_enabled(Info, init))) {
 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   if (bc_counter_value() > 0) {
1014     log_info(init)("Thread '%s': " JLONG_FORMAT " bytecodes executed (during clinit: " JLONG_FORMAT ")",
1015                    thread_name, bc_counter_value(), clinit_bc_counter_value());
1016   }
1017 
1018   // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread.
1019   // We call BarrierSet::barrier_set()->on_thread_detach() here so no touching of oops after this point.
1020   Threads::remove(this, daemon);
1021 
1022   if (log_is_enabled(Debug, os, thread, timer)) {
1023     _timer_exit_phase4.stop();
1024     log_debug(os, thread, timer)("name='%s'"
1025                                  ", exit-phase1=" JLONG_FORMAT
1026                                  ", exit-phase2=" JLONG_FORMAT
1027                                  ", exit-phase3=" JLONG_FORMAT
1028                                  ", exit-phase4=" JLONG_FORMAT,
1029                                  thread_name,
1030                                  _timer_exit_phase1.milliseconds(),
1031                                  _timer_exit_phase2.milliseconds(),
1032                                  _timer_exit_phase3.milliseconds(),
1033                                  _timer_exit_phase4.milliseconds());
1034     os::free(thread_name);
1035   }
1036 }
1037 
< prev index next >