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

8264135: UnsafeGetStableArrayElement should account for different JIT implementation details #3180

Closed
wants to merge 1 commit into from

Conversation

dougxc
Copy link
Member

@dougxc dougxc commented Mar 24, 2021

The UnsafeGetStableArrayElement test fails on GraalVM because it asserts implementation specific behavior of C1 and C2. In particular, it asserts that the JIT will not constant fold an unsafe read of a stable array element if the type of the read does not match the type of the array element. For example:

@Stable static final byte[] STABLE_BYTE_ARRAY = {Byte.MAX_VALUE, 0, 0, 0};
@Stable static final int[] STABLE_INT_ARRAY = {Integer.MAX_VALUE, 0, 0, 0};

unsafe.getInt(STABLE_BYTE_ARRAY, ARRAY_BYTE_BASE_OFFSET);
unsafe.getByte(STABLE_INT_ARRAY, ARRAY_INT_BASE_OFFSET);

The Graal compiler will constant fold these reads where as C1 and C2 will not.

This PR modifies the test to take into account the JIT being used when deciding what to assert.


Progress

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

Issue

  • JDK-8264135: UnsafeGetStableArrayElement should account for different JIT implementation details

Reviewers

Download

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

To update a local copy of the PR:
$ git checkout pull/3180
$ git pull https://git.openjdk.java.net/jdk pull/3180/head

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 24, 2021

👋 Welcome back dnsimon! 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.

@dougxc dougxc marked this pull request as ready for review March 24, 2021 21:04
@openjdk
Copy link

openjdk bot commented Mar 24, 2021

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

  • hotspot-compiler

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 hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review labels Mar 24, 2021
@mlbridge
Copy link

mlbridge bot commented Mar 24, 2021

Webrevs

Copy link

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

I suggest to leave testUnsafeAccess() intact and adjust testMatched/testMismatched to take into account whether Compiler.isGraalEnabled() == true or not.

@dougxc
Copy link
Member Author

dougxc commented Mar 24, 2021

Ok, good suggestion - done.

@openjdk
Copy link

openjdk bot commented Mar 25, 2021

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

8264135: UnsafeGetStableArrayElement should account for different JIT implementation details

Reviewed-by: vlivanov, never

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

  • bb354b9: 8264166: OopStorage should support specifying MEMFLAGS for allocations
  • 41657b1: 8261551: Remove special CDS handling in Metaspace::allocate
  • fe8ef32: 8264151: ciMethod::ensure_method_data() should return false is loading resulted in empty state
  • 4e708e5: 8260862: JFR: New configure command for the jfr tool
  • 2593196: 8264161: BigDecimal#stripTrailingZeros can throw undocumented ArithmeticException
  • 2a5e0dd: 8262081: vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java failed with "ERROR: eventSet1.size() != 3 :: 2"
  • 374272f: 8261502: ECDHKeyAgreement: Allows alternate ECPrivateKey impl and revised exception handling
  • dbc9e4b: 8253795: Implementation of JEP 391: macOS/AArch64 Port
  • b006f22: 4833719: (bf) Views of MappedByteBuffers are not MappedByteBuffers, and cannot be forced
  • 8307aa6: 8264165: jpackage BasicTest fails after JDK-8220266: Check help text contains plaform specific parameters
  • ... and 16 more: https://git.openjdk.java.net/jdk/compare/623f0b6bc61bbfb13fbe43e3beaa51481aacb398...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 Mar 25, 2021
Copy link

@iwanowww iwanowww left a comment

Choose a reason for hiding this comment

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

Looks good.

@dougxc
Copy link
Member Author

dougxc commented Mar 26, 2021

/integrate

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

openjdk bot commented Mar 26, 2021

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

  • bb354b9: 8264166: OopStorage should support specifying MEMFLAGS for allocations
  • 41657b1: 8261551: Remove special CDS handling in Metaspace::allocate
  • fe8ef32: 8264151: ciMethod::ensure_method_data() should return false is loading resulted in empty state
  • 4e708e5: 8260862: JFR: New configure command for the jfr tool
  • 2593196: 8264161: BigDecimal#stripTrailingZeros can throw undocumented ArithmeticException
  • 2a5e0dd: 8262081: vmTestbase/nsk/jdi/ThreadDeathRequest/addThreadFilter/addthreadfilter001/TestDescription.java failed with "ERROR: eventSet1.size() != 3 :: 2"
  • 374272f: 8261502: ECDHKeyAgreement: Allows alternate ECPrivateKey impl and revised exception handling
  • dbc9e4b: 8253795: Implementation of JEP 391: macOS/AArch64 Port
  • b006f22: 4833719: (bf) Views of MappedByteBuffers are not MappedByteBuffers, and cannot be forced
  • 8307aa6: 8264165: jpackage BasicTest fails after JDK-8220266: Check help text contains plaform specific parameters
  • ... and 16 more: https://git.openjdk.java.net/jdk/compare/623f0b6bc61bbfb13fbe43e3beaa51481aacb398...master

Your commit was automatically rebased without conflicts.

Pushed as commit 5a930c4.

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

@dougxc dougxc deleted the JDK-8264135 branch May 2, 2021 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants