src/hotspot/share/code/nmethod.cpp
changeset 54901 631d51796dbf
parent 54839 e9db10a375d9
child 54960 e46fe26d7f77
--- a/src/hotspot/share/code/nmethod.cpp	Thu May 16 16:42:14 2019 +0200
+++ b/src/hotspot/share/code/nmethod.cpp	Thu May 16 11:07:09 2019 -0400
@@ -1143,7 +1143,6 @@
     MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
                      Mutex::_no_safepoint_check_flag);
     Universe::heap()->unregister_nmethod(this);
-    CodeCache::unregister_old_nmethod(this);
   }
 
   // Clear the method of this dead nmethod
@@ -1336,7 +1335,6 @@
       MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
       if (nmethod_needs_unregister) {
         Universe::heap()->unregister_nmethod(this);
-        CodeCache::unregister_old_nmethod(this);
       }
       flush_dependencies(/*delete_immediately*/true);
     }
@@ -1415,6 +1413,7 @@
   }
 
   Universe::heap()->flush_nmethod(this);
+  CodeCache::unregister_old_nmethod(this);
 
   CodeBlob::flush();
   CodeCache::free(this);