--- old/src/hotspot/share/oops/method.cpp 2019-05-03 10:53:53.329310061 +0200 +++ new/src/hotspot/share/oops/method.cpp 2019-05-03 10:53:52.864294253 +0200 @@ -101,7 +101,7 @@ // Fix and bury in Method* set_interpreter_entry(NULL); // sets i2i entry and from_int set_adapter_entry(NULL); - Method::unlink_code(this); + Method::clear_code(); // from_c/from_i get set to c2i/i2i if (access_flags.is_native()) { clear_native_function(); @@ -932,7 +932,7 @@ } // Revert to using the interpreter and clear out the nmethod -void Method::locked_unlink_code() { +void Method::clear_code() { // this may be NULL if c2i adapters have not been made yet // Only should happen at allocate time. if (adapter() == NULL) { @@ -947,19 +947,20 @@ } void Method::unlink_code(Method *method, CompiledMethod *compare) { - if (method != NULL) { - MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); - if (method->code() != compare && method->from_compiled_entry() != compare->verified_entry_point()) { - return; - } - method->locked_unlink_code(); + if (method == NULL) { + return; + } + MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); + if (method->code() == compare || + method->from_compiled_entry() == compare->verified_entry_point()) { + method->clear_code(); } } void Method::unlink_code(Method *method) { if (method != NULL) { MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); - method->locked_unlink_code(); + method->clear_code(); } } @@ -1182,7 +1183,7 @@ // Install compiled code. Instantly it can execute. void Method::set_code(const methodHandle& mh, CompiledMethod *code) { - MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag); + MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); assert( code, "use clear_code to remove code" ); assert( mh->check_code(), "" );