Force JIT compilation in 680-checker-deopt-dex-pc-0.
Do not rely on reaching the JIT threshold as this can
take a long time and time out on heavily loaded hosts.
Test: testrunner.py --host -t 680-checker-deopt-dex-pc-0 \
--runtime-option:-Xjitthreshold:0
Bug: 62611253
Change-Id: Ib180b61744e832779e577c86a39b476cb3856198
diff --git a/test/680-checker-deopt-dex-pc-0/src/Main.java b/test/680-checker-deopt-dex-pc-0/src/Main.java
index d5a6a90..64a3cb3 100644
--- a/test/680-checker-deopt-dex-pc-0/src/Main.java
+++ b/test/680-checker-deopt-dex-pc-0/src/Main.java
@@ -31,15 +31,12 @@
System.loadLibrary(args[0]);
if (hasJit()) {
byte[] array = { 0, 1, 2, 3 };
- while (!hasJitCompiledEntrypoint(Main.class, "$noinline$getInt")) {
- for (int i = 0; i < 10000; ++i) {
- if ($noinline$getInt(array, 0) != 0x03020100) {
- throw new Error();
- }
- }
- try {
- Thread.sleep(200);
- } catch (InterruptedException ignored) {}
+ ensureJitCompiled(Main.class, "$noinline$getInt");
+ if (!hasJitCompiledEntrypoint(Main.class, "$noinline$getInt")) {
+ throw new Error("Unexpected entrypoint!");
+ }
+ if ($noinline$getInt(array, 0) != 0x03020100) {
+ throw new Error();
}
try {
// The HDeoptimize at dex pc 0 was previously handled poorly as the dex pc 0
@@ -56,4 +53,5 @@
public static native boolean hasJit();
public native static boolean hasJitCompiledEntrypoint(Class<?> cls, String methodName);
+ public native static void ensureJitCompiled(Class<?> cls, String methodName);
}