Cleanup around method inspection callbacks
IsMethodBeingInspected callback was used to prevent moving to compiled
code (JIT / OSR / Nterp) while a method has breakpoints or other
debugger related events enabled. We also use Instrumentation::IsDeoptimized
for similar purpose in some places (for ex: when determining if a method
needs to be deoptimized). Deoptimized methods list is a super set of
methods that have breakpoints on them. So we can replace most method
inspection callbacks to use IsDeoptimized check instead.
The one exception is when we decide if we need to OSR a method. Here we
need to check if the frame has any locals changed which isn't covered by
IsDeoptimized check and requires a runtime callback to see if any locals
have changed.
This CL:
1. Adds a new runtime callback called HaveLocalsChanged to check if any
locals have changed and uses it to prevent OSRing such frames.
2. Removes IsMethodBeingInspected and replaces it with IsDeoptimized /
HaveLocalsChanged as required.
Bug: 206029744
Test: art/test.py
Change-Id: Ie649cffaeba3d31746527e0ee326abe81284978d
diff --git a/runtime/runtime_callbacks.cc b/runtime/runtime_callbacks.cc
index 753ac28..28c81a2 100644
--- a/runtime/runtime_callbacks.cc
+++ b/runtime/runtime_callbacks.cc
@@ -105,9 +105,9 @@
Remove(cb, &method_inspection_callbacks_);
}
-bool RuntimeCallbacks::IsMethodBeingInspected(ArtMethod* m) {
+bool RuntimeCallbacks::HaveLocalsChanged() {
for (MethodInspectionCallback* cb : COPY(method_inspection_callbacks_)) {
- if (cb->IsMethodBeingInspected(m)) {
+ if (cb->HaveLocalsChanged()) {
return true;
}
}