Skip to content

Conversation

@krk
Copy link

@krk krk commented Nov 20, 2025

Do not try to replace fallthrough_memproj when it is null, fixes crash.

Test case is simplified from the ticket. Verified that the case crashes without the fix.


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-8370502: C2: segfault while adding node to IGVN worklist (Bug - P3)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28432

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 20, 2025

👋 Welcome back krk! 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 Nov 20, 2025

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

@openjdk
Copy link

openjdk bot commented Nov 20, 2025

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

@krk
Copy link
Author

krk commented Nov 20, 2025

/issue 8370502

@openjdk
Copy link

openjdk bot commented Nov 20, 2025

@krk The issue 8370502 was not found in the JDK project - make sure you have entered it correctly.
As there were validation problems, no additional issues will be added to the list of solved issues.

@krk
Copy link
Author

krk commented Nov 20, 2025

/issue JDK-8370502

@openjdk
Copy link

openjdk bot commented Nov 20, 2025

@krk The issue 8370502 was not found in the JDK project - make sure you have entered it correctly.
As there were validation problems, no additional issues will be added to the list of solved issues.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 20, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 20, 2025

Webrevs

Copy link
Contributor

@mhaessig mhaessig left a comment

Choose a reason for hiding this comment

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

Thank you for working on this, @krk. And nice job reducing the test further!

I have a few questions and style comments below.

Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation in Java files should be 4 spaces.

Copy link
Author

Choose a reason for hiding this comment

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

I followed another test's format style. Now I can see that there is a mixture of 2 and 4 space Test*.java files.

Fixing.

void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {

Node* ctrl = unlock->in(TypeFunc::Control);
Node* mem = unlock->in(TypeFunc::Memory);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do I understand correctly, that mem is never nullptr because UnlockNode is a subclass of a SafepointNode which always has a memory input?

Copy link
Author

Choose a reason for hiding this comment

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

UnlockNode is created at

unlock->init_req( TypeFunc::Memory , memory(raw_idx) );
and will assert under GraphKit:memory if memory is somehow null.

transform_later(mem_phi);

_igvn.replace_node(_callprojs.fallthrough_memproj, mem_phi);
if (_callprojs.fallthrough_memproj != nullptr) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we not have to hook up the memory input to the fall through projection if it does not exist in the first place?

Copy link
Author

Choose a reason for hiding this comment

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

Could you clarify the question?

Copy link
Contributor

Choose a reason for hiding this comment

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

The code before assumed that fallthrough_memproj is always not null. So does the rest of the code also expect this? If so, then we should perhaps use mem for that purpose. This is related to @dean-long's question below. There is an invariant that is being violated and your fix should take into account why it is violated.

@dean-long
Copy link
Member

Why is fallthrough_memproj null, and why is this an issue only for expand_unlock_node but not expand_lock_node or other code that tries to replace fallthrough_memproj?


package compiler.c2;

public class Test8370502 {
Copy link
Member

Choose a reason for hiding this comment

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

Drive-by comment: Please rename the test to something more descriptive. We don't use bug numbers for test names anymore.

@TobiHartmann
Copy link
Member

Also, +1 to Dean's question. We need a better understanding of how we ended up in this situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

4 participants