Install instrumentation stubs for supporting single thread deopts
We used to instrument with interpreter for supporting single
thread deoptimization. This is not necessary so just
install instrumentation stubs.
Also updates EnsureJitCompiled to handle cases when entry exit
stubs are installed.
Bug: 206029744
Test: test.py
Change-Id: I1d49c7992c7ead7c9f77bf7a432065d440bd5801
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index d3e631c..0d038d7 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -893,8 +893,8 @@
}
void Instrumentation::EnableSingleThreadDeopt(const char* key) {
- // Single-thread deopt only uses interpreter.
- ConfigureStubs(key, InstrumentationLevel::kInstrumentWithInterpreter);
+ // Prepare for single thread deopt by installing instrumentation stubs.
+ ConfigureStubs(key, InstrumentationLevel::kInstrumentWithInstrumentationStubs);
}
void Instrumentation::UpdateInstrumentationLevel(InstrumentationLevel requested_level) {
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index 7a2943c..df7244b 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -225,6 +225,13 @@
static void ForceJitCompiled(Thread* self,
ArtMethod* method,
CompilationKind kind) REQUIRES(!Locks::mutator_lock_) {
+ // TODO(mythria): Update this check once we support method entry / exit hooks directly from
+ // JIT code instead of installing EntryExit stubs.
+ if (Runtime::Current()->GetInstrumentation()->EntryExitStubsInstalled() &&
+ (method->IsNative() || !Runtime::Current()->IsJavaDebuggable())) {
+ return;
+ }
+
{
ScopedObjectAccess soa(self);
if (!Runtime::Current()->GetRuntimeCallbacks()->IsMethodSafeToJit(method)) {