< prev index next >

src/hotspot/share/code/nmethod.cpp

Print this page
rev 54838 : [mq]: 8221734-v2
rev 54839 : [mq]: 8221734-v3

@@ -1119,11 +1119,13 @@
 
   // If _method is already NULL the Method* is about to be unloaded,
   // so we don't have to break the cycle. Note that it is possible to
   // have the Method* live here, in case we unload the nmethod because
   // it is pointing to some oop (other than the Method*) being unloaded.
-  Method::unlink_code(_method, this); // Break a cycle
+  if (_method != NULL) {
+    _method->unlink_code(this);
+  }
 
   // Make the class unloaded - i.e., change state and notify sweeper
   assert(SafepointSynchronize::is_at_safepoint() || Thread::current()->is_ConcurrentGC_thread(),
          "must be at safepoint");
 

@@ -1202,17 +1204,13 @@
     print_on(tty, state_msg);
   }
 }
 
 void nmethod::unlink_from_method() {
-  // We need to check if both the _code and _from_compiled_code_entry_point
-  // refer to this nmethod because there is a race in setting these two fields
-  // in Method* as seen in bugid 4947125.
-  // If the vep() points to the zombie nmethod, the memory for the nmethod
-  // could be flushed and the compiler and vtable stubs could still call
-  // through it.
-  Method::unlink_code(method(), this);
+  if (method() != NULL) {
+    method()->unlink_code();
+  }
 }
 
 /**
  * Common functionality for both make_not_entrant and make_zombie
  */
< prev index next >