Skip to content
This repository has been archived by the owner. It is now read-only.

8268884: C2: Compile::remove_speculative_types must iterate top-down #170

Closed
wants to merge 4 commits into from

Conversation

neliasso
Copy link

@neliasso neliasso commented Jun 29, 2021

Hi,

The test fails on "assert(t->meet(t0) == t) failed: Not monotonic" in PhaseCCP for a CheckCastPPNode. The test is really simple. The CheckCastPP is hanging of the ParmNode for the 'this' pointer. The user of this is a call, with an infinite empty loop, that gets inlined. The loop will have a safepoint that keeps the JVM State - the CheckCastPP is kept alive by that SafePointNode.

The assert triggers because the type for the CheckCastPP has a speculative part. In the assert "assert(t->meet(t0) == t) failed: Not monotonic" - t is the type evaluated for the CheckCastPP, t0 is the previous type (from _types map), which has not been updated yet and is still Type::Top.

t->meet(t0) will drop the speculative part and fail the comparison.

Suggested fix - change meet to meet_specualtive that will keep the speculative part.

Please review,
Best regards,
Nils Eliasson


Progress

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

Issue

  • JDK-8268884: C2: Compile::remove_speculative_types must iterate top-down

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 170

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jun 29, 2021

👋 Welcome back neliasso! 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 openjdk bot commented Jun 29, 2021

@neliasso 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 label Jun 29, 2021
@neliasso neliasso marked this pull request as ready for review Jun 29, 2021
@openjdk openjdk bot added the rfr label Jun 29, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 29, 2021

Webrevs

@rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Jun 29, 2021

Hi Nils,
Compile::remove_speculative_types() removes speculative types before CCP. How come this node still has a speculative type?

@neliasso
Copy link
Author

@neliasso neliasso commented Jun 29, 2021

Hi Nils,
Compile::remove_speculative_types() removes speculative types before CCP. How come this node still has a speculative type?

Compile::remove_speculative_types() traverses the graph bottom up. The checkcast is part of an infinite loop with no exit edge. It can't be reached from below.

@rwestrel
Copy link
Contributor

@rwestrel rwestrel commented Jun 29, 2021

Hi Nils,
Compile::remove_speculative_types() removes speculative types before CCP. How come this node still has a speculative type?

Compile::remove_speculative_types() traverses the graph bottom up. The checkcast is part of an infinite loop with no exit edge. It can't be reached from below.

Wouldn't it make sense then to improve Compile::remove_speculative_types() so we're guaranteed it removes all of them?

@neliasso
Copy link
Author

@neliasso neliasso commented Jun 29, 2021

Hi Nils,
Compile::remove_speculative_types() removes speculative types before CCP. How come this node still has a speculative type?

Compile::remove_speculative_types() traverses the graph bottom up. The checkcast is part of an infinite loop with no exit edge. It can't be reached from below.

Wouldn't it make sense then to improve Compile::remove_speculative_types() so we're guaranteed it removes all of them?

Absolutely. My first fix didn't take into account that the speculative types should have been removed.

@neliasso
Copy link
Author

@neliasso neliasso commented Jun 29, 2021

The new suggested fix changes so that Compile::remove_speculative_types() iterates the nodes from top to bottom. With this change all nodes that are reachable from the top will be visited.

Copy link
Contributor

@rwestrel rwestrel left a comment

Looks good to me.

@openjdk
Copy link

@openjdk openjdk bot commented Jun 29, 2021

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

8268884: C2: Compile::remove_speculative_types must iterate top-down

Reviewed-by: roland, 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 10 new commits pushed to the master branch:

  • 25f9f19: 8249646: Runtime.exec(String, String[], File) documentation contains literal {@link ...}
  • 0d83dc2: 8268699: Shenandoah: Add test for JDK-8268127
  • 7010dfd: 8269517: compiler/loopopts/TestPartialPeelingSinkNodes.java crashes with -XX:+VerifyGraphEdges
  • fc0fd96: 8269126: Rename G1AllowPreventiveGC option to G1UsePreventiveGC
  • 5624069: 8269426: Rename test/jdk/java/lang/invoke/t8150782 to accessClassAndFindClass
  • 09bb846: 8267952: async logging supports to dynamically change tags and decorators
  • 20640a5: 8269534: Remove java/util/concurrent/locks/Lock/TimedAcquireLeak.java from ProblemList.txt
  • efe8423: 8269403: Fix jpackage tests to gracefully handle jpackage app launcher crashes
  • 8d09596: 8269304: Regression ~5% in 2005 in b27
  • e4c5446: 8268236: The documentation of the String.regionMatches method contains error

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 label Jun 29, 2021
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Please, add comments in both places explaining why we changed direction (from inputs to outputs).
Otherwise based on Roland and your comment fix seems fine.

@neliasso neliasso changed the title 8268884: C2: Change to meet_speculative in phase CCP assert 8268884: C2: Compile::remove_speculative_types must iterate top-down Jun 29, 2021
@openjdk openjdk bot removed the ready label Jun 29, 2021
@neliasso
Copy link
Author

@neliasso neliasso commented Jun 29, 2021

Thanks for the review @rwestrel and @vnkozlov

I have added a comments and updated the bug title to reflect the solution.

@openjdk openjdk bot added the ready label Jun 29, 2021
@neliasso
Copy link
Author

@neliasso neliasso commented Jun 29, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Jun 29, 2021

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

  • 25f9f19: 8249646: Runtime.exec(String, String[], File) documentation contains literal {@link ...}
  • 0d83dc2: 8268699: Shenandoah: Add test for JDK-8268127
  • 7010dfd: 8269517: compiler/loopopts/TestPartialPeelingSinkNodes.java crashes with -XX:+VerifyGraphEdges
  • fc0fd96: 8269126: Rename G1AllowPreventiveGC option to G1UsePreventiveGC
  • 5624069: 8269426: Rename test/jdk/java/lang/invoke/t8150782 to accessClassAndFindClass
  • 09bb846: 8267952: async logging supports to dynamically change tags and decorators
  • 20640a5: 8269534: Remove java/util/concurrent/locks/Lock/TimedAcquireLeak.java from ProblemList.txt
  • efe8423: 8269403: Fix jpackage tests to gracefully handle jpackage app launcher crashes
  • 8d09596: 8269304: Regression ~5% in 2005 in b27
  • e4c5446: 8268236: The documentation of the String.regionMatches method contains error

Your commit was automatically rebased without conflicts.

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

@openjdk openjdk bot commented Jun 29, 2021

@neliasso Pushed as commit b8a16e9.

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hotspot-compiler integrated
3 participants