--- a/src/hotspot/share/gc/z/zNMethodTable.cpp Fri Jan 11 11:02:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zNMethodTable.cpp Fri Jan 11 13:15:37 2019 +0100
@@ -611,15 +611,20 @@
return;
}
+ ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm));
+
if (nm->is_unloading()) {
// Unlinking of the dependencies must happen before the
// handshake separating unlink and purge.
nm->flush_dependencies(false /* delete_immediately */);
+
+ // We don't need to take the lock when unlinking nmethods from
+ // the Method, because it is only concurrently unlinked by
+ // the entry barrier, which acquires the per nmethod lock.
+ nm->unlink_from_method(false /* acquire_lock */);
return;
}
- ZLocker<ZReentrantLock> locker(ZNMethodTable::lock_for_nmethod(nm));
-
// Heal oops and disarm
ZNMethodOopClosure cl;
ZNMethodTable::entry_oops_do(entry, &cl);