changeset 57228:e71931b1c3b7

8235273: nmethodLocker not needed for COMPILED_METHOD_UNLOAD events Summary: remove unnecessary nmethodLocker Reviewed-by: dholmes, sspitsyn
author coleenp
date Wed, 04 Dec 2019 13:48:38 -0500
parents a9347576dbc7
children db5097a1ec61
files src/hotspot/share/code/nmethod.cpp src/hotspot/share/prims/jvmtiImpl.cpp src/hotspot/share/prims/jvmtiImpl.hpp
diffstat 3 files changed, 3 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/code/nmethod.cpp	Wed Dec 04 10:46:49 2019 -0800
+++ b/src/hotspot/share/code/nmethod.cpp	Wed Dec 04 13:48:38 2019 -0500
@@ -1622,8 +1622,7 @@
   if (_jmethod_id != NULL && JvmtiExport::should_post_compiled_method_unload()) {
     assert(!unload_reported(), "already unloaded");
     JvmtiDeferredEvent event =
-      JvmtiDeferredEvent::compiled_method_unload_event(this,
-          _jmethod_id, insts_begin());
+      JvmtiDeferredEvent::compiled_method_unload_event(_jmethod_id, insts_begin());
     MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
     JvmtiDeferredEventQueue::enqueue(event);
   }
--- a/src/hotspot/share/prims/jvmtiImpl.cpp	Wed Dec 04 10:46:49 2019 -0800
+++ b/src/hotspot/share/prims/jvmtiImpl.cpp	Wed Dec 04 13:48:38 2019 -0500
@@ -912,17 +912,10 @@
 }
 
 JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_unload_event(
-    nmethod* nm, jmethodID id, const void* code) {
+    jmethodID id, const void* code) {
   JvmtiDeferredEvent event = JvmtiDeferredEvent(TYPE_COMPILED_METHOD_UNLOAD);
-  event._event_data.compiled_method_unload.nm = nm;
   event._event_data.compiled_method_unload.method_id = id;
   event._event_data.compiled_method_unload.code_begin = code;
-  // Keep the nmethod alive until the ServiceThread can process
-  // this deferred event. This will keep the memory for the
-  // generated code from being reused too early. We pass
-  // zombie_ok == true here so that our nmethod that was just
-  // made into a zombie can be locked.
-  nmethodLocker::lock_nmethod(nm, true /* zombie_ok */);
   return event;
 }
 
@@ -959,12 +952,9 @@
       break;
     }
     case TYPE_COMPILED_METHOD_UNLOAD: {
-      nmethod* nm = _event_data.compiled_method_unload.nm;
       JvmtiExport::post_compiled_method_unload(
         _event_data.compiled_method_unload.method_id,
         _event_data.compiled_method_unload.code_begin);
-      // done with the deferred event so unlock the nmethod
-      nmethodLocker::unlock_nmethod(nm);
       break;
     }
     case TYPE_DYNAMIC_CODE_GENERATED: {
--- a/src/hotspot/share/prims/jvmtiImpl.hpp	Wed Dec 04 10:46:49 2019 -0800
+++ b/src/hotspot/share/prims/jvmtiImpl.hpp	Wed Dec 04 13:48:38 2019 -0500
@@ -448,7 +448,6 @@
   union {
     nmethod* compiled_method_load;
     struct {
-      nmethod* nm;
       jmethodID method_id;
       const void* code_begin;
     } compiled_method_unload;
@@ -471,7 +470,7 @@
   // Factory methods
   static JvmtiDeferredEvent compiled_method_load_event(nmethod* nm)
     NOT_JVMTI_RETURN_(JvmtiDeferredEvent());
-  static JvmtiDeferredEvent compiled_method_unload_event(nmethod* nm,
+  static JvmtiDeferredEvent compiled_method_unload_event(
       jmethodID id, const void* code) NOT_JVMTI_RETURN_(JvmtiDeferredEvent());
   static JvmtiDeferredEvent dynamic_code_generated_event(
       const char* name, const void* begin, const void* end)