Skip to content

Conversation

@vnkozlov
Copy link
Contributor

@vnkozlov vnkozlov commented Jun 27, 2024

While testing Leyden Early Release the problem was found in C2 EscapeAnalysis, in new code which handles allocations merge. ConnectionGraph:: can_reduce_check_users() have incomplete checks which missed case with Opaque4 node between If and Bool nodes. As result we hit assert in ConnectionGraph::specialize_cmp() when trying to access inputs of Cmp node

Node* curr_cmp = curr_ctrl->in(0)->in(1)->in(1); // true/false -> if -> bool -> cmp
con = curr_cmp->in(1)->is_Con() ? curr_cmp->in(1) : curr_cmp->in(2);

This code was introduce for ReduceAllocationMerges optimization JDK-8316991 in JDK-23. There was followup fix JDK-8330853 to add more checks but it missed this case.

I added more strict check in can_reduce_check_users() to catch such cases. And added asserts in specialize_cmp() to verify expected nodes.

Tested tier1-3.hs-stress,hs-xcomp


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-8335220: C2: Missing check for Opaque4 node in EscapeAnalysis (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19921

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 27, 2024

👋 Welcome back kvn! 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 Jun 27, 2024

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

8335220: C2: Missing check for Opaque4 node in EscapeAnalysis

Reviewed-by: chagedorn, cslucas

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

  • 0e6b0cb: 8334886: jdk/jfr/api/recording/time/TestTimeMultiple.java failed with RuntimeException: getStopTime() > afterStop
  • b6ffb44: 8335135: HttpURLConnection#HttpInputStream does not throw IOException when response is truncated
  • 4ab7e98: 8330842: Support AES CBC with Ciphertext Stealing (CTS) in SunPKCS11
  • 5909d54: 8326820: Metadata artificially kept alive
  • d5375c7: 8333308: javap --system handling doesn't work on internal class names
  • 6b961ac: 8333786: Serial: Remove SerialHeap::_incremental_collection_failed
  • 50dd962: 8335007: Inline OopMapCache table
  • 79a2301: 8322859: Parallel: Move transform_stack_chunk
  • 37e7698: 8335154: jcmd VM.classes -verbose=false does not set verbose to false
  • f3b69da: 8335136: Underscore as parameter name in one-parameter functional types fails to compile
  • ... and 7 more: https://git.openjdk.org/jdk/compare/4ebb77120af5a4ccbfde63b24cb50e05a3161f16...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 rfr Pull request is ready for review label Jun 27, 2024
@openjdk
Copy link

openjdk bot commented Jun 27, 2024

@vnkozlov 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 Jun 27, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 27, 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! Were you also able to reproduce this in mainline?

Node* iff_cmp = iff->in(1)->in(1);
int opc = iff_cmp->Opcode();
if ((opc == Op_CmpP || opc == Op_CmpN) && !can_reduce_cmp(n, iff_cmp)) {
can_reduce = (opc == Op_CmpP || opc == Op_CmpN) && can_reduce_cmp(n, iff_cmp);
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment here that we could have an Opaque4 node for which we want to bail out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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

@JohnTortugo JohnTortugo left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for fixing.

@vnkozlov
Copy link
Contributor Author

Thank you, Christian and Cesar, for reviews.

@vnkozlov
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 27, 2024

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

  • 0e6b0cb: 8334886: jdk/jfr/api/recording/time/TestTimeMultiple.java failed with RuntimeException: getStopTime() > afterStop
  • b6ffb44: 8335135: HttpURLConnection#HttpInputStream does not throw IOException when response is truncated
  • 4ab7e98: 8330842: Support AES CBC with Ciphertext Stealing (CTS) in SunPKCS11
  • 5909d54: 8326820: Metadata artificially kept alive
  • d5375c7: 8333308: javap --system handling doesn't work on internal class names
  • 6b961ac: 8333786: Serial: Remove SerialHeap::_incremental_collection_failed
  • 50dd962: 8335007: Inline OopMapCache table
  • 79a2301: 8322859: Parallel: Move transform_stack_chunk
  • 37e7698: 8335154: jcmd VM.classes -verbose=false does not set verbose to false
  • f3b69da: 8335136: Underscore as parameter name in one-parameter functional types fails to compile
  • ... and 7 more: https://git.openjdk.org/jdk/compare/4ebb77120af5a4ccbfde63b24cb50e05a3161f16...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 27, 2024

@vnkozlov Pushed as commit 9d986a0.

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

@vnkozlov vnkozlov deleted the 8335220 branch June 27, 2024 16:15
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