[9] RFR (S): 8141420: Compiler runtime entries don't hold Klass* from being GCed

Coleen Phillimore coleen.phillimore at oracle.com
Thu Mar 10 14:45:40 UTC 2016


In new_instance_C, why not put the holder at the top at line 220 and be 
done with it?  It's a nice cleanup of the logic though.

Otherwise, looks good.  Thank you for diagnosing this problem!


On 3/10/16 9:02 AM, Vladimir Ivanov wrote:
> 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-dev mailing list