Fix String.init tests with baseline JIT.
Baseline JIT doesn't do deoptimizations, but the test assumes compiled
code will. Adjust the test to call ensureJitCompiled to force
non-baseline compilation.
Test: testrunner.py --host --64 --jit -t 563 -t 575
Bug: 147209001
Change-Id: I062650e07616610b01415e3add193687fcc35e30
diff --git a/test/575-checker-string-init-alias/src/Main.java b/test/575-checker-string-init-alias/src/Main.java
index 1ab3207..b55b0c5 100644
--- a/test/575-checker-string-init-alias/src/Main.java
+++ b/test/575-checker-string-init-alias/src/Main.java
@@ -23,6 +23,7 @@
class Inner {}
public static native void assertIsInterpreted();
+ public static native void ensureJitCompiled(Class<?> cls, String methodName);
private static void assertEqual(String expected, String actual) {
if (!expected.equals(actual)) {
@@ -36,6 +37,8 @@
int[] array = new int[1];
{
+ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
+ ensureJitCompiled(c, "testNoAlias");
Method m = c.getMethod("testNoAlias", int[].class, String.class);
try {
m.invoke(null, new Object[] { array , "foo" });
@@ -51,6 +54,8 @@
}
{
+ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
+ ensureJitCompiled(c, "testAlias");
Method m = c.getMethod("testAlias", int[].class, String.class);
try {
m.invoke(null, new Object[] { array, "bar" });