serviceability/sa/TestObjectMonitorIterate.java fails in the loom repo:
stderr: [Exception in thread "main" java.lang.NullPointerException: Cannot invoke "sun.jvm.hotspot.oops.Oop.getKlass()" because "<local5>" is null
at TestObjectMonitorIterate.test(TestObjectMonitorIterate.java:63)
at TestObjectMonitorIterate.main(TestObjectMonitorIterate.java:97)
The code in question is:
while (itr.hasNext()) {
ObjectMonitor mon = (ObjectMonitor)itr.next();
Oop oop = heap.newOop(mon.object());
System.out.println("Monitor found: " + oop.getKlass().getName().asString());
}
So it looks like it found an ObjectMonitor, but the Object for the monitor was null for some reason.
This failure does not happen when no VM args are specified. It does happen with:
-Xcomp -XX:+CreateCoredumpOnCrash -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:+TieredCompilation
It also happens with just -Xcomp.