src/hotspot/share/code/icBuffer.cpp
changeset 52384 d6dc479bcdd3
parent 49393 93fe2fc5c093
child 52857 7e268f863ff0
--- a/src/hotspot/share/code/icBuffer.cpp	Fri Nov 02 07:58:22 2018 +0100
+++ b/src/hotspot/share/code/icBuffer.cpp	Thu Nov 01 14:57:26 2018 +0100
@@ -170,8 +170,9 @@
 
 
 void InlineCacheBuffer::create_transition_stub(CompiledIC *ic, void* cached_value, address entry) {
+  MutexLockerEx ml(CompiledIC_lock->owned_by_self() ? NULL : CompiledIC_lock);
   assert(!SafepointSynchronize::is_at_safepoint(), "should not be called during a safepoint");
-  assert (CompiledIC_lock->is_locked(), "");
+  assert(CompiledICLocker::is_safe(ic->instruction_address()), "mt unsafe call");
   if (TraceICBuffer) {
     tty->print_cr("  create transition stub for " INTPTR_FORMAT " destination " INTPTR_FORMAT " cached value " INTPTR_FORMAT,
                   p2i(ic->instruction_address()), p2i(entry), p2i(cached_value));
@@ -224,7 +225,9 @@
 // not safe to free them until them since they might be visible to
 // another thread.
 void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
-  MutexLockerEx mex(InlineCacheBuffer_lock);
+  MutexLockerEx mex1((CompiledIC_lock->owned_by_self() ||
+                      SafepointSynchronize::is_at_safepoint()) ? NULL : CompiledIC_lock);
+  MutexLockerEx mex2(InlineCacheBuffer_lock);
   icholder->set_next(_pending_released);
   _pending_released = icholder;
   _pending_count++;