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()

Reviewed-by: kvn, thartmann, eosterlund
  • Loading branch information
dean-long committed Oct 22, 2022
1 parent 6acbdb5 commit b5efa2a
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 @@ -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.

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

Expand Down Expand Up @@ -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);
}
Expand Down

3 comments on commit b5efa2a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on b5efa2a Jan 3, 2023

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on b5efa2a Jan 3, 2023

Choose a reason for hiding this comment

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

@GoeLin Could not automatically backport b5efa2af to openjdk/jdk17u-dev due to conflicts in the following files:

  • src/hotspot/share/oops/method.cpp
  • src/hotspot/share/runtime/sharedRuntime.cpp

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b GoeLin-backport-b5efa2af

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk b5efa2afe268e3171f54d8488ef69bf67059bd7f

# Backport the commit
$ git cherry-pick --no-commit b5efa2afe268e3171f54d8488ef69bf67059bd7f
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport b5efa2afe268e3171f54d8488ef69bf67059bd7f'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport b5efa2afe268e3171f54d8488ef69bf67059bd7f.

Please sign in to comment.