RFR: Let nmethods be is_unloading() outside of safepoints
erik.osterlund at oracle.com
Mon Nov 12 22:44:33 UTC 2018
All current GCs perform code cache unloading in safepoints. Therefore,
nmethods that are alive but is_unloading() are never observed outside of
safepoints. With concurrent class unloading, nmethods that are alive but
is_unloading() will become observable outside of safepoints. This must
be handled appropriately.
In this patch I changed the nmethod/compiled method iterators to accept
parameters describing whether they should filter out not is_alive() or
is_unloading() methods. Since there is no obvious default (all
combinations are used depending on call site), you have to explicitly
set what iteration mode you want.
Other than that, I make sure that the sweeper stays away from
is_unloading() nmethods that are not yet is_unloaded(). To make the
interactions between the sweeper and concurrent GC threads safe, I had
to move down the store that sets the state to unloaded, and use a
release_store there, to make sure no accesses float below it at
compile-time. Once that store is observed, nmethods may be deleted.
In the IC miss handler, I also need to lazily clean stale IC caches due
to calling is_unloading nmethods using nmethod entry barriers.
More information about the hotspot-dev