src/hotspot/share/runtime/sharedRuntime.cpp
changeset 58226 408c445d04e8
parent 58084 cddef3bde924
child 58358 d658f4379c63
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Sep 19 09:50:11 2019 +0200
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Sep 19 10:52:22 2019 +0200
@@ -2902,7 +2902,12 @@
       nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type, critical_entry);
 
       if (nm != NULL) {
-        method->set_code(method, nm);
+        {
+          MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+          if (nm->make_in_use()) {
+            method->set_code(method, nm);
+          }
+        }
 
         DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
         if (directive->PrintAssemblyOption) {