Update tests to explicitly ensure JITed code am: 019162fb90
Original change: https://android-review.googlesource.com/c/platform/art/+/2967395
Change-Id: I9f1126e75b5f2533f7b893c7b0d71ce9706c3692
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/test/941-recursive-obsolete-jit/src/Main.java b/test/941-recursive-obsolete-jit/src/Main.java
index e3065a7..f2a397e 100644
--- a/test/941-recursive-obsolete-jit/src/Main.java
+++ b/test/941-recursive-obsolete-jit/src/Main.java
@@ -135,6 +135,12 @@
do {
// Run ensureJitCompiled here since it might get GCd
ensureJitCompiled(Transform.class, "sayHi");
+ // We want to make sure sayHi method gets deoptimized. So we cannot allow any runtime frames
+ // between sayHi and the run method where the transformation is happening. If the run method
+ // is interpreted there will be a runtime frame to transition from JIT to interpreted code.
+ // So ensure the run method is JITed too, so we don't loop for a long time in the hope of
+ // getting the run method JITed.
+ ensureJitCompiled(do_redefinition.getClass(), "run");
// Clear output.
reporter.clear();
t.sayHi(2, reporter, () -> { reporter.accept("Not doing anything here"); });
diff --git a/test/943-private-recursive-jit/src/Main.java b/test/943-private-recursive-jit/src/Main.java
index 09337ba..9fa6607 100644
--- a/test/943-private-recursive-jit/src/Main.java
+++ b/test/943-private-recursive-jit/src/Main.java
@@ -151,6 +151,12 @@
// Run ensureJitCompiled here since it might get GCd
ensureJitCompiled(Transform.class, "sayHi");
ensureJitCompiled(Transform.class, "privateSayHi");
+ // We want to make sure sayHi method gets deoptimized. So we cannot allow any runtime frames
+ // between sayHi and the run method where the transformation is happening. If the run method
+ // is interpreted there will be a runtime frame to transition from JIT to interpreted code.
+ // So ensure the run method is JITed too, so we don't loop for a long time in the hope of
+ // getting the run method JITed.
+ ensureJitCompiled(do_redefinition.getClass(), "run");
// Clear output.
reporter.clear();
t.sayHi(2, reporter, () -> { reporter.accept("Not doing anything here"); });
diff --git a/test/common/stack_inspect.cc b/test/common/stack_inspect.cc
index 1dd5f5a..8be3550 100644
--- a/test/common/stack_inspect.cc
+++ b/test/common/stack_inspect.cc
@@ -82,6 +82,8 @@
StackVisitor::WalkStack(
[&](const art::StackVisitor* stack_visitor) REQUIRES_SHARED(Locks::mutator_lock_) {
if (goal == stack_visitor->GetMethod()) {
+ // We don't deoptimize beyond a runtime frame. So if we need the method to be
+ // deoptimizeable we cannot allow the previous frame to be a runtime frame.
*method_is_interpreted =
(require_deoptable && prev_was_runtime) || stack_visitor->IsShadowFrame();
method_found = true;