提交 7ecf2ea5 编写于 作者: T twisti

6921799: JSR 292 call sites should not be fixed-up

Summary: MethodHandle invoke call sites should not be fixed-up by SharedRuntime::fixup_callers_callsite as c2i/i2c adapters are used to implement MethodHandle actions.
Reviewed-by: kvn, never
上级 819971ed
...@@ -1361,7 +1361,7 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) { ...@@ -1361,7 +1361,7 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) {
// We are calling the interpreter via a c2i. Normally this would mean that // We are calling the interpreter via a c2i. Normally this would mean that
// we were called by a compiled method. However we could have lost a race // we were called by a compiled method. However we could have lost a race
// where we went int -> i2c -> c2i and so the caller could in fact be // where we went int -> i2c -> c2i and so the caller could in fact be
// interpreted. If the caller is compiled we attampt to patch the caller // interpreted. If the caller is compiled we attempt to patch the caller
// so he no longer calls into the interpreter. // so he no longer calls into the interpreter.
IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, address caller_pc)) IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, address caller_pc))
methodOop moop(method); methodOop moop(method);
...@@ -1377,10 +1377,19 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, addr ...@@ -1377,10 +1377,19 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, addr
// we did we'd leap into space because the callsite needs to use // we did we'd leap into space because the callsite needs to use
// "to interpreter" stub in order to load up the methodOop. Don't // "to interpreter" stub in order to load up the methodOop. Don't
// ask me how I know this... // ask me how I know this...
//
CodeBlob* cb = CodeCache::find_blob(caller_pc); CodeBlob* cb = CodeCache::find_blob(caller_pc);
if ( !cb->is_nmethod() || entry_point == moop->get_c2i_entry()) { if (!cb->is_nmethod() || entry_point == moop->get_c2i_entry()) {
return;
}
// The check above makes sure this is a nmethod.
nmethod* nm = cb->as_nmethod_or_null();
assert(nm, "must be");
// Don't fixup MethodHandle call sites as c2i/i2c adapters are used
// to implement MethodHandle actions.
if (nm->is_method_handle_return(caller_pc)) {
return; return;
} }
...@@ -1395,7 +1404,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, addr ...@@ -1395,7 +1404,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(methodOopDesc* method, addr
if (moop->code() == NULL) return; if (moop->code() == NULL) return;
if (((nmethod*)cb)->is_in_use()) { if (nm->is_in_use()) {
// Expect to find a native call there (unless it was no-inline cache vtable dispatch) // Expect to find a native call there (unless it was no-inline cache vtable dispatch)
MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag); MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册