8219724: ZGC: Make inline cache cleaning more robust
authoreosterlund
Thu, 26 Sep 2019 10:00:07 +0000
changeset 58353 146bb7afdcf4
parent 58352 3a5f417e68a1
child 58354 e6b5ec45ab9e
8219724: ZGC: Make inline cache cleaning more robust Reviewed-by: pliden
src/hotspot/share/gc/z/zNMethod.cpp
--- a/src/hotspot/share/gc/z/zNMethod.cpp	Wed Sep 25 09:15:43 2019 +0200
+++ b/src/hotspot/share/gc/z/zNMethod.cpp	Thu Sep 26 10:00:07 2019 +0000
@@ -294,13 +294,14 @@
       return;
     }
 
-    ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
-
     if (nm->is_unloading()) {
+      ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
       unlink(nm);
       return;
     }
 
+    ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
+
     // Heal oops and disarm
     ZNMethodOopClosure cl;
     ZNMethod::nmethod_oops_do(nm, &cl);