summaryrefslogtreecommitdiff
path: root/openjdkjvmti/deopt_manager.cc
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2023-10-06 16:22:15 +0000
committer Mythri Alle <mythria@google.com> 2023-10-11 10:15:29 +0000
commit6f563af0994a422d4829a295841f8c0641293afb (patch)
tree3c80a57f8a59376720bfa3872d8f17b26e3d56af /openjdkjvmti/deopt_manager.cc
parent6f2189f2bcf65c58b1bc79b33eca715df35a3d92 (diff)
Update entrypoints after switching the runtime to non-debuggable
When detaching a debugger or stopping tracing in non-debuggable runtimes, we switch back to non-debuggable mode. We used to switch to non-debuggable mode after updating the entrypoints of methods. This meant we don't use AOT code for these methods. For this to work correctly we should 1. Update instrumentation level 2. Switch runtime if possible 3. Update entry points. Since this order is important, we no longer expose MaybeSwitchRuntime as a public member. Instead we pass a parameter that says if we should try and switch the runtime to non-debuggable. Bug: 303686344 Test: art/test.py Change-Id: Id655ca50964ed10072ff5bfc3e565c08ecb9987b
Diffstat (limited to 'openjdkjvmti/deopt_manager.cc')
-rw-r--r--openjdkjvmti/deopt_manager.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index 025bed53b2..42ab5d30dc 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -388,9 +388,14 @@ void DeoptManager::Shutdown() {
return;
}
- runtime->GetInstrumentation()->DisableDeoptimization(kInstrumentationKey);
- runtime->GetInstrumentation()->DisableDeoptimization(kDeoptManagerInstrumentationKey);
- runtime->GetInstrumentation()->MaybeSwitchRuntimeDebugState(self);
+ // If we attach a debugger to a non-debuggable runtime, we switch the runtime to debuggable to
+ // provide a consistent (though still best effort) support. Since we are detaching the debugger
+ // now, switch it back to non-debuggable if there are no other debugger / profiling tools are
+ // active.
+ runtime->GetInstrumentation()->DisableDeoptimization(kInstrumentationKey,
+ /*try_switch_to_non_debuggable=*/true);
+ runtime->GetInstrumentation()->DisableDeoptimization(kDeoptManagerInstrumentationKey,
+ /*try_switch_to_non_debuggable=*/true);
}
void DeoptManager::RemoveDeoptimizeAllMethodsLocked(art::Thread* self) {
@@ -475,7 +480,8 @@ void DeoptManager::RemoveDeoptimizationRequester() {
deopter_count_--;
if (deopter_count_ == 0) {
ScopedDeoptimizationContext sdc(self, this);
- art::Runtime::Current()->GetInstrumentation()->DisableDeoptimization(kInstrumentationKey);
+ art::Runtime::Current()->GetInstrumentation()->DisableDeoptimization(
+ kInstrumentationKey, /*try_switch_to_non_debuggable=*/false);
return;
} else {
deoptimization_status_lock_.ExclusiveUnlock(self);