Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8294538: missing is_unloading() check in SharedRuntime::fixup_callers…
…_callsite()

Reviewed-by: eosterlund
Backport-of: b5efa2afe268e3171f54d8488ef69bf67059bd7f
  • Loading branch information
TobiHartmann committed Nov 23, 2022
1 parent 6c7378a commit d1268e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/hotspot/share/oops/method.cpp
Expand Up @@ -1270,15 +1270,6 @@ void Method::restore_unshareable_info(TRAPS) {
assert(is_method() && is_valid_method(this), "ensure C++ vtable is restored");
}

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.

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/oops/method.hpp
Expand Up @@ -145,7 +145,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
Expand Down
13 changes: 10 additions & 3 deletions src/hotspot/share/runtime/sharedRuntime.cpp
Expand Up @@ -1992,8 +1992,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
Expand All @@ -2004,8 +2002,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;
}

Expand Down Expand Up @@ -2063,6 +2069,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);
}
Expand Down

1 comment on commit d1268e9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.