diff options
author | 2022-01-12 10:02:38 +0000 | |
---|---|---|
committer | 2022-01-18 09:09:55 +0000 | |
commit | 8f3beae019ef166b6646a48a28b1f4b77fabd851 (patch) | |
tree | dbd5105c5e08210b7ba9e7c7fcdc92266d089f20 /openjdkjvmti/deopt_manager.cc | |
parent | 414f299df5de770e20f90007b60b3a408aeb1e58 (diff) |
Cleanup method inspection callbacks from jvmti
We used to use three different inspection callbacks for kind of similar
checks.
- IsMethodBeingInspected - returns true if method has breakpoints or if
we need to observe any locals (ideally for only this method but
current implementation is not ideal). This is used to check if we can
JIT code.
- IsMethodSafeToJit - returns true if method has breakpoints. Though we
also check if a method is being inspected making this check redundant.
- IsMethodNeedsDebugVersion - this is used to check if we need to use
switch interpreter. This was always returning true forcing us to use
switch interpreter when debugger is attached. We should use
IsMethodBeingInspected instead.
This CL merges all these into IsMethodBeingInspected callback.
Bug: 206029744
Test: test.py --gtest --run-test
Change-Id: Idcde354f39775092be5ddb79f09a92f81e07b1ee
Diffstat (limited to 'openjdkjvmti/deopt_manager.cc')
-rw-r--r-- | openjdkjvmti/deopt_manager.cc | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc index 396459619f..a15e6678f1 100644 --- a/openjdkjvmti/deopt_manager.cc +++ b/openjdkjvmti/deopt_manager.cc @@ -67,22 +67,10 @@ namespace openjdkjvmti { // has we only care about methods with active breakpoints on them. In the future we should probably // rewrite all of this to instead do this at the ShadowFrame or thread granularity. bool JvmtiMethodInspectionCallback::IsMethodBeingInspected(art::ArtMethod* method) { - // Non-java-debuggable runtimes we need to assume that any method might not be debuggable and - // therefore potentially being inspected (due to inlines). If we are debuggable we rely hard on - // inlining not being done since we don't keep track of which methods get inlined where and simply - // look to see if the method is breakpointed. - return !art::Runtime::Current()->IsJavaDebuggable() || - manager_->HaveLocalsChanged() || - manager_->MethodHasBreakpoints(method); -} - -bool JvmtiMethodInspectionCallback::IsMethodSafeToJit(art::ArtMethod* method) { - return !manager_->MethodHasBreakpoints(method); -} - -bool JvmtiMethodInspectionCallback::MethodNeedsDebugVersion( - art::ArtMethod* method ATTRIBUTE_UNUSED) { - return true; + // In non-java-debuggable runtimes the breakpoint check would miss if we have breakpoints on + // methods that are inlined. Since these features are best effort in non-java-debuggable + // runtimes it is OK to be less precise. For debuggable runtimes, inlining is disabled. + return manager_->HaveLocalsChanged() || manager_->MethodHasBreakpoints(method); } DeoptManager::DeoptManager() |