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

8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize #397

Closed
wants to merge 3 commits into from

Conversation

@TobiHartmann
Copy link
Member

@TobiHartmann TobiHartmann commented Apr 30, 2021

This is another instance of JDK-8264586. The fix was not sufficient. The root cause is a subgraph that becomes unreachable from the bottom (but remains reachable from the top) after CCP removes a redundant null check.

Gory details:
CCP has two phases. First, PhaseCCP::analyze visits all nodes and updates their types in _types.map. Then, PhaseCCP::do_transform only visits the nodes that are reachable from the bottom, updates their bottom_type and adds them to the IGVN worklist. During the second step, parts of the graph might be cut off (for example, due to a null-check that is found to be redundant) and the nodes of that subgraph are not visited. I.e., the following code is not executed:

if (t != n->bottom_type()) {
hash_delete(n); // changing bottom type may force a rehash
n->raise_bottom_type(t);
_worklist.push(n); // n re-enters the hash table via the worklist
}

As a result, LoadNodes in the dead subgraph end up with types that are inconsistent with their bottom types. Since they are still reachable from the top, they will be processed by IGVN and then re-enqueued for IGVN indefinitely by this code:

if (can_reshape && igvn != NULL &&
(igvn->_worklist.member(address) ||
(igvn->_worklist.size() > 0 && t_adr != adr_type())) ) {
// The address's base and type may change when the address is processed.
// Delay this mem node transformation until the address is processed.
igvn->_worklist.push(this);
return NodeSentinel; // caller will return NULL

The fix is to aggressively remove useless nodes after CCP. I'll consider upstreaming the fix after some bake time in Valhalla.

Thanks,
Tobias


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/valhalla pull/397/head:pull/397
$ git checkout pull/397

Update a local copy of the PR:
$ git checkout pull/397
$ git pull https://git.openjdk.java.net/valhalla pull/397/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 397

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/valhalla/pull/397.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 30, 2021

👋 Welcome back thartmann! A progress list of the required criteria for merging this PR into lworld 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 openjdk bot commented Apr 30, 2021

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

8265973: [lworld] C2 compilation fails due to infinite loop in PhaseIterGVN::optimize

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

  • 74dbd64: 8265719: [lworld] CDS tests fail after the merge with master
  • b8712b3: 8265725: [lworld] Fix code in synchronizer.cpp after the merge
  • d77a0d4: 8265720: [lworld] RedefineLeak.java is still problem listed
  • c01d10b: 8266361: [lworld] [lw3] Experimental JNI APIs to access flattened arrays should be removed
  • 93c4160: 8266324: [lworld] [lw3] Component type of arrays of primitive objects incorrectly loaded at link time
  • 17b12ac: 8265423: [lworld] Provide experimental support for generating a single class file per primitive class
  • a7ab3bb: 8266086: [lworld][lw3] C1 produces incorrect code when GlobalValueNumbering is used

Please see this link for an up-to-date comparison between the source branch of this pull request and the lworld 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 lworld branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 30, 2021
@TobiHartmann TobiHartmann marked this pull request as ready for review May 3, 2021
@openjdk openjdk bot added the rfr label May 3, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 3, 2021

Webrevs

@TobiHartmann
Copy link
Member Author

@TobiHartmann TobiHartmann commented May 6, 2021

/integrate

@openjdk openjdk bot closed this May 6, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels May 6, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 6, 2021

@TobiHartmann Since your change was applied there have been 7 commits pushed to the lworld branch:

  • 74dbd64: 8265719: [lworld] CDS tests fail after the merge with master
  • b8712b3: 8265725: [lworld] Fix code in synchronizer.cpp after the merge
  • d77a0d4: 8265720: [lworld] RedefineLeak.java is still problem listed
  • c01d10b: 8266361: [lworld] [lw3] Experimental JNI APIs to access flattened arrays should be removed
  • 93c4160: 8266324: [lworld] [lw3] Component type of arrays of primitive objects incorrectly loaded at link time
  • 17b12ac: 8265423: [lworld] Provide experimental support for generating a single class file per primitive class
  • a7ab3bb: 8266086: [lworld][lw3] C1 produces incorrect code when GlobalValueNumbering is used

Your commit was automatically rebased without conflicts.

Pushed as commit f43fafc.

💡 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
1 participant