1.1 --- a/src/share/vm/runtime/thread.cpp Wed Dec 05 16:40:12 2018 +0100 1.2 +++ b/src/share/vm/runtime/thread.cpp Thu Nov 15 11:10:04 2018 +0100 1.3 @@ -33,7 +33,6 @@ 1.4 #include "interpreter/linkResolver.hpp" 1.5 #include "interpreter/oopMapCache.hpp" 1.6 #include "jfr/jfrEvents.hpp" 1.7 -#include "jfr/support/jfrThreadId.hpp" 1.8 #include "jvmtifiles/jvmtiEnv.hpp" 1.9 #include "memory/gcLocker.inline.hpp" 1.10 #include "memory/metaspaceShared.hpp" 1.11 @@ -345,8 +344,6 @@ 1.12 // Reclaim the objectmonitors from the omFreeList of the moribund thread. 1.13 ObjectSynchronizer::omFlush (this) ; 1.14 1.15 - JFR_ONLY(Jfr::on_thread_destruct(this);) 1.16 - 1.17 // stack_base can be NULL if the thread is never started or exited before 1.18 // record_stack_base_and_size called. Although, we would like to ensure 1.19 // that all started threads do call record_stack_base_and_size(), there is 1.20 @@ -1215,6 +1212,7 @@ 1.21 } 1.22 1.23 NamedThread::~NamedThread() { 1.24 + JFR_ONLY(Jfr::on_thread_exit(this);) 1.25 if (_name != NULL) { 1.26 FREE_C_HEAP_ARRAY(char, _name, mtThread); 1.27 _name = NULL; 1.28 @@ -1672,11 +1670,7 @@ 1.29 JvmtiExport::post_thread_start(this); 1.30 } 1.31 1.32 - EventThreadStart event; 1.33 - if (event.should_commit()) { 1.34 - event.set_thread(JFR_THREAD_ID(this)); 1.35 - event.commit(); 1.36 - } 1.37 + JFR_ONLY(Jfr::on_thread_start(this);) 1.38 1.39 // We call another function to do the rest so we are sure that the stack addresses used 1.40 // from there will be lower than the stack base just computed 1.41 @@ -1803,17 +1797,7 @@ 1.42 } 1.43 } 1.44 } 1.45 - 1.46 - // Called before the java thread exit since we want to read info 1.47 - // from java_lang_Thread object 1.48 - EventThreadEnd event; 1.49 - if (event.should_commit()) { 1.50 - event.set_thread(JFR_THREAD_ID(this)); 1.51 - event.commit(); 1.52 - } 1.53 - 1.54 - // Call after last event on thread 1.55 - JFR_ONLY(Jfr::on_thread_exit(this);) 1.56 + JFR_ONLY(Jfr::on_java_thread_dismantle(this);) 1.57 1.58 // Call Thread.exit(). We try 3 times in case we got another Thread.stop during 1.59 // the execution of the method. If that is not enough, then we don't really care. Thread.stop 1.60 @@ -1890,6 +1874,7 @@ 1.61 // These things needs to be done while we are still a Java Thread. Make sure that thread 1.62 // is in a consistent state, in case GC happens 1.63 assert(_privileged_stack_top == NULL, "must be NULL when we get here"); 1.64 + JFR_ONLY(Jfr::on_thread_exit(this);) 1.65 1.66 if (active_handles() != NULL) { 1.67 JNIHandleBlock* block = active_handles();