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

8324050: Issue store-store barrier after re-materializing objects during deoptimization #17503

Closed
wants to merge 2 commits into from

Conversation

vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Jan 19, 2024

Added missing store-store barrier when we re-materialize scalar replaced object during deoptimization.

I also removed redundant #if COMPILER2_OR_JVMCI guards which were leftover from JDK-8312579 changes. It added Vector API support to Graal and changed #ifdef COMPILER2 to these #if. But this code is already under these ifs.

Tested tier1-3, scope, stress.

No new regression test. I think it is "almost" impossible to hit this issue because there is a lot of VM's runtime code between the code which rematerialize scalar-replaced objects during deoptimization and a code in Interpreter which is executed after deoptimization and which may execute a store instruction that makes these objects accessible by other threads.


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-8324050: Issue store-store barrier after re-materializing objects during deoptimization (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17503

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 19, 2024

👋 Welcome back kvn! 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 Jan 19, 2024
@openjdk
Copy link

openjdk bot commented Jan 19, 2024

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

  • hotspot

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

mlbridge bot commented Jan 19, 2024

Webrevs

// These objects may escape when we return to Interpreter after deoptimization.
// We need barrier so that stores that initialize these objects can't be reordered
// with subsequent stores that make these objects accessible by other threads.
OrderAccess::storestore();
Copy link
Member

Choose a reason for hiding this comment

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

This seems like the right place for normal deoptimization, but I'm worried that EscapeBarrier::deoptimize_objects() makes these objects visible to JVMTI without calling reassign_fields().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that EscapeBarrier::deoptimize_objects_internal() calls Deoptimization::deoptimize_objects_internal() which calls rematerialize_objects() which does reallocation and fields reassignment. It will execute this barrier.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I missed that.

@openjdk
Copy link

openjdk bot commented Jan 20, 2024

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

8324050: Issue store-store barrier after re-materializing objects during deoptimization

Reviewed-by: dlong, shade

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

  • df370d7: 8314329: AgeTable: add is_clear() & allocation spec, and relax assert to allow use of 0-index slot
  • 0d8543d: 8324065: Daylight saving information for Africa/Casablanca are incorrect
  • c9cacfb: 8323657: Compilation of snippet results in VerifyError at runtime with --release 9 (and above)
  • bde650f: 8322282: Incorrect LoaderConstraintTable::add_entry after JDK-8298468
  • be943a9: 8321984: IGV: Upgrade to Netbeans Platform 20
  • d3b2ac1: 8314186: runtime/8176717/TestInheritFD.java failed with "Log file was leaked"
  • 72f1990: 8323057: Recoverable errors may be reported before unrecoverable errors when annotation processing is skipped
  • c84af49: 8324129: C2: Remove some ttyLocker usages in preparation for JDK-8306767
  • fd37262: 8323748: RISC-V: Add Zfh probe code
  • 76afa02: 8322572: AllocationMergesTests.java fails with "IRViolationException: There were one or multiple IR rule failures."
  • ... and 6 more: https://git.openjdk.org/jdk/compare/f1b73350c237021c04ceac2f29f1f378630bd651...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 Jan 20, 2024
@merykitty
Copy link
Member

This seems similar to a recent discussion. There, it is decided that a release barrier would be safer. Should we do it similarly here? Thanks.

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

It looks good, but let's not put unrelated changes together? I think the COMPILER2_OR_JVMCI should come in as a separate atomic change. This will, for example, allow to cleanly backport storestore additions without looking back whether the vector support enablement hunks make sense.

@vnkozlov
Copy link
Contributor Author

This seems similar to a recent discussion. There, it is decided that a release barrier would be safer. Should we do it similarly here? Thanks.

I think, if decided, it should be done in separate RFE uniformly in all places: Interpreter, C1, C2 and here in deoptimization code.

@vnkozlov
Copy link
Contributor Author

It looks good, but let's not put unrelated changes together? I think the COMPILER2_OR_JVMCI should come in as a separate atomic change. This will, for example, allow to cleanly backport storestore additions without looking back whether the vector support enablement hunks make sense.

Thank you, Aleksey

Right, backports. I removed COMPILER2_OR_JVMCI changes.

@vnkozlov
Copy link
Contributor Author

Thank you, Dean, Aleksey and Quan for reviews and comments.

@vnkozlov
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 22, 2024

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

  • df370d7: 8314329: AgeTable: add is_clear() & allocation spec, and relax assert to allow use of 0-index slot
  • 0d8543d: 8324065: Daylight saving information for Africa/Casablanca are incorrect
  • c9cacfb: 8323657: Compilation of snippet results in VerifyError at runtime with --release 9 (and above)
  • bde650f: 8322282: Incorrect LoaderConstraintTable::add_entry after JDK-8298468
  • be943a9: 8321984: IGV: Upgrade to Netbeans Platform 20
  • d3b2ac1: 8314186: runtime/8176717/TestInheritFD.java failed with "Log file was leaked"
  • 72f1990: 8323057: Recoverable errors may be reported before unrecoverable errors when annotation processing is skipped
  • c84af49: 8324129: C2: Remove some ttyLocker usages in preparation for JDK-8306767
  • fd37262: 8323748: RISC-V: Add Zfh probe code
  • 76afa02: 8322572: AllocationMergesTests.java fails with "IRViolationException: There were one or multiple IR rule failures."
  • ... and 6 more: https://git.openjdk.org/jdk/compare/f1b73350c237021c04ceac2f29f1f378630bd651...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 22, 2024

@vnkozlov Pushed as commit 52523d3.

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

@vnkozlov vnkozlov deleted the 8324050 branch January 22, 2024 22:54
@theRealAph
Copy link
Contributor

This seems similar to a recent discussion. There, it is decided that a release barrier would be safer. Should we do it similarly here? Thanks.

I think, if decided, it should be done in separate RFE uniformly in all places: Interpreter, C1, C2 and here in deoptimization code.

That would be the wrong thing to do, because the risk that leads us (possibly? - discuss) to need release can only happen in an optimizing compiler. AFAIK...

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

Successfully merging this pull request may close these issues.

5 participants