Skip to content
Permalink
Browse files

8235273: nmethodLocker not needed for COMPILED_METHOD_UNLOAD events

Remove unnecessary nmethodLocker

Reviewed-by: dholmes, sspitsyn
  • Loading branch information
Coleen Phillimore
Coleen Phillimore committed Dec 4, 2019
1 parent a445b66 commit 5845912fdbffd09a8d8dd0e3f766137a4939e34e
@@ -1622,8 +1622,7 @@ void nmethod::post_compiled_method_unload() {
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);
}
@@ -912,17 +912,10 @@ JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
}

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 @@ void JvmtiDeferredEvent::post() {
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: {
@@ -448,7 +448,6 @@ class JvmtiDeferredEvent {
union {
nmethod* compiled_method_load;
struct {
nmethod* nm;
jmethodID method_id;
const void* code_begin;
} compiled_method_unload;
@@ -471,7 +470,7 @@ class JvmtiDeferredEvent {
// 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)

0 comments on commit 5845912

Please sign in to comment.
You can’t perform that action at this time.