[9] RFR (S): 8141420: Compiler runtime entries don't hold Klass* from being GCed
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Thu Mar 10 14:02:36 UTC 2016
http://cr.openjdk.java.net/~vlivanov/8141420/webrev.01/
https://bugs.openjdk.java.net/browse/JDK-8141420
Though compiler runtime entries use raw Klass*, they don't ensure the
classes can't be unloaded. It causes rare crashes when Full GC and class
unloading happens when freshly loaded class is being constructed and the
only live reference to it is the Klass* passed into the runtime call.
There are KlassHandles/instanceKlassHandles, but they don't do anything
after PermGen was removed.
The fix is to add mirror handles to keep classes alive across safepoints
during the runtime calls. FTR handles aren't needed for primitive
arrays.
I chose the conservative fix, since I plan to backport it into 8u. Filed
JDK-8141420 [1] to refactor the code to use mirrors instead. It should
simplify the logic to track class liveness.
No regression test provided, since I wasn't able to write one w/o
instrumenting the JVM.
Testing: manual (instrumented build which triggers class unloading from
runtime entries), JPRT.
Thanks!
Best regards,
Vladimir Ivanov
[1] https://bugs.openjdk.java.net/browse/JDK-8141420
More information about the hotspot-compiler-dev
mailing list