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

8296318: use-def assert: special case undetected loops nested in infinite loops #11642

Closed
wants to merge 5 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Dec 13, 2022

PhaseCFG::verify checks that the nodes scheduled into the blocks have "use-after-def".

assert(is_loop || block->find_node(def) < j, "uses must follow definitions");

As long as the control flow has no loops, this should always hold.
We make sure to not check the assert if the block-head is a LoopNode, and the use n is a Phi, since we may have inputs from the backedge, which would be "use-before-def" in the block-scheduling order, but that is to be expected.

if (def_block == block && !(block->head()->is_Loop() && n->is_Phi()) &&

Problem
This assumes that all loops are properly detected, if a loop was not detected the block-head may only be a RegionNode, and the assert can fail (see regression test). Why are not all loops detected?
During PhaseIdealLoop::build_loop_tree, we detect all loops, but not always attach infinite loops with their sub-loops to the loop tree, and then the loop-head Regions are not converted to LoopNodes in PhaseIdealLoop::beautify_loops.
This behaviour is expected, see also #11473.
Thus, the assert fires, but it should not.

Solution
Add special casing to assert: also accept if the Region is in an infinite subgraph, and we are looking at a Phi as use (the def could be values from the backedge).


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-8296318: use-def assert: special case undetected loops nested in infinite loops

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11642

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 13, 2022

👋 Welcome back epeter! 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 Dec 13, 2022
@openjdk
Copy link

openjdk bot commented Dec 13, 2022

@eme64 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 Dec 13, 2022
@mlbridge
Copy link

mlbridge bot commented Dec 13, 2022

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.

That looks reasonable!

src/hotspot/share/opto/cfgnode.cpp Outdated Show resolved Hide resolved
src/hotspot/share/opto/block.cpp Outdated Show resolved Hide resolved
@openjdk
Copy link

openjdk bot commented Dec 13, 2022

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

8296318: use-def assert: special case undetected loops nested in infinite loops

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

  • c05dbac: 8193547: Regression automated test '/open/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java' fails
  • 0dce5b8: 8296610: java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java failed with "BindException: Address already in use: connect"
  • ed8a212: 8298376: ZGC: thaws stackChunk with stale oops
  • 2e801e1: 8298475: Remove JVM_ACC_PROMOTED_FLAGS
  • 9ee5037: 8298636: Fix return value in WB_CountAliveClasses and WB_GetSymbolRefcount
  • ceca4fc: 8298264: Merge OffsetTableContigSpace into TenuredSpace
  • d32d6c0: 8297791: update _max_classes in node type system
  • b754aa5: 8298371: monitors_on_stack extracts unprocessed oops

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 openjdk bot added the ready Pull request is ready to be integrated label Dec 13, 2022
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.

Please, merge latest JDK so that GHA builds pass.

@eme64 eme64 requested a review from vnkozlov December 14, 2022 11:09
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.

@eme64
Copy link
Contributor Author

eme64 commented Dec 14, 2022

Thanks @vnkozlov @chhagedorn for the reviews and suggestions!
/integrate

@openjdk
Copy link

openjdk bot commented Dec 14, 2022

Going to push as commit 736fcd4.
Since your change was applied there have been 8 commits pushed to the master branch:

  • c05dbac: 8193547: Regression automated test '/open/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java' fails
  • 0dce5b8: 8296610: java/net/HttpURLConnection/SetAuthenticator/HTTPSetAuthenticatorTest.java failed with "BindException: Address already in use: connect"
  • ed8a212: 8298376: ZGC: thaws stackChunk with stale oops
  • 2e801e1: 8298475: Remove JVM_ACC_PROMOTED_FLAGS
  • 9ee5037: 8298636: Fix return value in WB_CountAliveClasses and WB_GetSymbolRefcount
  • ceca4fc: 8298264: Merge OffsetTableContigSpace into TenuredSpace
  • d32d6c0: 8297791: update _max_classes in node type system
  • b754aa5: 8298371: monitors_on_stack extracts unprocessed oops

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Dec 14, 2022

@eme64 Pushed as commit 736fcd4.

💡 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