Skip to content

8325372: Shenandoah: SIGSEGV crash in unnecessary_acquire due to LoadStore split through phi #17926

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

Closed
wants to merge 4 commits into from

Conversation

rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Feb 20, 2024

After shenandoah barrier expansion, a shenandoah specific pass looks
for heap stable checks that are back to back:

if (heap_stable) {
  // fast path 1
} else {
  // slow path 1
}
if (heap_stable) {
  // fast path 2
} else {
  // slow path 2
}

and fuse them:

if (heap_stable) {
  // fast path 1
  // fast path 2
} else {
  // slow path 1
  // slow path 2
}

In the case of the failure, a GetAndSetP (or GetAndSetN) node is
between the 2 heap_stable checks. The fusion of the 2 tests is
implemented by taking advantage of the split if c2 optimization. But
split if doesn't support having a GetAndSet node at the region where
split if happens (that can only happen with shenandoah late barrier
expansion). That causes the GetAndSet node to lose its SCMemProj
which can then result in the GetAndSet being entirely removed.

The fix I propose is to not perform the heap_stable fusion in this
particular case.

/cc hotspot-compiler,shenandoah


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-8325372: Shenandoah: SIGSEGV crash in unnecessary_acquire due to LoadStore split through phi (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17926

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 20, 2024

👋 Welcome back roland! 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 hotspot-compiler hotspot-compiler-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Feb 20, 2024
@openjdk
Copy link

openjdk bot commented Feb 20, 2024

@rwestrel
The hotspot-compiler label was successfully added.

The shenandoah label was successfully added.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 20, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 20, 2024

Webrevs

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.

I suggest we rename the bug to:

8325372: Shenandoah: SIGSEGV crash in unnecessary_acquire due to LoadStore split through phi

@@ -1734,11 +1734,26 @@ bool ShenandoahBarrierC2Support::identical_backtoback_ifs(Node* n, PhaseIdealLoo
return true;
}

bool ShenandoahBarrierC2Support::merge_point_safe(Node* region) {
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be is_merge_point_safe, since it answers bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's an existing merge_point_safe method that validate merge points for split if (loopopts.cpp). That's why I named it like that.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, okay then!

…ergedHeapStableTests.java

Co-authored-by: Aleksey Shipilëv <shipilev@amazon.de>
@rwestrel rwestrel changed the title 8325372: C2 compilation event causes SIGSEV crash (unnecessary_acquire(Node const*)) in JDK 17.0.x 8325372: Shenandoah: SIGSEGV crash in unnecessary_acquire due to LoadStore split through phi Feb 20, 2024
@openjdk
Copy link

openjdk bot commented Feb 20, 2024

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

8325372: Shenandoah: SIGSEGV crash in unnecessary_acquire due to LoadStore split through phi

Reviewed-by: shade, rkennke, thartmann

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

  • c4409ea: 8325994: JFR: Examples in JFR.start help use incorrect separator
  • 54f09d7: 8278527: java/util/concurrent/tck/JSR166TestCase.java fails nanoTime test
  • 00ffc42: 8318761: MessageFormat pattern support for CompactNumberFormat, ListFormat, and DateTimeFormatter
  • d695af8: 8326376: java -version failed with CONF=fastdebug -XX:InitialCodeCacheSize=1024K -XX:ReservedCodeCacheSize=1200k
  • 9f9a732: 8325752: Remove badMetaWordVal
  • 864cf22: 8325742: Remove MetaWord usage from MemRegion
  • 8e5c0ee: 8324832: JFR: Improve sorting of 'jfr summary'
  • 724a2a2: 8321192: j.a.PrintJob/ImageTest/ImageTest.java: Fail or skip the test if there's no printer
  • f365d80: 8325153: SEGV in stackChunkOopDesc::derelativize_address(int)
  • 4406915: 8323274: C2: array load may float above range check
  • ... and 120 more: https://git.openjdk.org/jdk/compare/7cd25ed605469e3946a204b7b18d975c9768f2df...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 Feb 20, 2024
Copy link
Contributor

@rkennke rkennke 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 to me, thank you!
Roman

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Shared code changes look good. Testing passed.

@rwestrel
Copy link
Contributor Author

@shipilev @rkennke @TobiHartmann thanks for the reviews

@rwestrel
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 23, 2024

Going to push as commit 5d414da.
Since your change was applied there have been 133 commits pushed to the master branch:

  • 93a2e77: 8326129: Java Record Pattern Match leads to infinite loop
  • 336bbbe: 8139457: Relax alignment of array elements
  • cb809f8: 8325215: Incorrect not exhaustive switch error
  • c4409ea: 8325994: JFR: Examples in JFR.start help use incorrect separator
  • 54f09d7: 8278527: java/util/concurrent/tck/JSR166TestCase.java fails nanoTime test
  • 00ffc42: 8318761: MessageFormat pattern support for CompactNumberFormat, ListFormat, and DateTimeFormatter
  • d695af8: 8326376: java -version failed with CONF=fastdebug -XX:InitialCodeCacheSize=1024K -XX:ReservedCodeCacheSize=1200k
  • 9f9a732: 8325752: Remove badMetaWordVal
  • 864cf22: 8325742: Remove MetaWord usage from MemRegion
  • 8e5c0ee: 8324832: JFR: Improve sorting of 'jfr summary'
  • ... and 123 more: https://git.openjdk.org/jdk/compare/7cd25ed605469e3946a204b7b18d975c9768f2df...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 23, 2024

@rwestrel Pushed as commit 5d414da.

💡 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 shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants