src/hotspot/share/gc/z/zBarrierSetNMethod.cpp
changeset 53282 cb7fff9105a8
parent 52939 9a8585f60c32
child 53894 bf1133e7dfba
--- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Fri Jan 11 11:02:00 2019 +0100
+++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Fri Jan 11 13:15:37 2019 +0100
@@ -42,6 +42,11 @@
   }
 
   if (nm->is_unloading()) {
+    // 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 */);
+
     // We can end up calling nmethods that are unloading
     // since we clear compiled ICs lazily. Returning false
     // will re-resovle the call and update the compiled IC.