-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8303852: current_stack_region() gets called twice unnecessarily #15321
8303852: current_stack_region() gets called twice unnecessarily #15321
Conversation
👋 Welcome back dholmes! A progress list of the required criteria for merging this PR into |
@dholmes-ora 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. |
…bottom. Standardise the appoach taken with all the versions of the function.
Typo iin zero.
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.
Hi David,
looks good.
some thoughts:
-
the implementations for zero and non-zero Linux are identical and could be merged. I looked at them side by side. The zero implementation looks a bit bitrotted (e.g. does not have the latest guard size adjustments) so unifying them would make zero more correct.
-
bsd aarch64 and x64 could be merged - the only difference is a workaround in x64 that is missing on arm, from 8020753: "JNI_CreateJavaVM on Mac OSX 10.9 Mavericks corrupts the callers stack size". That workaround claims to fix the problem of not-page-aligned stack size for the primordial thread. I just tested on my M1 arm, and the primordial thread has a stack size of 2060K (java -Xlog:os* -version), which is not page-aligned (16K pages). So either this workaround is not needed (since the JVM on M1 seems happy enough) or it is a hidden bug and we need the workaround. In both cases, we could merge both versions of current_stack_region.
-
the bsd zero variant is almost equal to the arm variant, so we could merge those.
And then, since you equalized the interfaces of os::XX::current_stack_region() and os::get_stack_base_and_size, would it be possible to drop the former and implement the latter for the various OSes?
All these are thoughts, and possibly for future RFEs. THis patch looks ok as it is too.
Cheers, Thomas
@dholmes-ora 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 136 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 |
Thanks for looking at this @tstuefe - as I noted I didn't try to merge things further as I thought it would makes things more complex. But to address your specific points:
But as you then state they are not actually identical because zero is missing some of the guard page checks. But zero also has the IA64 code which causes a subtle change in the way size needs to be adjusted. So they are not the same and while they could potentially be merged I much prefer zero code to be kept isolated to zero so that the folks interested in zero can deal with it.
I did wonder about that workaround but it was not something I wanted to touch in this PR. If it is not needed afterall, or actually needed on Aarch64 then that is something for a different RFE (or actual bug if the workaround is needed on aarch64).
Again I like to see zero code isolated, but in addition there is nowhere to put such code except in the shared os_bsd.cpp and then have it ifdef'd out for x86. That said, if the x86 and aarch64 should be the same then yes we could have a single shared version. But again future RFE (I will file one).
Yes I think it can. The arch specific versions would just be moved to os namespace instead, and no shared implementation just to redirect to the arch-specific ones. Thanks. |
Still good. Thanks for fixing this. |
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.
Fix format specifier.
Thanks for the review @pchilano and for catching those typos! /integrate |
Going to push as commit 4a50e87.
Your commit was automatically rebased without conflicts. |
@dholmes-ora Pushed as commit 4a50e87. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
We combine:
into
and so avoid making two underlying system calls. The os/platform specific specializations are handled by the
current_stack_region
calls. It made sense to modify that to export thebase
directly rather than thebottom
. In doing that change it made sense to standardise on the the style of the code used (variable names etc) to make it easier to see where the 5 different versions were the same and where they differ. Having 5 versions is unfortunate ( 3 BSD: one per arch - zero, x64, aarch64; and 2 linux: zero and everything else), but trying to combine them with ifdefs would be even worse in my opinion.In theory there should be zero functional changes here.
Testing:
Thanks.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/15321/head:pull/15321
$ git checkout pull/15321
Update a local copy of the PR:
$ git checkout pull/15321
$ git pull https://git.openjdk.org/jdk.git pull/15321/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 15321
View PR using the GUI difftool:
$ git pr show -t 15321
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/15321.diff
Webrev
Link to Webrev Comment