8212681: Refactor IC locking to use a fine grained CompiledICLocker

Reviewed-by: coleenp, rehn, kvn
This commit is contained in:
Erik Österlund 2018-11-01 14:57:26 +01:00
parent 54d4acf73f
commit 97d3dc7902
23 changed files with 211 additions and 103 deletions

View file

@ -1351,7 +1351,7 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
// grab lock, check for deoptimization and potentially patch caller
{
MutexLocker ml_patch(CompiledIC_lock);
CompiledICLocker ml(caller_nm);
// Lock blocks for safepoint during which both nmethods can change state.
@ -1382,7 +1382,7 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
}
}
} // unlock CompiledIC_lock
} // unlock CompiledICLocker
return callee_method;
}
@ -1585,11 +1585,13 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
JvmtiDynamicCodeEventCollector event_collector;
// Update inline cache to megamorphic. Skip update if we are called from interpreted.
{ MutexLocker ml_patch (CompiledIC_lock);
{
RegisterMap reg_map(thread, false);
frame caller_frame = thread->last_frame().sender(&reg_map);
CodeBlob* cb = caller_frame.cb();
CompiledMethod* caller_nm = cb->as_compiled_method_or_null();
CompiledICLocker ml(caller_nm);
if (cb->is_compiled()) {
CompiledIC* inline_cache = CompiledIC_before(((CompiledMethod*)cb), caller_frame.pc());
bool should_be_mono = false;
@ -1647,7 +1649,7 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
} else {
fatal("Unimplemented");
}
} // Release CompiledIC_lock
} // Release CompiledICLocker
return callee_method;
}
@ -1731,8 +1733,7 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) {
// to a wrong method). It should not be performance critical, since the
// resolve is only done once.
bool is_nmethod = caller_nm->is_nmethod();
MutexLocker ml(CompiledIC_lock);
CompiledICLocker ml(caller_nm);
if (is_static_call) {
CompiledStaticCall* ssc = caller_nm->compiledStaticCall_at(call_addr);
ssc->set_to_clean();