Skip to content
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

8264976: Minor numeric bug in AbstractSplittableWithBrineGenerator.makeSplitsSpliterator #3409

Closed
wants to merge 1 commit into from

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Apr 9, 2021

SonarCloud reports:
Cast one of the operands of this subtraction operation to a "long".

Here:

        Spliterator<SplittableGenerator> makeSplitsSpliterator(long index, long fence, SplittableGenerator source) {
            ...
            long multiplier = (1 << SALT_SHIFT) - 1; // <---- here

The shift is integer, and the implicit cast to long happens too late. SALT_SHIFT is currently 4, so this is not the problem yet. But it would become a problem if SALT_SHIFT ever becomes 32 or larger. The shift operand should be 1L for safety. Observe:

jshell> Long.toHexString((1 << 31) - 1)
$2 ==> "7fffffff"

jshell> Long.toHexString((1 << 32) - 1)
$3 ==> "0"

jshell> Long.toHexString((1L << 32) - 1)
$4 ==> "ffffffff"

Additional testing:

  • Linux x86_64 fastdebug, jdk/utils/Random

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8264976: Minor numeric bug in AbstractSplittableWithBrineGenerator.makeSplitsSpliterator

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3409/head:pull/3409
$ git checkout pull/3409

Update a local copy of the PR:
$ git checkout pull/3409
$ git pull https://git.openjdk.java.net/jdk pull/3409/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3409

View PR using the GUI difftool:
$ git pr show -t 3409

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3409.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 9, 2021

👋 Welcome back shade! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 9, 2021
@openjdk
Copy link

openjdk bot commented Apr 9, 2021

@shipilev The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Apr 9, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 9, 2021

Webrevs

@shipilev
Copy link
Member Author

Anyone? :)

@openjdk
Copy link

openjdk bot commented Apr 14, 2021

@shipilev 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:

8264976: Minor numeric bug in AbstractSplittableWithBrineGenerator.makeSplitsSpliterator

Reviewed-by: psandoz, jlaskey

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 67 new commits pushed to the master branch:

  • 0afcbd4: 8264412: AArch64: CPU description should refer DMI
  • 4661690: 8262883: doccheck: Broken links in java.base
  • 75b039a: 8263970: Manual test javax/swing/JTextField/JapaneseReadingAttributes/JapaneseReadingAttributes.java failed
  • f5b2f08: 8257836: Add additional test cases to TestSyncOnValueBasedClassEvent.java
  • 27dd88b: 8262957: (fs) Fail fast in UnixFileStore.isExtendedAttributesEnabled
  • e2106d5: 8265104: CpuLoad and SystemCpuLoad in OperatingSystem MXBean returns -1.0
  • ebbce91: 8264681: Use the blessed modifier order in java.security
  • ea5c55a: 8265103: Remove unnecessary inclusion of oopMap.hpp
  • 26186ec: 8039261: [TEST_BUG]: There is not a minimal security level in Java Preferences and the TestApplet.html is blocked.
  • 283d64f: 8262896: [macos_aarch64] Crash in jni_fast_GetLongField
  • ... and 57 more: https://git.openjdk.java.net/jdk/compare/051c117bf04e3c6821300d040533874c6c2cca24...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 14, 2021
@shipilev
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this Apr 14, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated labels Apr 14, 2021
@openjdk
Copy link

openjdk bot commented Apr 14, 2021

@shipilev Since your change was applied there have been 70 commits pushed to the master branch:

  • 80026d8: 8265174: Update Class.getDeclaredMethods to discuss synthetic and bridge methods
  • ffb3771: 8265019: Update tests for additional TestNG test permissions
  • 7e4cd48: 8264821: DirectIOTest fails on a system with large block size
  • 0afcbd4: 8264412: AArch64: CPU description should refer DMI
  • 4661690: 8262883: doccheck: Broken links in java.base
  • 75b039a: 8263970: Manual test javax/swing/JTextField/JapaneseReadingAttributes/JapaneseReadingAttributes.java failed
  • f5b2f08: 8257836: Add additional test cases to TestSyncOnValueBasedClassEvent.java
  • 27dd88b: 8262957: (fs) Fail fast in UnixFileStore.isExtendedAttributesEnabled
  • e2106d5: 8265104: CpuLoad and SystemCpuLoad in OperatingSystem MXBean returns -1.0
  • ebbce91: 8264681: Use the blessed modifier order in java.security
  • ... and 60 more: https://git.openjdk.java.net/jdk/compare/051c117bf04e3c6821300d040533874c6c2cca24...master

Your commit was automatically rebased without conflicts.

Pushed as commit 9406744.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Apr 14, 2021
@shipilev shipilev deleted the JDK-8264976-prng-long branch May 11, 2021 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
3 participants