summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2020-01-08 14:47:26 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2020-01-15 10:49:45 +0000
commit2ba6ff25938e6f1755748a4c7ef3ad0b45be6df7 (patch)
tree80d8b3f4142262c8b7099472617ae1e72eb776c5
parent46d7b24ddb2160123afb3facad4b54242422a45f (diff)
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
-rw-r--r--test/563-checker-fakestring/src/Main.java5
-rw-r--r--test/575-checker-string-init-alias/src/Main.java5
2 files changed, 10 insertions, 0 deletions
diff --git a/test/563-checker-fakestring/src/Main.java b/test/563-checker-fakestring/src/Main.java
index 77a108faa5..1ca80f08e7 100644
--- a/test/563-checker-fakestring/src/Main.java
+++ b/test/563-checker-fakestring/src/Main.java
@@ -22,6 +22,7 @@ public class Main {
class Inner {}
public static native void assertIsInterpreted();
+ public static native void ensureJitCompiled(Class<?> cls, String methodName);
public static void assertEqual(String expected, String actual) {
if (!expected.equals(actual)) {
@@ -53,6 +54,8 @@ public class Main {
}
{
+ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
+ ensureJitCompiled(c, "deoptimizeNewInstance");
Method m = c.getMethod("deoptimizeNewInstance", int[].class, byte[].class);
try {
m.invoke(null, new Object[] { new int[] { 1, 2, 3 }, testData });
@@ -114,6 +117,8 @@ public class Main {
assertEqual(testString, result);
}
{
+ // If the JIT is enabled, ensure it has compiled the method to force the deopt.
+ ensureJitCompiled(c, "deoptimizeNewInstanceAfterLoop");
Method m = c.getMethod(
"deoptimizeNewInstanceAfterLoop", int[].class, byte[].class, int.class);
try {
diff --git a/test/575-checker-string-init-alias/src/Main.java b/test/575-checker-string-init-alias/src/Main.java
index 1ab320748a..b55b0c5ad8 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 @@ public class Main {
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 @@ public class Main {
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 @@ public class Main {
}
{
+ // 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" });