8221456: nmethod::make_unloaded() clears _method member too early
authorpliden
Wed, 27 Mar 2019 18:30:45 +0100
changeset 54311 3fedbfdb25b6
parent 54310 646c54d5989b
child 54312 0223b7b8a1c5
8221456: nmethod::make_unloaded() clears _method member too early Reviewed-by: eosterlund, thartmann
src/hotspot/share/code/nmethod.cpp
--- a/src/hotspot/share/code/nmethod.cpp	Wed Mar 27 08:38:05 2019 -0700
+++ b/src/hotspot/share/code/nmethod.cpp	Wed Mar 27 18:30:45 2019 +0100
@@ -1089,7 +1089,6 @@
     if (_method->code() == this) {
       _method->clear_code(); // Break a cycle
     }
-    _method = NULL;            // Clear the method of this dead nmethod
   }
 
   // Make the class unloaded - i.e., change state and notify sweeper
@@ -1109,6 +1108,9 @@
     Universe::heap()->unregister_nmethod(this);
   }
 
+  // Clear the method of this dead nmethod
+  set_method(NULL);
+
   // Log the unloading.
   log_state_change();