< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page
rev 56206 : [mq]: 8226705-v2

@@ -1070,22 +1070,27 @@
           char *method_name = method->name_and_sig_as_C_string();
           lt.print("Installing method (%d) %s ",
                     task()->comp_level(), method_name);
         }
         // Allow the code to be executed
+        MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+        if (nm->make_in_use()) {
         method->set_code(method, nm);
+        }
       } else {
         LogTarget(Info, nmethod, install) lt;
         if (lt.is_enabled()) {
           ResourceMark rm;
           char *method_name = method->name_and_sig_as_C_string();
           lt.print("Installing osr method (%d) %s @ %d",
                     task()->comp_level(), method_name, entry_bci);
         }
+        MutexLocker ml(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+        if (nm->make_in_use()) {
         method->method_holder()->add_osr_nmethod(nm);
       }
-      nm->make_in_use();
+      }
     }
   }  // safepoints are allowed again
 
   if (nm != NULL) {
     // JVMTI -- compiled method notification (must be done outside lock)
< prev index next >