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

8282590: C2: assert(addp->is_AddP() && addp->outcnt() > 0) failed: Don't process dead nodes #7728

Closed
wants to merge 14 commits into from

Conversation

eme64
Copy link
Contributor

@eme64 eme64 commented Mar 7, 2022

Problem:
Sometimes nodes are generated, and then not properly added to any other node, nor added to the worklist, so that it could be deleted. In some cases, a node can thus survive after IGVN and enter into ConnectionGraph::compute_escape, where no dead nodes are expected (except constants).

In ArrayCopyNode::prepare_array_copy:
In one, I now add the new ConvI2LNode to the worklist if we are aborting.
In the other case, I could safely reorder the code, such new ConvI2LNode would only be generated once we know we are not going to abort.

In SubTypeCheckNode::Ideal:
Replaced set_req with set_req_X, such that the input-node that is replaced (which is now potentially a dead node) is put on the worklist.

In ArrayCopyNode::Ideal:
If we decide to return NULL we also need to add the potentially dead forward / backward memory nodes to the worklist, they may turn out to be dead.

Added a regression test: the test + flag combination that first reproduced this issue.

All Tests, including this new regression test are passing. Tests rerun after small refactorings.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8282590: C2: assert(addp->is_AddP() && addp->outcnt() > 0) failed: Don't process dead nodes

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7728

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 7, 2022

👋 Welcome back eme64! 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 Mar 7, 2022
@openjdk
Copy link

openjdk bot commented Mar 7, 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 Mar 7, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 7, 2022

@@ -297,6 +297,16 @@ bool ArrayCopyNode::prepare_array_copy(PhaseGVN *phase, bool can_reshape,
dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size());
if (src_offset->is_top() || dest_offset->is_top()) {
// Offset is out of bounds (the ArrayCopyNode will be removed)
// Below: make sure that we record the nodes, so that they can be deleted later (if they are dead)
Copy link
Member

Choose a reason for hiding this comment

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

What about this?

src_offset = Compile::conv_I2X_index(phase, src_offset, ary_src->size());
if (src_offset->is_top()) {
  return false;
}
dest_offset = Compile::conv_I2X_index(phase, dest_offset, ary_dest->size());
if (dest_offset->is_top()) {
  if (can_reshape) {
    phase->is_IterGVN()->_worklist.push(src_offset);
  }
  return false;
}

if (!backward_mem->is_top() && backward_mem->outcnt() == 0) {
phase->is_IterGVN()->_worklist.push(backward_mem);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need to check if the mem is really dead. Adding it to the worklist does not hurt. Would this work as well?

if (can_reshape) {
  phase->is_IterGVN()->_worklist.push(mem):
}

Comment on lines 305 to 306
if (can_reshape) {
if (!src_offset->is_top()) {
Copy link
Member

Choose a reason for hiding this comment

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

The ifs can be merged.

Copy link
Member

Choose a reason for hiding this comment

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

And looking at this again, src_offset can't be top, right? We just checked it above.

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.

Looks good, thanks for making these changes.

@openjdk
Copy link

openjdk bot commented Mar 17, 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:

8282590: C2: assert(addp->is_AddP() && addp->outcnt() > 0) failed: Don't process dead nodes

Reviewed-by: thartmann, chagedorn

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

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@TobiHartmann, @chhagedorn) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 17, 2022
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.

Looks good!

@eme64
Copy link
Contributor Author

eme64 commented Mar 21, 2022

Thanks @TobiHartmann and @chhagedorn for the help, suggestions for improvement and reviews!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 21, 2022
@openjdk
Copy link

openjdk bot commented Mar 21, 2022

@eme64
Your change (at version 584326e) is now ready to be sponsored by a Committer.

@TobiHartmann
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 22, 2022

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

  • 557ff4b: 8282625: Formatter caches Locale/DecimalFormatSymbols poorly
  • fabde3b: 8283451: C2: assert(_base == Long) failed: Not a Long
  • c0f984e: 8283456: Make CompiledICHolder::live_count/live_not_claimed_count debug only
  • 85628a8: 8282592: C2: assert(false) failed: graph should be schedulable
  • a6fd0b2: 8283087: Create a test or JDK-4715503
  • 37fc77e: 8283092: JMX subclass permission check redundant with strong encapsulation
  • 849b195: 8282937: Write a regression test for JDK-4820080
  • 81d6373: 8282469: Allow considered use of C++ thread_local in Hotspot
  • f3dc0c8: 8282721: HotSpot Style Guide should allow considered use of C++ thread_local
  • f8878cb: 8257733: Move module-specific data from make to respective module
  • ... and 170 more: https://git.openjdk.java.net/jdk/compare/832729b41e690d6f05da71997bbe2a74b2d6dada...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 22, 2022

@TobiHartmann @eme64 Pushed as commit d29c7e7.

💡 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
3 participants