-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8359386: Fix incorrect value for max_size of C2CodeStub when APX is used #25787
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 sparasa! A progress list of the required criteria for merging this PR into |
@vamsi-parasa 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 70 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@sviswa7, @TobiHartmann, @shipilev, @jatin-bhateja) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@vamsi-parasa The following label 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 list. 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.
Looks good to me.
@@ -4687,7 +4687,9 @@ void C2_MacroAssembler::convertF2I(BasicType dst_bt, BasicType src_bt, Register | |||
} | |||
} | |||
|
|||
auto stub = C2CodeStub::make<Register, XMMRegister, address>(dst, src, slowpath_target, 23, convertF2I_slowpath); | |||
// Using the APX extended general purpose registers increases the instruction encoding size by 4 bytes. | |||
int max_size = dst->encoding() <= 15 ? 23 : 27; |
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.
Do you want to write it in a more explicit way then?
int max_size = 23 + (UseAPX ? 4 : 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.
Thank you for the suggestion! Please see suggested change incorporated in the updated code.
Please see the updated version which fixes the error in the initial PR. While it's true that the size of the convert with truncation and the compare instruction increases by 4 bytes in the main common path, it does not contribute to the increase in the stub size. As explained in the updated PR description, the increase in size by 1 byte is being caused by |
Hello Jatin (@jatin-bhateja), Please see the updated PR description which fixed the error in the initial PR. Thanks, |
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.
Looks good to me.
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.
My testing passed.
LGTM
Thank you Tobias (@TobiHartmann), Aleksey (@shipilev) and Jatin (@jatin-bhateja) for approving the changes! |
/integrate |
@vamsi-parasa |
/sponsor |
Going to push as commit b52af18.
Your commit was automatically rebased without conflicts. |
@sviswa7 @vamsi-parasa Pushed as commit b52af18. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The goal of this PR is to fix the value of max_size of the C2CodeStub hardcoded in the C2_MacroAssembler::convertF2I() function when Intel APX instrucitons are used. Currently, max_size is hardcoded to 23 (introduced in JDK-8306706) . However, this value is incorrect when Intel APX instructions with extended general-purpose registers (EGPRs) are used in the code stub as using EGPRs with APX instructions leads to an increase in the instruction encoding size by additional 1 byte.
Without this fix, we see the following error for the C2 compiler tests below:
This PR fixes the errors in the above-mentioned tests.
Currently, the ConvertF2I macro works as follows:
The maximum size (max_size) of the stub is precomputed as 23. However, as seen in the convertF2I_slowpath implementation (below), the usage of pop(dst) instruction increases the instruction encoding size by 1 byte if dst is an extended general-purpose register (R16-R31) .
For example,
pop (r15)
is encoded as41 5f
, whereaspop(r21)
is encoded asd5 10 5d
.This PR fixes the issue with max_size hardcoding by adding 1 byte to the max_size when APX is used.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25787/head:pull/25787
$ git checkout pull/25787
Update a local copy of the PR:
$ git checkout pull/25787
$ git pull https://git.openjdk.org/jdk.git pull/25787/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25787
View PR using the GUI difftool:
$ git pr show -t 25787
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25787.diff
Using Webrev
Link to Webrev Comment