8294538: missing is_unloading() check in SharedRuntime::fixup_callers_callsite()

Reviewed-by: kvn, thartmann, eosterlund
This commit is contained in:
Dean Long 2022-10-22 02:11:55 +00:00
parent 6acbdb59da
commit b5efa2afe2
3 changed files with 10 additions and 13 deletions

View File

@ -1266,15 +1266,6 @@ address Method::make_adapters(const methodHandle& mh, TRAPS) {
return adapter->get_c2i_entry();
}
address Method::from_compiled_entry_no_trampoline() const {
CompiledMethod *code = Atomic::load_acquire(&_code);
if (code) {
return code->verified_entry_point();
} else {
return adapter()->get_c2i_entry();
}
}
// The verified_code_entry() must be called when a invoke is resolved
// on this method.

View File

@ -147,7 +147,6 @@ class Method : public Metadata {
static address make_adapters(const methodHandle& mh, TRAPS);
address from_compiled_entry() const;
address from_compiled_entry_no_trampoline() const;
address from_interpreted_entry() const;
// access flag

View File

@ -2097,8 +2097,6 @@ JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
AARCH64_PORT_ONLY(assert(pauth_ptr_is_raw(caller_pc), "should be raw"));
address entry_point = moop->from_compiled_entry_no_trampoline();
// It's possible that deoptimization can occur at a call site which hasn't
// been resolved yet, in which case this function will be called from
// an nmethod that has been patched for deopt and we can ignore the
@ -2109,8 +2107,16 @@ JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
// "to interpreter" stub in order to load up the Method*. Don't
// ask me how I know this...
// Result from nmethod::is_unloading is not stable across safepoints.
NoSafepointVerifier nsv;
CompiledMethod* callee = moop->code();
if (callee == NULL) {
return;
}
CodeBlob* cb = CodeCache::find_blob(caller_pc);
if (cb == NULL || !cb->is_compiled() || entry_point == moop->get_c2i_entry()) {
if (cb == NULL || !cb->is_compiled() || callee->is_unloading()) {
return;
}
@ -2168,6 +2174,7 @@ JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
}
}
address destination = call->destination();
address entry_point = callee->verified_entry_point();
if (should_fixup_call_destination(destination, entry_point, caller_pc, moop, cb)) {
call->set_destination_mt_safe(entry_point);
}