-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8238669: Long.divideUnsigned is extremely slow for certain values (Needs to be Intrinsic) #31
Conversation
…eds to be Intrinsic)
Hi @rgiulietti, welcome to this OpenJDK project and thanks for contributing! We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user rgiulietti" as summary for the issue. If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing |
@rgiulietti 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 |
/signed |
Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated! |
Webrevs
|
if (divisor >= 0) { | ||
final long q = (dividend >>> 1) / divisor << 1; | ||
final long r = dividend - q * divisor; | ||
return q + ((r | ~(r - divisor)) >>> Long.SIZE - 1); |
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 it would be worth parenthesizing the right hand side of the >>>
operator here too.
} | ||
return (dividend & ~(dividend - divisor)) >>> Long.SIZE - 1; |
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.
Parenthesize RHS?
if (divisor >= 0) { | ||
final long q = (dividend >>> 1) / divisor << 1; | ||
final long r = dividend - q * divisor; | ||
return r - (~(r - divisor) >> Long.SIZE - 1 & divisor); |
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.
Parentheses would be particularly helpful here. I'd certainly have to think hard about the relative precedences of >>
, -
, and &
, whereas I wouldn't have to with:
return r - ((~(r - divisor) >> (Long.SIZE - 1)) & divisor);
I also think it would be worth adding a comment saying that this is deliberately >>
not >>>
, even though we have >>>
in the divide method. Here we're propagating the sign bit so that thing & divisor
is either 0 or divisor
according as thing
is –1 or 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.
Hi Éamonn,
I have no problems adding non-strictly needed parentheses. I usually don't because I'm quite familiar with operator precedence and often forget that other people are not.
I'll add comments for parts, like the one you point out, that are not already discussed at length in the bibliographical reference.
Thanks
Raffaello
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,
I just committed the changes.
Greetings
Raffaello
…eds to be Intrinsic) Added helpful parentheses and comments to clarify aspects not discussed in "Hacker's Delight".
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.
Since this patch does not involve adding the intrinsic, maybe drop "(Needs to be intrinsic)" from the synopsis?
@shipilev I agree, but that's the title chosen by the reporter of the JBS issue. Not sure I can edit it without impacting bots and tools. |
Hello this is a gentle reminder that this issue still needs a more formal review. Greetings |
Hello, a reminder that this issue has not been formally reviewed. Greetings |
I think the change looks good. Before the project was on GitHub, there was a change to the test posted in http://mail.openjdk.java.net/pipermail/core-libs-dev/2020-September/068504.html to address the comment in http://mail.openjdk.java.net/pipermail/core-libs-dev/2020-September/068484.html. I think the test is all right but perhaps someone else still has a comment. The copyright year in any case needs to be adjusted. I can sponsor this change if you like. |
@bpb Since the switch to Skara, the test is on GitHub as well. |
OK, looks good. Let's leave the PR open for a day or two and then move forward. 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.
Seeing no more comments in the last couple of days, I think this can be integrated.
@rgiulietti 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 622 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 (@shipilev, @bplb) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@rgiulietti |
/sponsor |
@bplb @rgiulietti Since your change was applied there have been 622 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 0efdde1. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
In AArch64, asr x10, x1, openjdk#31 neg x0, x10 can be optimized to: neg x0, x1, asr openjdk#31 To implement the instruction combining, we add matching rules in the backend. Change-Id: Iaee06f7a03e97a7e092e13da75812f3722549c3b
JVM-1693: Materialization updates AddP which is not dominated by current control
They are only timeouting on CI because they take time and machines on GHA are slow. We need a better solution than disabling them. (retries?)
This is a follow-up of the Mercurial-based workflow initiated on the core-lib-devs mailing list [0]. Not sure if this one is strictly necessary or if the patches sent on the list are sufficient. Anyway, I exploit this PR as a test ;-)
[0] https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-September/068474.html
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/31/head:pull/31
$ git checkout pull/31