summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_phase.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2017-11-21 00:00:48 +0000
committer Alex Light <allight@google.com> 2017-11-20 16:58:05 -0800
commitb284f8d775ac32d8109744d94b99da451570beef (patch)
treec720648f1c018d224410314b30a891f2752bc781 /openjdkjvmti/ti_phase.cc
parente6779fde5a3c0a8bb484a61398da439a37d25b92 (diff)
Revert "Revert "Make JVMTI DisposeEnvironment and GetEnv thread safe.""
This reverts commit af9341087aab0146b8323ece156bde8130948465. We needed to allow TopLockLevel locks to be acquired when the mutator_lock_ is exclusive held. This is required for spec conformance. To ensure there are no deadlocks the mutator_lock_ is the only lock level with this exception and one cannot acquire the mutator_lock_ when one holds any kTopLockLevel locks. Reason for revert: Fixed issue causing test 913 failure in art-gc-gss-tlab Test: ART_DEFAULT_GC_TYPE=GSS \ ART_USE_TLAB=true \ ART_USE_READ_BARRIER=false ./test.py --host -j50 Bug: 69465262 Change-Id: Ic1a4d9bb3ff64382ba7ae22ba27a4f44628ed095
Diffstat (limited to 'openjdkjvmti/ti_phase.cc')
-rw-r--r--openjdkjvmti/ti_phase.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/openjdkjvmti/ti_phase.cc b/openjdkjvmti/ti_phase.cc
index 23df27fbda..7157974c13 100644
--- a/openjdkjvmti/ti_phase.cc
+++ b/openjdkjvmti/ti_phase.cc
@@ -57,6 +57,7 @@ struct PhaseUtil::PhaseCallback : public art::RuntimePhaseCallback {
}
void NextRuntimePhase(RuntimePhase phase) REQUIRES_SHARED(art::Locks::mutator_lock_) OVERRIDE {
+ art::Thread* self = art::Thread::Current();
switch (phase) {
case RuntimePhase::kInitialAgents:
PhaseUtil::current_phase_ = JVMTI_PHASE_PRIMORDIAL;
@@ -64,8 +65,7 @@ struct PhaseUtil::PhaseCallback : public art::RuntimePhaseCallback {
case RuntimePhase::kStart:
{
PhaseUtil::current_phase_ = JVMTI_PHASE_START;
- art::ScopedThreadSuspension sts(art::Thread::Current(), art::ThreadState::kNative);
- event_handler->DispatchEvent<ArtJvmtiEvent::kVmStart>(nullptr, GetJniEnv());
+ event_handler->DispatchEvent<ArtJvmtiEvent::kVmStart>(self, GetJniEnv());
}
break;
case RuntimePhase::kInit:
@@ -74,9 +74,7 @@ struct PhaseUtil::PhaseCallback : public art::RuntimePhaseCallback {
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());
+ event_handler->DispatchEvent<ArtJvmtiEvent::kVmInit>(self, 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
@@ -86,8 +84,7 @@ struct PhaseUtil::PhaseCallback : public art::RuntimePhaseCallback {
break;
case RuntimePhase::kDeath:
{
- art::ScopedThreadSuspension sts(art::Thread::Current(), art::ThreadState::kNative);
- event_handler->DispatchEvent<ArtJvmtiEvent::kVmDeath>(nullptr, GetJniEnv());
+ event_handler->DispatchEvent<ArtJvmtiEvent::kVmDeath>(self, GetJniEnv());
PhaseUtil::current_phase_ = JVMTI_PHASE_DEAD;
}
// TODO: Block events now.