diff options
Diffstat (limited to 'openjdkjvmti/ti_phase.cc')
-rw-r--r-- | openjdkjvmti/ti_phase.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/openjdkjvmti/ti_phase.cc b/openjdkjvmti/ti_phase.cc index e8c1ca7335..07cf31c354 100644 --- a/openjdkjvmti/ti_phase.cc +++ b/openjdkjvmti/ti_phase.cc @@ -72,9 +72,16 @@ struct PhaseUtil::PhaseCallback : public art::RuntimePhaseCallback { { ThreadUtil::CacheData(); PhaseUtil::current_phase_ = JVMTI_PHASE_LIVE; - ScopedLocalRef<jthread> thread(GetJniEnv(), GetCurrentJThread()); - art::ScopedThreadSuspension sts(art::Thread::Current(), art::ThreadState::kNative); - event_handler->DispatchEvent<ArtJvmtiEvent::kVmInit>(nullptr, GetJniEnv(), thread.get()); + { + ScopedLocalRef<jthread> thread(GetJniEnv(), GetCurrentJThread()); + art::ScopedThreadSuspension sts(art::Thread::Current(), art::ThreadState::kNative); + event_handler->DispatchEvent<ArtJvmtiEvent::kVmInit>( + nullptr, GetJniEnv(), thread.get()); + } + // We need to have these events be ordered to match behavior expected by some real-world + // agents. The spec does not really require this but compatibility is a useful property to + // maintain. + ThreadUtil::VMInitEventSent(); } break; case RuntimePhase::kDeath: |