Skip to content

Commit

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

Backport-of: b5efa2afe268e3171f54d8488ef69bf67059bd7f
  • Loading branch information
GoeLin committed Jan 4, 2023
1 parent 6469c30 commit 013709f
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 @@ -1245,15 +1245,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 @@ -138,7 +138,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 @@ -1946,8 +1946,6 @@ bool SharedRuntime::should_fixup_call_destination(address destination, address e
JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address caller_pc))
Method* moop(method);

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 @@ -1958,8 +1956,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 @@ -2007,6 +2013,7 @@ JRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
return;
}
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 013709f

@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.