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

8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL #2635

Closed
wants to merge 1 commit into from

Conversation

martinuy
Copy link
Contributor

@martinuy martinuy commented Jun 25, 2024

Hi,

I would like to propose a backport of 8303466 [1] to jdk17u. jdk17u can benefit from this fix and having more accurate limit type information.

The JDK main line patch (introduced for JDK 21) does not apply cleanly because of the following:

  • src/hotspot/share/opto/convertnode.cpp

    • jdk17u does not have 8230382 so the context where the change applies is different. Manually applied the change.
  • src/hotspot/share/opto/loopTransform.cpp

    • jdk17u does not have 8294540 that removes the protection of the limit under an Opaque2Node. This is orthogonal to the change introduced by 8303466, so there is no need to make 8294540 a dependency.
    • jdk17u does not have 8299975 that assigns more accurate type information to the CMoveINode node. This is not necessary with 8303466 because the MaxLNode or MinLNode macro nodes (inserted instead of the CMoveINode node during PhaseIdealLoop) will have accurate type information, even more accurate than CMoveINode which used the original limit for one of the range ends (intead of the limit minus the strides after unrolling). See MaxLNode::add_ring and MinLNode::add_ring.
    • Note: even with 8299975 backported, 8303466 wouldn't apply cleanly because 8301074 was backported already and it applies changes to code introduced by 8299975 (these changes were not in 17u's 8301074 and would have to be applied manually).
  • The CastIINode node inserted during the first unrolling to keep precise type information after inserting an Opaque2 node is still needed, but has to be inserted before the node is used for ConvI2LNode -> SubLNode -> MaxLNode/MinLNode -> ... Otherwise, bottom type propagates accross this nodes path. The type of the node has to reflect the original limit type. MaxLNode/MinLNode will handle the clamping effect over the type.

In addition to the previous conflicts, the following changes were applied:

  • test/hotspot/jtreg/compiler/loopopts/TestLoopLimitSubtractionsCollapse.java
  • test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
    • jdk17u does not have 8280378 (which, in turn, depends on 8280076 and is not in jdk17u either). These are large enhancements that extend the IR framework for tests and backporting them would be a large effort. The test is making an assertion in an intermediate graph to check the number of MaxL/MinL nodes, and make sure that the optimization that merges them (MaxLNode::Ideal/MinLNode::Ideal) was applied. These macro nodes are not longer available after the Macro expansion phase, when we can make assertions. I manually verified that the MaxL/MinL nodes optimization was applied both debugging fold_subI_no_underflow_pattern and analyzing the graph. If the optimization of MaxL/MinL nodes were not applied, there would be an impact on performance but should be harmless. I propose to skip this test.

No regressions observed in hotspot:tier1.

Thanks,
Martin.-

--
[1] - https://bugs.openjdk.org/browse/JDK-8303466


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
  • JDK-8303466 needs maintainer approval

Issue

  • JDK-8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL (Bug - P3 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/2635/head:pull/2635
$ git checkout pull/2635

Update a local copy of the PR:
$ git checkout pull/2635
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/2635/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2635

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/2635.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 25, 2024

👋 Welcome back mbalao! 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 25, 2024

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

8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL

Reviewed-by: roland

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

  • b903b50: Merge
  • c1c9011: 8334441: Mark tests in jdk_security_infra group as manual
  • 11f5d00: 8329103: assert(!thread->in_asgct()) failed during multi-mode profiling
  • f277b39: 8051959: Add thread and timestamp options to java.security.debug system property
  • b99923c: 8329605: hs errfile generic events - move memory protections and nmethod flushes to separate sections
  • 859dda1: 8332174: Remove 2 (unpaired) RLO Unicode characters in ff_Adlm.xml
  • a963e2d: 8241550: [macOS] SSLSocketImpl/ReuseAddr.java failed due to "BindException: Address already in use"
  • 0c0871d: 8316389: Open source few AWT applet tests
  • 35cac7f: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • b09c9eb: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
  • ... and 6 more: https://git.openjdk.org/jdk17u-dev/compare/879e8031949d6cd6ce82027296dd2d4325faa2bb...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 changed the title Backport cc894d849aa5f730d5a806acfc7a237cf5170af1 8303466: C2: failed: malformed control flow. Limit type made precise with MaxL/MinL Jun 25, 2024
@openjdk
Copy link

openjdk bot commented Jun 25, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Jun 25, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 25, 2024

Webrevs

Copy link
Contributor

@rwestrel rwestrel 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 good to me.

@openjdk
Copy link

openjdk bot commented Jun 25, 2024

⚠️ @martinuy This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@martinuy
Copy link
Contributor Author

The GHA macos-aarch64 failure at build time seems unrelated to this backport.

@martinuy
Copy link
Contributor Author

/approval request jdk17u is affected by this bug and would benefit from its fix. The patch does not apply cleanly but has been reviewed.

@openjdk
Copy link

openjdk bot commented Jun 25, 2024

@martinuy
8303466: The approval request has been created successfully.

@openjdk openjdk bot added approval ready Pull request is ready to be integrated and removed approval labels Jun 25, 2024
@martinuy
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 27, 2024

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

  • 5b43be2: 8317372: Refactor some NumberFormat tests to use JUnit
  • 719f9ce: 8323584: AArch64: Unnecessary ResourceMark in NativeCall::set_destination_mt_safe
  • 2b128f1: 8222884: ConcurrentClassDescLookup.java times out intermittently
  • dae2d6c: 8328647: TestGarbageCollectorMXBean.java fails with C1-only and -Xcomp
  • b903b50: Merge
  • c1c9011: 8334441: Mark tests in jdk_security_infra group as manual
  • 11f5d00: 8329103: assert(!thread->in_asgct()) failed during multi-mode profiling
  • f277b39: 8051959: Add thread and timestamp options to java.security.debug system property
  • b99923c: 8329605: hs errfile generic events - move memory protections and nmethod flushes to separate sections
  • 859dda1: 8332174: Remove 2 (unpaired) RLO Unicode characters in ff_Adlm.xml
  • ... and 10 more: https://git.openjdk.org/jdk17u-dev/compare/879e8031949d6cd6ce82027296dd2d4325faa2bb...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

@martinuy Pushed as commit 445aba4.

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

@martinuy martinuy deleted the JDK-8303466 branch June 29, 2024 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants