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

JDK-8263396: Atomic::CmpxchgByteUsingInt::set_byte_in_int needs an explicit cast #3723

Closed
wants to merge 1 commit into from

Conversation

voitylov
Copy link

@voitylov voitylov commented Apr 27, 2021

Hi,

please review this PR to fix a problem found by SonarCloud. I think it's best to fix it to avoid confusion.

As required by the standard, operands of arithmetical operators are implicitly promoted to at least int. Code being fixed assumes int to be at least 32 bits and all implicit promotions are performed to at least 32 bits. It's not a problem with any of the platforms supported by OpenJDK but it won't work correctly on platforms and compilers with 16 bit ints: shift operators will use 16 bit integer and anything shifted to bits 16:31 will be lost.

Testing: original case with gcc bug on Arm 32 is not reproduced, pre-submit tests were run.


Progress

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

Issue

  • JDK-8263396: Atomic::CmpxchgByteUsingInt::set_byte_in_int needs an explicit cast

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3723

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 27, 2021

👋 Welcome back avoitylov! 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 27, 2021
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

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

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Apr 27, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 27, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Aleksei,

This seems harmless. But I very much doubt hotspot would build correctly on any system with only 16-bit ints (jint would have to be redefined to a 32-bit type, and then all the types used with jint would need similar adaptation.)

Cheers,
David

@openjdk
Copy link

openjdk bot commented Apr 27, 2021

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

8263396: Atomic::CmpxchgByteUsingInt::set_byte_in_int needs an explicit cast

Reviewed-by: dholmes

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

  • 07ecd42: 8258602: JavaDoc field summary does not indicate final modifier
  • 276a1bf: 8236671: NullPointerException in JKS keystore
  • e9370a1: 8265761: Font with missed font family name is not properly printed on Windows
  • 3554dc2: 8264395: WB_EnqueueInitializerForCompilation fails with "method holder must be initialized" when called for uninitialized class
  • 4d77171: 8249903: jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java needs to be updated after 8146022 got closed
  • 51b2188: 8266267: Remove unnecessary jumps in Intel Math Library StubRoutines
  • 2c381e0: 8262376: ReplaceCriticalClassesForSubgraphs.java fails if --with-build-jdk is used
  • 5ecef01: 8266217: ZGC: Improve the -Xlog:gc+init output for NUMA
  • 5d8c1cc: 8255410: Add ChaCha20 and Poly1305 support to SunPKCS11 provider
  • 46b4a14: 8266315: Problem list failing test java/awt/font/TextLayout/LigatureCaretTest.java
  • ... and 167 more: https://git.openjdk.java.net/jdk/compare/86bd44fe80c6222f81662b2167c402571ed68f43...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.

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 (@dholmes-ora) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 27, 2021
@voitylov
Copy link
Author

Thank you David for the review. I agree with your assessment, just wanted to make sure not to spend time on this the next scanner shows this up. I assume the fix to be trivial.

@voitylov
Copy link
Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 30, 2021
@openjdk
Copy link

openjdk bot commented Apr 30, 2021

@voitylov
Your change (at version 459ac73) is now ready to be sponsored by a Committer.

@dholmes-ora
Copy link
Member

/sponsor

@openjdk openjdk bot closed this Apr 30, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 30, 2021
@openjdk
Copy link

openjdk bot commented Apr 30, 2021

@dholmes-ora @voitylov Since your change was applied there have been 177 commits pushed to the master branch:

  • 07ecd42: 8258602: JavaDoc field summary does not indicate final modifier
  • 276a1bf: 8236671: NullPointerException in JKS keystore
  • e9370a1: 8265761: Font with missed font family name is not properly printed on Windows
  • 3554dc2: 8264395: WB_EnqueueInitializerForCompilation fails with "method holder must be initialized" when called for uninitialized class
  • 4d77171: 8249903: jdk/javadoc/doclet/testSerializedForm/TestSerializedForm.java needs to be updated after 8146022 got closed
  • 51b2188: 8266267: Remove unnecessary jumps in Intel Math Library StubRoutines
  • 2c381e0: 8262376: ReplaceCriticalClassesForSubgraphs.java fails if --with-build-jdk is used
  • 5ecef01: 8266217: ZGC: Improve the -Xlog:gc+init output for NUMA
  • 5d8c1cc: 8255410: Add ChaCha20 and Poly1305 support to SunPKCS11 provider
  • 46b4a14: 8266315: Problem list failing test java/awt/font/TextLayout/LigatureCaretTest.java
  • ... and 167 more: https://git.openjdk.java.net/jdk/compare/86bd44fe80c6222f81662b2167c402571ed68f43...master

Your commit was automatically rebased without conflicts.

Pushed as commit eb8db12.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
2 participants