Skip to content

Commit 82c77ca

Browse files
author
Xin Liu
committed
8288926: make runtime/logging/DeoptStats.java more reliable
Reviewed-by: simonis, phh
1 parent d4de475 commit 82c77ca

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/hotspot/jtreg/runtime/logging/DeoptStats.java

+11-7
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
* @summary Verify that the Deoptimization statistics are printed to the VM/Compiler log file
2929
* @library /test/lib
3030
* @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow
31-
* -XX:-OmitStackTraceInFastThrow
3231
* -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation
3332
* -XX:-LogVMOutput -XX:LogFile=compilation.log DeoptStats
3433
* @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:-OmitStackTraceInFastThrow
35-
* -XX:-OmitStackTraceInFastThrow
3634
* -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation
3735
* -XX:+LogVMOutput -XX:LogFile=vmOutput.log DeoptStats
3836
* @run main/othervm DeoptStats compilation.log vmOutput.log
@@ -45,10 +43,16 @@ public class DeoptStats {
4543

4644
static class Value {
4745
int i;
46+
47+
public Value(int i) { this.i = i; }
4848
}
4949

5050
static int f(Value v) {
51-
return v.i;
51+
try {
52+
return v.i;
53+
} catch (NullPointerException npe) {
54+
return -1;
55+
}
5256
}
5357

5458
public static void verify(String[] logFiles) throws Exception {
@@ -64,12 +68,12 @@ public static void main(String[] args) throws Exception {
6468
if (args.length > 0) {
6569
verify(args);
6670
} else {
71+
Value zero = new Value(0);
6772
for (int i = 0; i < 20_000; i++) {
68-
try {
69-
f(null);
70-
}
71-
catch (NullPointerException npe) { }
73+
f(zero);
7274
}
75+
// trigger null_check
76+
f(null);
7377
}
7478
}
7579
}

0 commit comments

Comments
 (0)