Skip to content

8385420: C2: SIGSEGV in compiled code due to missing ctrl#31368

Open
merykitty wants to merge 2 commits into
openjdk:masterfrom
merykitty:removecastpp
Open

8385420: C2: SIGSEGV in compiled code due to missing ctrl#31368
merykitty wants to merge 2 commits into
openjdk:masterfrom
merykitty:removecastpp

Conversation

@merykitty
Copy link
Copy Markdown
Member

@merykitty merykitty commented Jun 3, 2026

Hi,

We have a load and its base is a CMoveP, the CMoveP merges 2 not-null values, one of which is a CastPP to not-null of the method parameter, while the other is a not-null constant. As a result, the CMoveP is not-null, and the graph is valid. However, during final_graph_reshaping, we try to remove CastPPNodes from the graph, this requires us to pin all of the depending accesses of that CastPP below the control input of the CastPP that is going away. The logic looks through some kinds of nodes, but it misses CMoveP. As a result, the load from the CastPP is not pinned correctly, and floats up above the null check.

This PR fixes the issue by adding CMove to the cases which require us looking through to look for accesses.

Testing:

  • tier1-4,hs-comp-stress

Please take a look and leave your reviews, thanks a lot.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8385420: C2: SIGSEGV in compiled code due to missing ctrl (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 31368

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Jun 3, 2026

👋 Welcome back qamai! 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 Jun 3, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

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

openjdk Bot commented Jun 3, 2026

@merykitty 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
Copy link
Copy Markdown

openjdk Bot commented Jun 3, 2026

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot-compiler. This can be overridden with the /reviewers command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 3, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Jun 3, 2026

Webrevs

Copy link
Copy Markdown
Contributor

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

What could be a validation check here to ensure no other problematic case is omitted? A node without control [1]?

[1]

default: 
   assert(use->in(0) != nullptr, "%s",  NodeClassNames[use->Opcode()]);

case Op_CheckCastPP:
case Op_CastPP:
case Op_CMoveP:
case Op_CMoveN:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think keeping "switch" and "case" aligned is the more common HotSpot style. Also a comment explaining why we choose this subset of nodes would help.

Copy link
Copy Markdown

@franciscoarturorivera371-cyber franciscoarturorivera371-cyber left a comment

Choose a reason for hiding this comment

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

Hi @franciscoarturorivera371-cyber, thanks for making a comment in an OpenJDK project!

All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user franciscoarturorivera371-cyber" for the summary.

If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.

Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.

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 rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

4 participants