Skip to content

Conversation

@dean-long
Copy link
Member

@dean-long dean-long commented Sep 2, 2025

At one time, JSR292 support needed special logic to save and restore SP across method handle instrinsic calls, but that is no longer the case. The only platform that still does the save/restore is arm32, which is no longer necessary. The save/restore can be removed along with related APIs and logic. Note that the arm32 port is largely based on the x86 port, which stopped doing the save/restore in jdk9 (JDK-8068945).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8366461: Remove obsolete method handle invoke logic (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27059/head:pull/27059
$ git checkout pull/27059

Update a local copy of the PR:
$ git checkout pull/27059
$ git pull https://git.openjdk.org/jdk.git pull/27059/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27059

View PR using the GUI difftool:
$ git pr show -t 27059

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27059.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 2, 2025

👋 Welcome back dlong! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 2, 2025

@dean-long This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8366461: Remove obsolete method handle invoke logic

Reviewed-by: vlivanov, mhaessig

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 116 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Sep 2, 2025

@dean-long The following labels will be automatically applied to this pull request:

  • graal
  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added graal graal-dev@openjdk.org serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review labels Sep 2, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 2, 2025

@dean-long dean-long marked this pull request as draft September 2, 2025 20:06
@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 2, 2025
@dean-long
Copy link
Member Author

/label hotspot-compiler hotspot-runtime

@openjdk openjdk bot added hotspot-compiler hotspot-compiler-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org labels Sep 2, 2025
@openjdk
Copy link

openjdk bot commented Sep 2, 2025

@dean-long
The hotspot-compiler label was successfully added.

The hotspot-runtime label was successfully added.

@dean-long dean-long marked this pull request as ready for review September 2, 2025 20:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 2, 2025
Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Nice cleanup! Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 2, 2025
@dean-long
Copy link
Member Author

Thanks @iwanowww !

Copy link
Contributor

@mhaessig mhaessig left a comment

Choose a reason for hiding this comment

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

Thank you for cleaning this up, @dean-long. I just have a drive-by comment.

@dean-long
Copy link
Member Author

I need one more review for this.

Copy link
Contributor

@mhaessig mhaessig left a comment

Choose a reason for hiding this comment

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

Thank you again for this extensive cleanup. I did another, more thorough, pass and have a few questions and suggestions.

Comment on lines 359 to 365
nmethod* sender_nm = (_cb == nullptr) ? nullptr : _cb->as_nmethod_or_null();
if (sender_nm != nullptr) {
// If the sender PC is a deoptimization point, get the original
// PC. For MethodHandle call site the unextended_sp is stored in
// saved_fp.
if (sender_nm->is_deopt_mh_entry(_pc)) {
DEBUG_ONLY(verify_deopt_mh_original_pc(sender_nm, _fp));
_unextended_sp = _fp;
}
else if (sender_nm->is_deopt_entry(_pc)) {
// If the sender PC is a deoptimization point, get the original PC.
if (sender_nm->is_deopt_entry(_pc)) {
DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp));
}
else if (sender_nm->is_method_handle_return(_pc)) {
_unextended_sp = _fp;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this could be NOT_PRODUCT and the method const if I did not miss any side effects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, there is no adjustment anymore on any platform. I think this function and verify_deopt_original_pc only ever existed to support code that is now getting removed. So I could change the name to verify_unextended_sp() and make it const, but it might make more sense to remove both this function and verify_deopt_original_pc now. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather keep this code as a debug only sanity check, but I would refactor it into a single function. Then the question remains what to do with the SA code, that still does nothing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would rather keep this code as a debug only sanity check, but I would refactor it into a single function. Then the question remains what to do with the SA code, that still does nothing.

I think we can do even better and get rid of adjust_unextended_sp, moving the debug check into get_deopt_original_pc. This moves the SA changes into shared code, and fixes the anomaly that s390 never called adjust_unextended_sp and thus never called the debug code to do the sanity check.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is indeed even better. Nice.

@openjdk openjdk bot removed hotspot-runtime hotspot-runtime-dev@openjdk.org hotspot-compiler hotspot-compiler-dev@openjdk.org labels Sep 24, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Sep 24, 2025
Copy link
Contributor

@mhaessig mhaessig left a comment

Choose a reason for hiding this comment

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

I have one last nit below. Otherwise, this looks good to me.

Comment on lines 359 to 365
nmethod* sender_nm = (_cb == nullptr) ? nullptr : _cb->as_nmethod_or_null();
if (sender_nm != nullptr) {
// If the sender PC is a deoptimization point, get the original
// PC. For MethodHandle call site the unextended_sp is stored in
// saved_fp.
if (sender_nm->is_deopt_mh_entry(_pc)) {
DEBUG_ONLY(verify_deopt_mh_original_pc(sender_nm, _fp));
_unextended_sp = _fp;
}
else if (sender_nm->is_deopt_entry(_pc)) {
// If the sender PC is a deoptimization point, get the original PC.
if (sender_nm->is_deopt_entry(_pc)) {
DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp));
}
else if (sender_nm->is_method_handle_return(_pc)) {
_unextended_sp = _fp;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

That is indeed even better. Nice.

…ame.java

Co-authored-by: Manuel Hässig <manuel@haessig.org>
@dean-long
Copy link
Member Author

Thanks @mhaessig for the review.

@dean-long
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 26, 2025

@dean-long This pull request has not yet been marked as ready for integration.

@dean-long dean-long requested a review from iwanowww September 26, 2025 20:40
@dean-long
Copy link
Member Author

@iwanowww , I think I need you to re-review the final version.

Copy link
Contributor

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Still looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 2, 2025
@dean-long
Copy link
Member Author

Thanks Vladimir for the re-review.

@dean-long
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 2, 2025

Going to push as commit da7121a.
Since your change was applied there have been 117 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 2, 2025
@openjdk openjdk bot closed this Oct 2, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 2, 2025
@openjdk
Copy link

openjdk bot commented Oct 2, 2025

@dean-long Pushed as commit da7121a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

graal graal-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants