summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/941-recursive-obsolete-jit/src/Main.java6
-rw-r--r--test/943-private-recursive-jit/src/Main.java6
-rw-r--r--test/common/stack_inspect.cc2
3 files changed, 14 insertions, 0 deletions
diff --git a/test/941-recursive-obsolete-jit/src/Main.java b/test/941-recursive-obsolete-jit/src/Main.java
index e3065a7117..f2a397e6bb 100644
--- a/test/941-recursive-obsolete-jit/src/Main.java
+++ b/test/941-recursive-obsolete-jit/src/Main.java
@@ -135,6 +135,12 @@ public class Main {
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 09337bae26..9fa6607e85 100644
--- a/test/943-private-recursive-jit/src/Main.java
+++ b/test/943-private-recursive-jit/src/Main.java
@@ -151,6 +151,12 @@ public class Main {
// 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 1dd5f5a79d..8be355005a 100644
--- a/test/common/stack_inspect.cc
+++ b/test/common/stack_inspect.cc
@@ -82,6 +82,8 @@ static bool IsMethodInterpreted(Thread* self,
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;