mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8210024: JFR calls virtual is_Java_thread from ~Thread()
Reviewed-by: kbarrett, dholmes, dcubed, egahlin
This commit is contained in:
parent
acc32136c3
commit
8ed728c905
7 changed files with 77 additions and 84 deletions
|
@ -41,7 +41,6 @@
|
|||
#include "interpreter/linkResolver.hpp"
|
||||
#include "interpreter/oopMapCache.hpp"
|
||||
#include "jfr/jfrEvents.hpp"
|
||||
#include "jfr/support/jfrThreadId.hpp"
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "logging/log.hpp"
|
||||
#include "logging/logConfiguration.hpp"
|
||||
|
@ -369,6 +368,8 @@ void Thread::call_run() {
|
|||
|
||||
register_thread_stack_with_NMT();
|
||||
|
||||
JFR_ONLY(Jfr::on_thread_start(this);)
|
||||
|
||||
log_debug(os, thread)("Thread " UINTX_FORMAT " stack dimensions: "
|
||||
PTR_FORMAT "-" PTR_FORMAT " (" SIZE_FORMAT "k).",
|
||||
os::current_thread_id(), p2i(stack_base() - stack_size()),
|
||||
|
@ -393,8 +394,6 @@ void Thread::call_run() {
|
|||
}
|
||||
|
||||
Thread::~Thread() {
|
||||
JFR_ONLY(Jfr::on_thread_destruct(this);)
|
||||
|
||||
// Notify the barrier set that a thread is being destroyed. Note that a barrier
|
||||
// set might not be available if we encountered errors during bootstrapping.
|
||||
BarrierSet* const barrier_set = BarrierSet::barrier_set();
|
||||
|
@ -402,7 +401,6 @@ Thread::~Thread() {
|
|||
barrier_set->on_thread_destroy(this);
|
||||
}
|
||||
|
||||
|
||||
// stack_base can be NULL if the thread is never started or exited before
|
||||
// record_stack_base_and_size called. Although, we would like to ensure
|
||||
// that all started threads do call record_stack_base_and_size(), there is
|
||||
|
@ -1258,6 +1256,7 @@ NonJavaThread::NonJavaThread() : Thread(), _next(NULL) {
|
|||
}
|
||||
|
||||
NonJavaThread::~NonJavaThread() {
|
||||
JFR_ONLY(Jfr::on_thread_exit(this);)
|
||||
// Remove this thread from _the_list.
|
||||
MutexLockerEx lock(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
|
||||
NonJavaThread* volatile* p = &_the_list._head;
|
||||
|
@ -1780,12 +1779,7 @@ void JavaThread::run() {
|
|||
|
||||
if (JvmtiExport::should_post_thread_life()) {
|
||||
JvmtiExport::post_thread_start(this);
|
||||
}
|
||||
|
||||
EventThreadStart event;
|
||||
if (event.should_commit()) {
|
||||
event.set_thread(JFR_THREAD_ID(this));
|
||||
event.commit();
|
||||
}
|
||||
|
||||
// We call another function to do the rest so we are sure that the stack addresses used
|
||||
|
@ -1889,17 +1883,7 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
|
|||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
}
|
||||
|
||||
// Called before the java thread exit since we want to read info
|
||||
// from java_lang_Thread object
|
||||
EventThreadEnd event;
|
||||
if (event.should_commit()) {
|
||||
event.set_thread(JFR_THREAD_ID(this));
|
||||
event.commit();
|
||||
}
|
||||
|
||||
// Call after last event on thread
|
||||
JFR_ONLY(Jfr::on_thread_exit(this);)
|
||||
JFR_ONLY(Jfr::on_java_thread_dismantle(this);)
|
||||
|
||||
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during
|
||||
// the execution of the method. If that is not enough, then we don't really care. Thread.stop
|
||||
|
@ -1988,6 +1972,7 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
|
|||
|
||||
// These things needs to be done while we are still a Java Thread. Make sure that thread
|
||||
// is in a consistent state, in case GC happens
|
||||
JFR_ONLY(Jfr::on_thread_exit(this);)
|
||||
|
||||
if (active_handles() != NULL) {
|
||||
JNIHandleBlock* block = active_handles();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue