RFR: 8370502: C2: segfault while adding node to IGVN worklist

Manuel Hässig mhaessig at openjdk.org
Thu Nov 20 16:33:41 UTC 2025


On Thu, 20 Nov 2025 14:18:39 GMT, Kerem Kat <krk at openjdk.org> wrote:

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

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

I have a few questions and style comments below.

src/hotspot/share/opto/macro.cpp line 2314:

> 2312: 
> 2313:   Node* ctrl = unlock->in(TypeFunc::Control);
> 2314:   Node* mem = unlock->in(TypeFunc::Memory);

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

src/hotspot/share/opto/macro.cpp line 2323:

> 2321: 
> 2322:   // Make the merge point
> 2323:   Node *region = new RegionNode(3);

Suggestion:

  Node* region = new RegionNode(3);

Nit: For better or for worse, this is how we denote pointers in hotspot.

src/hotspot/share/opto/macro.cpp line 2352:

> 2350:   _igvn.replace_node(_callprojs.fallthrough_proj, region);
> 2351: 
> 2352:   if (_callprojs.fallthrough_memproj != nullptr) {

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?

src/hotspot/share/opto/macro.cpp line 2355:

> 2353:     // create a Phi for the memory state
> 2354:     Node *mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
> 2355:     Node *memproj = transform_later(new ProjNode(call, TypeFunc::Memory));

Suggestion:

    Node* mem_phi = new PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
    Node* memproj = transform_later(new ProjNode(call, TypeFunc::Memory));

test/hotspot/jtreg/compiler/c2/Test8370502.java line 1:

> 1: /*

The indentation in Java files should be 4 spaces.

-------------

Changes requested by mhaessig (Committer).

PR Review: https://git.openjdk.org/jdk/pull/28432#pullrequestreview-3488659451
PR Review Comment: https://git.openjdk.org/jdk/pull/28432#discussion_r2546754846
PR Review Comment: https://git.openjdk.org/jdk/pull/28432#discussion_r2546677211
PR Review Comment: https://git.openjdk.org/jdk/pull/28432#discussion_r2546766726
PR Review Comment: https://git.openjdk.org/jdk/pull/28432#discussion_r2546678544
PR Review Comment: https://git.openjdk.org/jdk/pull/28432#discussion_r2546690640


More information about the hotspot-compiler-dev mailing list