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

8270098: ZGC: ZBarrierSetC2::clone_at_expansion fails with "Guard against surprises" assert #5048

Closed
wants to merge 1 commit into from

Conversation

TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Aug 9, 2021

The fix for JDK-8268125 (PR 53) assumed that only dead code can have a clone array with an unknown array ptr type at expansion time. As TestObjectArrayClone::testCloneObject proves, that is not true because we can invoke Object::clone on any object, including arrays.

As a result, invoking Object::clone on an Object array leads to triggering the "Guard against surprises" assert in debug and to incorrectly using the T_LONG copy stub (without GC barriers) in product. I was not able to trigger a crash in product but a corresponding runtime check (see patch) triggered reliably.

The fix is to fall back to ZBarrierSetRuntime::clone if the array ptr type is unknown. I will backport this fix to JDK 17u.

Thanks,
Tobias


Progress

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

Issue

  • JDK-8270098: ZGC: ZBarrierSetC2::clone_at_expansion fails with "Guard against surprises" assert

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5048

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 9, 2021

👋 Welcome back thartmann! 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 Aug 9, 2021
@TobiHartmann
Copy link
Member Author

/label add hotspot-compiler

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Aug 9, 2021
@openjdk
Copy link

openjdk bot commented Aug 9, 2021

@TobiHartmann
The hotspot-compiler label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Aug 9, 2021

Webrevs

Copy link

@neliasso neliasso 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!

@openjdk
Copy link

openjdk bot commented Aug 9, 2021

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

8270098: ZGC: ZBarrierSetC2::clone_at_expansion fails with "Guard against surprises" assert

Reviewed-by: neliasso, kvn

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

  • a86ac0d: 8271939: Clean up primitive raw accessors in oopDesc
  • b84a9c7: 8271956: AArch64: C1 build failed after JDK-8270947

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Aug 9, 2021
@TobiHartmann
Copy link
Member Author

Thanks for the review, Nils!

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Good.

@TobiHartmann
Copy link
Member Author

Thanks for the review, Vladimir!

@TobiHartmann
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 10, 2021

Going to push as commit 2384e12.
Since your change was applied there have been 16 commits pushed to the master branch:

  • d53d94b: 8271925: ZGC: Arraycopy stub passes invalid oop to load barrier
  • 3b899ef: 8272168: some hotspot runtime/logging tests don't check exit code
  • abdc107: 8270454: G1: Simplify region index comparison
  • eb6f3fe: 8272169: runtime/logging/LoaderConstraintsTest.java doesn't build test.Empty
  • 9654fd7: 8271892: mark hotspot runtime/PrintStringTableStats/PrintStringTableStatsTest.java test as ignoring external VM flags
  • 843943c: 8263567: gtests don't terminate the VM safely
  • 7fc99cf: 8225488: Examine ExecutableType.getReceiverType behavior when source receiver parameter is absent
  • 4548677: 8268824: Remove unused jdk.accessibility APIs deprecated for removal in JDK 9
  • b53828b: 8272047: java/nio/channels/FileChannel/Transfer2GPlus.java failed with Unexpected transfer size: 2147418112
  • 41dc795: 8264792: The NumberFormat for locale sq_XK formats price incorrectly.
  • ... and 6 more: https://git.openjdk.java.net/jdk/compare/38ff85c824750e7da66fd86f5bde1c4587e529c4...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 10, 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 Aug 10, 2021
@openjdk
Copy link

openjdk bot commented Aug 10, 2021

@TobiHartmann Pushed as commit 2384e12.

💡 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-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants