-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8330388: Remove invokedynamic cache index encoding #18819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back matsaave! A progress list of the required criteria for merging this PR into |
|
@matias9927 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: 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 78 new commits pushed to the
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 |
|
@matias9927 The following labels will be automatically applied to this pull request:
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. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SA changes look good.
| // process the BSM | ||
| int pool_index = indy_info->constant_pool_index(); | ||
| BootstrapInfo bootstrap_specifier(cp, pool_index, index); | ||
| BootstrapInfo bootstrap_specifier(cp, pool_index, indy_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just change the incoming parameter name to index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indy_index is used frequently even in functions that are only used in the context of invokedynamic. I think it helps with clarity.
| static const int CPCACHE_INDEX_MANGLE_VALUE = 1000000; | ||
|
|
||
| // This function is used to encode an invokedynamic index to differentiate it from a | ||
| // constant pool index. It assumes it is being called with a index that is less than 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last sentence is no longer valid, thanks for catching this!
| return true; | ||
| } else if (indy_entry->resolution_failed()) { | ||
| int encoded_index = ResolutionErrorTable::encode_indy_index(ConstantPool::encode_invokedynamic_index(_indy_index)); | ||
| int encoded_index = ResolutionErrorTable::encode_indy_index(_indy_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an improvement, from two levels of encoding to only one!
|
Did you consider minimizing changes by leaving decode_invokedynamic_index/encode_invokedynamic_index calls in place, but having the implementations not change the value? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dougxc should check JVMCI changes.
| } else { | ||
| which = rawIndex; | ||
| } | ||
| int which = rawIndex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could get rid of that intermediate variable now and just use rawIndex below.
Thanks for the heads up. I've asked @matias9927 to double check these changes against libgraal which should address any concerns about how this change impacts Graal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To borrow @shipilev's comment from a different PR, Good Riddance!
The intention from the start was to remove the encode/decode methods because they have been made unnecessary thanks to the changes mentioned in the description. As the author of the previously mentioned changes that overhauled the cpcache, this change should have been included in one of those PRs, but I must have forgotten! Leaving the calls in even if they did nothing would just make the code confusing and might become a red herring if other issues in the area come up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still good!
|
Thanks for the reviews @dean-long @gilles-duboscq @coleenp and @plummercj! |
|
Going to push as commit 383fe6e.
Your commit was automatically rebased without conflicts. |
|
@matias9927 Pushed as commit 383fe6e. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Before JDK-8307190, JDK-8309673, and JDK-8301995, invokedynamic operands needed to be rewritten to encoded values to better distinguish indy entries from other cp cache entries. The above changes now distinguish between entries with
to_cp_index()using the bytecode, which is now propagated by the callers.The encoding flips the bits of the index so the encoded index is always negative, leading to access errors if there is no matching decode call. These calls are removed with some methods adjusted to distinguish between indices with the bytecode. Verified with tier 1-5 tests. The changes show no issues when tested against libgraal.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18819/head:pull/18819$ git checkout pull/18819Update a local copy of the PR:
$ git checkout pull/18819$ git pull https://git.openjdk.org/jdk.git pull/18819/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18819View PR using the GUI difftool:
$ git pr show -t 18819Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18819.diff
Webrev
Link to Webrev Comment