diff --git a/test/hotspot/jtreg/runtime/logging/DeoptStats.java b/test/hotspot/jtreg/runtime/logging/DeoptStats.java index b5d3584e160..1da0fa7d2a9 100644 --- a/test/hotspot/jtreg/runtime/logging/DeoptStats.java +++ b/test/hotspot/jtreg/runtime/logging/DeoptStats.java @@ -28,11 +28,9 @@ * @summary Verify that the Deoptimization statistics are printed to the VM/Compiler log file * @library /test/lib * @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow - * -XX:-OmitStackTraceInFastThrow * -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation * -XX:-LogVMOutput -XX:LogFile=compilation.log DeoptStats * @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow - * -XX:-OmitStackTraceInFastThrow * -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation * -XX:+LogVMOutput -XX:LogFile=vmOutput.log DeoptStats * @run main/othervm DeoptStats compilation.log vmOutput.log @@ -45,10 +43,16 @@ public class DeoptStats { static class Value { int i; + + public Value(int i) { this.i = i; } } static int f(Value v) { - return v.i; + try { + return v.i; + } catch (NullPointerException npe) { + return -1; + } } public static void verify(String[] logFiles) throws Exception { @@ -64,12 +68,12 @@ public class DeoptStats { if (args.length > 0) { verify(args); } else { + Value zero = new Value(0); for (int i = 0; i < 20_000; i++) { - try { - f(null); - } - catch (NullPointerException npe) { } + f(zero); } + // trigger null_check + f(null); } } }