Skip to content

8376421: C2: Missing branch on SubTypeCheck node#30573

Open
iwanowww wants to merge 1 commit intoopenjdk:masterfrom
iwanowww:8376421.subtype_dead
Open

8376421: C2: Missing branch on SubTypeCheck node#30573
iwanowww wants to merge 1 commit intoopenjdk:masterfrom
iwanowww:8376421.subtype_dead

Conversation

@iwanowww
Copy link
Copy Markdown
Contributor

@iwanowww iwanowww commented Apr 3, 2026

SubTypeCheck relies on custom logic to detect when the operation is redundant during GVN while subsequent CheckCastPP on instanceof success branch (introduced by JDK-8372634) uses C2 type system.

It turns out the latter is superior and the bug demonstrates one case when C2 proves that receiver type after the check is empty while Compile::static_subtype_check() doesn't report corresponding SubTypeCheck as redundant. It leaves the branch im corrupted state with a single control projection.

Proposed fix piggybacks on control pruning for dead type nodes introduced by JDK-8349479. It keeps the redundant runtime check, but places a Halt node on pruned branch thus preserving CFG correctness.

I filed an RFE (JDK-8381646) to improve the analysis performed by SubTypeCheck node during GVN.

Testing: hs-tier1 - hs-tier5

Thanks!


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-8376421: C2: Missing branch on SubTypeCheck node (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30573

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 3, 2026

👋 Welcome back vlivanov! 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
Copy Markdown

openjdk bot commented Apr 3, 2026

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

8376421: C2: Missing branch on SubTypeCheck node

Reviewed-by: 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 29 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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 3, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 3, 2026

@iwanowww 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.

@iwanowww iwanowww marked this pull request as ready for review April 3, 2026 22:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 3, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 3, 2026

Webrevs

Copy link
Copy Markdown
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Looks reasonable.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 4, 2026
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 ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants