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

8322996: BoxLockNode creation fails with assert(reg < CHUNK_SIZE) failed: sanity #17370

Closed
wants to merge 9 commits into from

Conversation

dlunde
Copy link
Member

@dlunde dlunde commented Jan 11, 2024

This changeset fixes an issue where deeply nested synchronized statements triggered an assert in C2.

Changes:

  • Bail out on compilation when we create a BoxLockNode with a slot index that cannot fit in a RegMask. This is similar to how we handle the case when we do not have space to represent arguments in opto/matcher.cpp
  • Generalize RegMask::can_represent to take an additional and optional size argument to facilitate reuse. The default size value, 1, corresponds to the previous functionality. Rewrite can_represent_arg to directly call can_represent(reg, SlotsPerVecZ).
  • Add a regression test.

Testing:

  • GitHub Actions
  • tier1 to tier5 on windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64.
  • The new regression test in all tier1 to tier10 contexts on windows-x64, linux-x64, linux-aarch64, macosx-x64, and macosx-aarch64.

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8322996: BoxLockNode creation fails with assert(reg < CHUNK_SIZE) failed: sanity (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17370/head:pull/17370
$ git checkout pull/17370

Update a local copy of the PR:
$ git checkout pull/17370
$ git pull https://git.openjdk.org/jdk.git pull/17370/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17370

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17370.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 11, 2024

👋 Welcome back dlunden! 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 changed the title 8322996 8322996: BoxLockNode creation fails with assert(reg < CHUNK_SIZE) failed: sanity Jan 11, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 11, 2024
@openjdk
Copy link

openjdk bot commented Jan 11, 2024

@dlunde 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 the hotspot-compiler hotspot-compiler-dev@openjdk.org label Jan 11, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 11, 2024

src/hotspot/share/opto/locknode.cpp Outdated Show resolved Hide resolved
test/hotspot/jtreg/compiler/c2/TestNestedSynchronize.java Outdated Show resolved Hide resolved
test/hotspot/jtreg/compiler/c2/TestNestedSynchronize.java Outdated Show resolved Hide resolved
test/hotspot/jtreg/compiler/c2/TestNestedSynchronize.java Outdated Show resolved Hide resolved
@dlunde dlunde marked this pull request as draft January 17, 2024 12:49
@openjdk openjdk bot removed the rfr Pull request is ready for review label Jan 17, 2024
@dlunde dlunde marked this pull request as ready for review January 23, 2024 10:09
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 23, 2024
@dlunde
Copy link
Member Author

dlunde commented Jan 23, 2024

@robcasloz @vnkozlov: I have now made the changes we've discussed. Please have a look when you have some time to spare.

Copy link
Contributor

@robcasloz robcasloz left a comment

Choose a reason for hiding this comment

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

The fix itself looks good to me.
Would it make sense, for better coverage, to add a couple of additional test cases that exercise the boundaries of the condition that is tested? E.g. one with one synchronized statement less than the current one and one with one synchronized statement more.

@dlunde
Copy link
Member Author

dlunde commented Jan 24, 2024

The fix itself looks good to me. Would it make sense, for better coverage, to add a couple of additional test cases that exercise the boundaries of the condition that is tested? E.g. one with one synchronized statement less than the current one and one with one synchronized statement more.

I have experimented with such test cases (various edge cases) and as a result found a related (but separate) issue from this one. I was planning to add these additional tests for that separate issue, to not introduce unnecessary test failures before that fix is integrated. Maybe it is better to add the additional tests directly as part of this changeset instead?

@robcasloz
Copy link
Contributor

I have experimented with such test cases (various edge cases) and as a result found a related (but separate) issue from this one. I was planning to add these additional tests for that separate issue, to not introduce unnecessary test failures before that fix is integrated. Maybe it is better to add the additional tests directly as part of this changeset instead?

If the additional tests trigger failures after this fix is applied, I would suggest including them as part of the fix to the separate issue.

@openjdk
Copy link

openjdk bot commented Jan 24, 2024

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

8322996: BoxLockNode creation fails with assert(reg < CHUNK_SIZE) failed: sanity

Reviewed-by: rcastanedalo, 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 209 new commits pushed to 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.

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 (@robcasloz, @vnkozlov) 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 Jan 24, 2024
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.

Looks good. I have one question.

src/hotspot/share/opto/graphKit.cpp Show resolved Hide resolved
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.

Looks good.

@dlunde
Copy link
Member Author

dlunde commented Jan 29, 2024

Thanks @robcasloz and @vnkozlov. I've now rerun tests and the PR is ready for integration. Please sponsor!

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 29, 2024
@openjdk
Copy link

openjdk bot commented Jan 29, 2024

@dlunde
Your change (at version 8100a3e) is now ready to be sponsored by a Committer.

@robcasloz
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Jan 29, 2024

Going to push as commit 69586e7.
Since your change was applied there have been 209 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 29, 2024
@openjdk openjdk bot closed this Jan 29, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jan 29, 2024
@openjdk
Copy link

openjdk bot commented Jan 29, 2024

@robcasloz @dlunde Pushed as commit 69586e7.

💡 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