RFR (S): 8141420: Compiler runtime entries don't hold Klass* from being GCed
christian.thalinger at oracle.com
Thu Mar 10 17:11:58 UTC 2016
> On Mar 10, 2016, at 4:02 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> 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  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.
> Best regards,
> Vladimir Ivanov
>  https://bugs.openjdk.java.net/browse/JDK-8141420
More information about the hotspot-dev