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

8326638: Crash in PhaseIdealLoop::remix_address_expressions due to unexpected Region instead of Loop #18002

Closed
wants to merge 5 commits into from

Conversation

TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Feb 26, 2024

Adds a missing _head->is_Loop() check to handle the case when the loop head is not a LoopNode but a RegionNode because the loop is irreducible:

(rr) p n_loop->_head->dump(1)
  412 IfTrue === 411 [[ 345 ]] #1 !jvms: Test$Class1::Class1_method0 @ bci:286 (line 119)
  339 SafePoint === 336 1 340 1 1 344 290 1 1 1 1 291 1 1 293 294 295 1 320 297 1 298 299 300 301 302 1 303 1 [[ 345 ]] SafePoint !jvms: Test$Class1::Class1_method0 @ bci:307 (line 122)
  345 Region === 345 339 412 [[ 345 456 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 1861 1863 1865 1867 1882 1888 ]] #irreducible !jvms: Test$Class1::Class1_method0 @ bci:138 (line 101)

We then crash when invoking LoopNode::skip_strip_mined on a RegionNode or assert in debug. Unfortunately, I was not able to simply the test any further.

This is a regression from JDK-8303511 in JDK 21 b13

Thanks,
Tobias


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-8326638: Crash in PhaseIdealLoop::remix_address_expressions due to unexpected Region instead of Loop (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18002

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 26, 2024

👋 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
Copy link

openjdk bot commented Feb 26, 2024

@TobiHartmann 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 Feb 26, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 26, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 26, 2024

Webrevs

Copy link
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

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

Otherwise, looks good!

@@ -583,7 +583,9 @@ Node* PhaseIdealLoop::remix_address_expressions(Node* n) {
n23_loop == n_loop) {
Node* add1 = new AddPNode(n->in(1), n->in(2)->in(2), n->in(3));
// Stuff new AddP in the loop preheader
register_new_node(add1, n_loop->_head->as_Loop()->skip_strip_mined(1)->in(LoopNode::EntryControl));
Node* entry = n_loop->_head->is_Loop() ? n_loop->_head->as_Loop()->skip_strip_mined(1)->in(LoopNode::EntryControl)
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a sanity assert (which could also serve as an explaining comment) that in the RegionNode case, it must be an irreducible loop head?

Copy link
Member Author

Choose a reason for hiding this comment

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

I could do that but it would feel a bit arbitrary to put the assert only in this code, given that we have the same is_Loop check in a lot of other code as well. Maybe it would make sense to factor the checks into a separate method at some point.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense to do a complete replacement of this pattern in other code as well at some point. But let's do that separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with refactoring in separate RFE.

Regarding these changes: should we simply skip this optimization if we see irreducible loop? They may have additional entry into the body so such transformation could be incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, let's better be safe than sorry and skip this optimization for irreducible loops. The other optimizations in that method look safe though.

@openjdk
Copy link

openjdk bot commented Feb 26, 2024

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

8326638: Crash in PhaseIdealLoop::remix_address_expressions due to unexpected Region instead of Loop

Reviewed-by: chagedorn, 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 35 new commits pushed to the master branch:

  • 81b065a: 8326714: Make file-local functions static in src/java.base/unix/native/libjava/childproc.c
  • 4fcae1a: 8326722: Cleanup unnecessary forward declaration in collectedHeap.hpp
  • c5c866a: 8326219: applications/kitchensink/Kitchensink8H.java timed out
  • ac3ce2a: 8326583: Remove over-generalized DefineNativeToolchain solution
  • bceaed6: 8326406: Remove mapfile support from makefiles
  • 16d917a: 8313710: jcmd: typo in the documentation of JFR.start and JFR.dump
  • 60cbf29: 8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor garbage collections
  • da14aa4: 8017234: Hotspot should stop using mapfiles
  • d482c1a: 8326524: Rename agent_common.h
  • e85355a: 8320005: Allow loading of shared objects with .a extension on AIX
  • ... and 25 more: https://git.openjdk.org/jdk/compare/09f755a64db2e38d59c89e6b14d6e409f51126e4...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 26, 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.

Good.

@TobiHartmann
Copy link
Member Author

Thanks for the reviews, Vladimir and Christian.

@TobiHartmann
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 27, 2024

Going to push as commit 9f0e7da.
Since your change was applied there have been 35 commits pushed to the master branch:

  • 81b065a: 8326714: Make file-local functions static in src/java.base/unix/native/libjava/childproc.c
  • 4fcae1a: 8326722: Cleanup unnecessary forward declaration in collectedHeap.hpp
  • c5c866a: 8326219: applications/kitchensink/Kitchensink8H.java timed out
  • ac3ce2a: 8326583: Remove over-generalized DefineNativeToolchain solution
  • bceaed6: 8326406: Remove mapfile support from makefiles
  • 16d917a: 8313710: jcmd: typo in the documentation of JFR.start and JFR.dump
  • 60cbf29: 8325754: Dead AbstractQueuedSynchronizer$ConditionNodes survive minor garbage collections
  • da14aa4: 8017234: Hotspot should stop using mapfiles
  • d482c1a: 8326524: Rename agent_common.h
  • e85355a: 8320005: Allow loading of shared objects with .a extension on AIX
  • ... and 25 more: https://git.openjdk.org/jdk/compare/09f755a64db2e38d59c89e6b14d6e409f51126e4...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 27, 2024

@TobiHartmann Pushed as commit 9f0e7da.

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

@TobiHartmann
Copy link
Member Author

/backport jdk22u

@openjdk
Copy link

openjdk bot commented Feb 28, 2024

@TobiHartmann the backport was successfully created on the branch backport-TobiHartmann-9f0e7da6 in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9f0e7da6 from the openjdk/jdk repository.

The commit being backported was authored by Tobias Hartmann on 27 Feb 2024 and was reviewed by Christian Hagedorn and Vladimir Kozlov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22u:

$ git fetch https://github.com/openjdk-bots/jdk22u.git backport-TobiHartmann-9f0e7da6:backport-TobiHartmann-9f0e7da6
$ git checkout backport-TobiHartmann-9f0e7da6
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22u.git backport-TobiHartmann-9f0e7da6

⚠️ @TobiHartmann You are not yet a collaborator in my fork openjdk-bots/jdk22u. An invite will be sent out and you need to accept it before you can proceed.

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