Skip to content

8339303: C2: dead node after failing to match cloned address expression #21829

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

Conversation

robcasloz
Copy link
Contributor

@robcasloz robcasloz commented Nov 1, 2024

This changeset prevents the x86 platform-specific logic from cloning address expressions consisting of two chained AddP nodes with a small constant offset each, such as in the following example:

example

Such patterns cannot be fully subsumed into x86 complex addressing modes, and cloning them can cause the matcher to introduce dead nodes that trigger a segmentation fault in the subsequent global code motion phase. See a detailed analysis of the failure in the JBS issue description.

The changeset additionally extends the post-matching verification logic to check that no old node is reachable by travesing both node inputs and outputs. This extension would have caused the original test case to fail directly after matching with an informative assertion message rather than an opaque segmentation fault in an unrelated code generation phase.

Note that the pattern causing the failure should be in general optimized by AddPNode::Ideal into a single AddP node with the constant sum of the offsets. While JDK-8343067 should address the missing optimization, this changeset proposes a complementary solution that is easily backportable and avoids relying on specific optimizations for correctness.

Testing

Functionality
  • tier1-5 (linux-x64, windows-x64, macosx-x64, linux-aarch64, macosx-aarch64; release and debug mode).
Performance
  • Tested performance on a set of standard benchmark suites (DaCapo, SPECjbb2015, SPECjvm2008). No significant change was observed.

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-8339303: C2: dead node after failing to match cloned address expression (Bug - P2)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21829

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 1, 2024

👋 Welcome back rcastanedalo! 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
Copy link

openjdk bot commented Nov 1, 2024

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

8339303: C2: dead node after failing to match cloned address expression

Reviewed-by: vlivanov, 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 86 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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Nov 1, 2024

@robcasloz 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 Nov 1, 2024
@robcasloz robcasloz marked this pull request as ready for review November 4, 2024 09:40
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 4, 2024
@mlbridge
Copy link

mlbridge bot commented Nov 4, 2024

Webrevs

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. Yes, it looks like code expect LShift here instead of constant.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 4, 2024
Copy link
Contributor

@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.

}
}
for (uint j = 0; j < n->outcnt(); j++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you use DU iterator instead (e.g., DUIterator_Fast)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, done in commit b0aa39f, thanks. Please re-review.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Nov 5, 2024
@robcasloz robcasloz requested a review from iwanowww November 5, 2024 17:03
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 5, 2024
@robcasloz
Copy link
Contributor Author

Thanks for reviewing, @vnkozlov and @iwanowww!

@robcasloz
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 6, 2024

Going to push as commit 83f3d42.
Since your change was applied there have been 93 commits pushed to the master branch:

  • ead0116: 8331341: secondary_super_cache does not scale well: C1 and interpreter
  • 06d8216: 8318442: java/net/httpclient/ManyRequests2.java fails intermittently on Linux
  • bdd6816: 8343502: RISC-V: SIGBUS in updateBytesCRC32 after JDK-8339738
  • 4431852: 8342943: Replace predicate walking and cloning code for main/post loops with a predicate visitor
  • 1b0281d: 8333427: langtools/tools/javac/newlines/NewLineTest.java is failing on Japanese Windows
  • 471f112: 8342577: Clean up JVMTI breakpoint support
  • 69bc088: 8343071: Broken anchors to restricted method page and some redundant ids
  • d4d9831: 8340454: C2 EA asserts with "previous reducible Phi is no longer reducible before SUT"
  • 2a1ae0f: 8331008: Implement JEP 478: Key Derivation Function API (Preview)
  • 847cc5e: 8343173: Remove ZGC-specific non-JVMCI test groups
  • ... and 83 more: https://git.openjdk.org/jdk/compare/388d44fbf0126f253860edc88c2efd57f86e5a2b...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 6, 2024

@robcasloz Pushed as commit 83f3d42.

💡 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