-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8371458: [REDO] Remove exception handler stub code in C2 #28192
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
base: master
Are you sure you want to change the base?
Conversation
The C2 exception handler stub code is only a trampoline to the generated exception handler blob. This change removes the extra step on the way to the generated blob. According to some comments in the source code, the exception handler stub code used to be patched upon deoptimization, however presumably these comments are outdated as the patching upon deoptimization happens for post-call NOPs only.
Change-Id: I596317ec6a364b341e4642636fa5cf08f87ed722
Change-Id: I9ef51b426d34e9b44a3891f6a45307232f900e5a
Change-Id: I5f5fd681ba699f96859180d984841dd6df8524b5
|
/contributor add @TheRealMDoerr |
|
👋 Welcome back ruben-arm! A progress list of the required criteria for merging this PR into |
|
@ruben-arm 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 306 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 (@TheRealMDoerr, @dean-long) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@ruben-arm |
|
@ruben-arm 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
|
@TobiHartmann, I would appreciate it if you could initiate the extended testing for this PR. |
|
Sure, I submitted testing. |
|
@ruben-arm what was the issue in the original changes? |
|
@vnkozlov, the jdk/src/hotspot/cpu/x86/nativeInst_x86.hpp Line 584 in e34a831
That works when the check happens for an actual call site, as the post-call NOP sequence is always longer than 4 bytes. With the change, the distance between the entry point and end of code blob can now be just 2 bytes - consequently the 4-bytes read would read outside the code blob. I initially missed this issue - having incorrectly concluded that the 7bb4352 should address this issue by splitting the faulting read into two. It also adjusts the expected size of deoptimization handler stub code to 7 bytes in total instead of the incorrect estimate of 10 bytes. |
All testing passed. I leave it to the original reviewers to re-review. |
TheRealMDoerr
left a comment
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.
I haven't checked the deopt handler size on x86. Otherwise, it still looks good to me.
| }; | ||
|
|
||
| bool check() const { return int_at(0) == 0x841f0f; } | ||
| bool check() const { return short_at(0) == 0x1f0f && short_at(2) == 0x0084; } |
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.
Maybe a comment would be nice.
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.
Thanks for the suggestion. Would the comments added at 20cc58a be suitable?
|
|
Thanks, @TobiHartmann, for the extra tests, and apologies for missing this in the original PR. @TheRealMDoerr, I will update the PR to add comments. I am exploring a possibility to add a unit test for this issue, but I have not identified a deterministic way to make the deopt handler stub end at a page boundary. |
|
/reviewers 2 reviewer |
|
@TobiHartmann |
|
I am planning to update this PR today to include the comments. |
The latest update implements an alternative way to detect the failure early during testing - via the newly added assertion in the @adinn, @dean-long, @TheRealMDoerr, would it be possible for you to review the latest version of the PR? Is there any additional testing you would recommend to perform before this can be integrated? |
TheRealMDoerr
left a comment
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.
I think assertions would be sufficient in C1 instead of guarantee. But, ok. I'll put it into our test queue.
|
Our tests haven't revealed any new issues related to this PR. |
|
Thank you, @TheRealMDoerr,
Sure, I will change these to assertions. |
| // The two parts should be checked separately to prevent out of bounds access in case | ||
| // the return address points to the deopt handler stub code entry point which could be | ||
| // at the end of page. | ||
| first_check_size = 4 |
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.
| first_check_size = 4 | |
| first_check_size = instruction_size |
| // read. If the check would read beyond size of the instruction at the deopt handler stub | ||
| // code entry point, then it has to happen in two stages - to prevent out of bounds access | ||
| // in case the return address points to the entry point which could be at the end of page. | ||
| first_check_size = 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.
| first_check_size = 0 | |
| first_check_size = 0 // check is unimplemented |
Oracle likes to make sure the final version passes in our CI. I got burned last time testing an earlier version and not the final version. |
|
@ruben-arm I'm ok with this version assuming it passes tests. |
|
Thank you for the reviews, @dean-long, @adinn, @TheRealMDoerr.
If this version of the patch looks suitable, would it be possible to start the CI testing please? |
TheRealMDoerr
left a comment
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.
dean-long
left a comment
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.
CI testing results are good.
|
Thank you both. I am planning to submit the |
The original fix JDK-8365047 was backed out by JDK-8371388, this is the REDO.
The C2 exception handler stub code is only a trampoline to the generated exception handler blob. This change removes the extra step on the way to the generated blob.
According to some comments in the source code, the exception handler stub code used to be patched upon deoptimization, however presumably these comments are outdated as the patching upon deoptimization happens for post-call NOPs only.
Progress
Issue
Reviewers
Contributors
<[email protected]>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28192/head:pull/28192$ git checkout pull/28192Update a local copy of the PR:
$ git checkout pull/28192$ git pull https://git.openjdk.org/jdk.git pull/28192/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28192View PR using the GUI difftool:
$ git pr show -t 28192Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28192.diff
Using Webrev
Link to Webrev Comment