RFR: 8215754: ZGC: nmethod is not unlinked from Method before rendezvous handshake

Nils Eliasson nils.eliasson at oracle.com
Fri Jan 11 12:59:23 UTC 2019


Looks great!

// Nils

On 2019-01-09 16:51, Erik Österlund wrote:
> Hi,
>
> During concurrent class unloading in ZGC, the nmethod unloading goes 
> through 3 phases:
>
> 1) Unlink all references to nmethods
> 2) Rendezvous handshake, to make sure all JavaThreads are in the new 
> epoch where unlinking is done
> 3) Purge nmethods (by making them unloaded).
>
> However, we unfortunately unliked the code from the Method to the 
> nmethod during #3 inside of the nmethod entry barrier instead of #1, 
> causing JavaThreads to still observe these nmethods during phase #3, 
> racing with make_unloaded(), and causing crashes in the nmethod entry 
> barrier.
>
> The fix for this is to unlink the nmethod from the method during the 
> first phase. I additionally eagerly unlink it in the nmethod barrier, 
> to allow calls into unloading nmethods to not get stuck until the GC 
> comes around to do it.
>
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8215754
>
> Webrev:
> http://cr.openjdk.java.net/~eosterlund/8215754/webrev.00/
>
> Thanks,
> /Erik


More information about the hotspot-gc-dev mailing list