diff options
| -rw-r--r-- | test/1935-get-set-current-frame-jit/src/Main.java | 8 | ||||
| -rw-r--r-- | test/common/runtime_state.cc | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/test/1935-get-set-current-frame-jit/src/Main.java b/test/1935-get-set-current-frame-jit/src/Main.java index 97f0973823..cc8a4c4956 100644 --- a/test/1935-get-set-current-frame-jit/src/Main.java +++ b/test/1935-get-set-current-frame-jit/src/Main.java @@ -58,7 +58,8 @@ public class Main { } public void run() { int TARGET = 42; - if (hasJit() && expectOsr && !Main.isInterpreted()) { + boolean normalJit = hasJit() && getJitThreshold() != 0; // Excluding JIT-at-first-use. + if (normalJit && expectOsr && !Main.isInterpreted()) { System.out.println("Unexpectedly in jit code prior to restarting the JIT!"); } startJit(); @@ -72,10 +73,10 @@ public class Main { do { // Don't actually do anything here. inBusyLoop = true; - } while (hasJit() && !Main.isInOsrCode("run") && osrDeadline.compareTo(Instant.now()) > 0); + } while (normalJit && !Main.isInOsrCode("run") && osrDeadline.compareTo(Instant.now()) > 0); // We shouldn't be doing OSR since we are using JVMTI and the set prevents OSR. // Set local will also push us to interpreter but the get local may remain in compiled code. - if (hasJit()) { + if (normalJit) { boolean inOsr = Main.isInOsrCode("run"); if (expectOsr && !inOsr) { throw new Error( @@ -184,4 +185,5 @@ public class Main { public static native boolean stopJit(); public static native boolean startJit(); public static native boolean hasJit(); + public static native int getJitThreshold(); } diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc index c9b789e169..4967834490 100644 --- a/test/common/runtime_state.cc +++ b/test/common/runtime_state.cc @@ -313,4 +313,9 @@ extern "C" JNIEXPORT void JNICALL Java_Main_startJit(JNIEnv*, jclass) { } } +extern "C" JNIEXPORT jint JNICALL Java_Main_getJitThreshold(JNIEnv*, jclass) { + jit::Jit* jit = Runtime::Current()->GetJit(); + return (jit != nullptr) ? jit->HotMethodThreshold() : 0; +} + } // namespace art |