提交 b6e19391 编写于 作者: T thartmann

8035328: closed/compiler/6595044/Main.java failed with timeout

Summary: Patch call sites of non-entrant methods to avoid re-resolving if method is still executed.
Reviewed-by: kvn
上级 df52a660
...@@ -1209,10 +1209,7 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread, ...@@ -1209,10 +1209,7 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
(!is_virtual && invoke_code == Bytecodes::_invokedynamic) || (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode"); ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
// We do not patch the call site if the caller nmethod has been made non-entrant. assert(caller_nm->is_alive(), "It should be alive");
if (!caller_nm->is_in_use()) {
return callee_method;
}
#ifndef PRODUCT #ifndef PRODUCT
// tracing/debugging/statistics // tracing/debugging/statistics
...@@ -1282,13 +1279,11 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread, ...@@ -1282,13 +1279,11 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread,
// Now that we are ready to patch if the Method* was redefined then // Now that we are ready to patch if the Method* was redefined then
// don't update call site and let the caller retry. // don't update call site and let the caller retry.
// Don't update call site if caller nmethod has been made non-entrant
// as it is a waste of time.
// Don't update call site if callee nmethod was unloaded or deoptimized. // Don't update call site if callee nmethod was unloaded or deoptimized.
// Don't update call site if callee nmethod was replaced by an other nmethod // Don't update call site if callee nmethod was replaced by an other nmethod
// which may happen when multiply alive nmethod (tiered compilation) // which may happen when multiply alive nmethod (tiered compilation)
// will be supported. // will be supported.
if (!callee_method->is_old() && caller_nm->is_in_use() && if (!callee_method->is_old() &&
(callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) { (callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) {
#ifdef ASSERT #ifdef ASSERT
// We must not try to patch to jump to an already unloaded method. // We must not try to patch to jump to an already unloaded method.
...@@ -1489,14 +1484,12 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) { ...@@ -1489,14 +1484,12 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) {
// out of scope. // out of scope.
JvmtiDynamicCodeEventCollector event_collector; JvmtiDynamicCodeEventCollector event_collector;
// Update inline cache to megamorphic. Skip update if caller has been // Update inline cache to megamorphic. Skip update if we are called from interpreted.
// made non-entrant or we are called from interpreted.
{ MutexLocker ml_patch (CompiledIC_lock); { MutexLocker ml_patch (CompiledIC_lock);
RegisterMap reg_map(thread, false); RegisterMap reg_map(thread, false);
frame caller_frame = thread->last_frame().sender(&reg_map); frame caller_frame = thread->last_frame().sender(&reg_map);
CodeBlob* cb = caller_frame.cb(); CodeBlob* cb = caller_frame.cb();
if (cb->is_nmethod() && ((nmethod*)cb)->is_in_use()) { if (cb->is_nmethod()) {
// Not a non-entrant nmethod, so find inline_cache
CompiledIC* inline_cache = CompiledIC_before(((nmethod*)cb), caller_frame.pc()); CompiledIC* inline_cache = CompiledIC_before(((nmethod*)cb), caller_frame.pc());
bool should_be_mono = false; bool should_be_mono = false;
if (inline_cache->is_optimized()) { if (inline_cache->is_optimized()) {
...@@ -1639,11 +1632,6 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) { ...@@ -1639,11 +1632,6 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) {
// resolve is only done once. // resolve is only done once.
MutexLocker ml(CompiledIC_lock); MutexLocker ml(CompiledIC_lock);
//
// We do not patch the call site if the nmethod has been made non-entrant
// as it is a waste of time
//
if (caller_nm->is_in_use()) {
if (is_static_call) { if (is_static_call) {
CompiledStaticCall* ssc= compiledStaticCall_at(call_addr); CompiledStaticCall* ssc= compiledStaticCall_at(call_addr);
ssc->set_to_clean(); ssc->set_to_clean();
...@@ -1653,7 +1641,6 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) { ...@@ -1653,7 +1641,6 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) {
inline_cache->set_to_clean(); inline_cache->set_to_clean();
} }
} }
}
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册