// Test that deoptimization preserves objects that are singletons. publicstaticint $noinline$foo(Main arg) {
Main m = new Main();
arg.returnValue(); return m.field;
}
// Test that doing OSR after deoptimization works. publicstaticint $noinline$foo2(Main arg, boolean osr) {
Main m = new Main();
arg.returnValue(); if (osr) { while (!isInOsrCode("$noinline$foo2")) {}
} return m.field;
}
publicstaticvoid main(String[] args) throws Throwable {
System.loadLibrary(args[0]); if (isDebuggable()) { // We do not deoptimize with inline caches when the app is debuggable, so just don't run the // test. return;
}
test1();
test2();
}
publicstaticvoid test1() {
ensureJitBaselineCompiled(Main.class, "$noinline$foo"); // Surround the call with GCs to increase chances we execute $noinline$foo // while the GC isn't marking. This makes sure the inline cache is populated.
Runtime.getRuntime().gc();
assertEquals(42, $noinline$foo(new Main()));
Runtime.getRuntime().gc();
publicstaticvoid test2() {
ensureJitBaselineCompiled(Main.class, "$noinline$foo2"); // Surround the call with GCs to increase chances we execute $noinline$foo // while the GC isn't marking. This makes sure the inline cache is populated.
Runtime.getRuntime().gc();
assertEquals(42, $noinline$foo2(new Main(), false));
Runtime.getRuntime().gc();
// Define a subclass with another implementation of returnValue to deoptimize $noinline$foo and // $noinline$foo2. class SubMain extends Main { public String returnValue() { return"SubMain";
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.