-
Notifications
You must be signed in to change notification settings - Fork 137
8374016: [lworld] Too late checked_cast in ResolvedFieldEntry::set_flags #1844
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: lworld
Are you sure you want to change the base?
Conversation
|
👋 Welcome back stefank! A progress list of the required criteria for merging this PR into |
|
@stefank 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 111 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 (@fparain, @matias9927) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
fparain
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.
Good point about the checked_cast.
Style changes are good if they make the code more explicit to the reader.
Thank you for these fixes.
matias9927
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.
Change looks good and makes the code more clear, thanks!
In the lworld branch the
new_flagstype has been changed to u1 instead of int. We now perform a bunch of bit operations, which results in an int, and then we narrow that down into a u1. After the u1 has been created we check that this doesn't overflow a u1 with the checked_cast check. That's too late.Mainline code looks like this:
and Valhalla code looks like this:
This voids the benefit of having a checked_cast here. I propose that we revert back to using
int new_flagsand keep the checked_cast.While reading this code there were a few things that made the code harder to follow and I've tweaked it.
boolis_volatile_shiftis special-treated and instead of shifting it is directly casted to int. That hard codes a knowledge/assumption that the flag is always going to be 1 (and maybe also what value bools have).That made me have to look at the actual values of these and at one point I thought that is_volatile_shift was
1and not0and that the above was a bug. The main reason I thought that was this odd order here:Here the order of usage is
but the enum order has final and volatile swapped:
I'd prefer if we stayed consistent with the order, to lower the risk that some bugs sneak in here. So, I've replaced the cast with a shift (just like the other values are handled) and I ordered functions, parameters, and operations in the same order as the enums.
Please tell me if I went to far with the style changes.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1844/head:pull/1844$ git checkout pull/1844Update a local copy of the PR:
$ git checkout pull/1844$ git pull https://git.openjdk.org/valhalla.git pull/1844/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1844View PR using the GUI difftool:
$ git pr show -t 1844Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1844.diff
Using Webrev
Link to Webrev Comment