summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2024-02-20 10:00:11 +0000
committer Mythri Alle <mythria@google.com> 2024-02-21 14:33:23 +0000
commit019162fb900c775d582213d22b3f1ce063553969 (patch)
tree9fe7eb99aedc5f17bfb7295461529fccc6d120a4
parent89a46d558447f376e965a03d49033ca1787cc146 (diff)
Update tests to explicitly ensure JITed code
941-recursive-obsolete-jit and 943-private-recursive-jit test that deoptimizing a method and marking it obsolete while transforming the same method works fine. Since we don't deoptimize through runtime frames, we ensure there are no runtime frames in between. This means that we should ensure the methods called by the test method should be JITed as well. Earlier this was ensured because we loop till this happens. This causes timeouts in some cases so explicitly ensure we have JITed code. Test: art/test.py -t 941 / 943 --gcstress Change-Id: I04f83cb2a55fdae44cb8ebd0511fc4ef72810881
-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;