RFR: 8327963: C2: fix construction of memory graph around Initialize node to prevent incorrect execution if allocation is removed [v2]

Roland Westrelin roland at openjdk.org
Thu May 15 12:15:55 UTC 2025


On Wed, 23 Apr 2025 11:59:12 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Roland Westrelin has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   TestIterativeEA fix
>
> src/hotspot/share/opto/escape.cpp line 4123:
> 
>> 4121:       result = result->in(MemNode::Memory);
>> 4122:     }
>> 4123:     if (!is_instance && result->Opcode() == Op_NarrowMemProj) {
> 
> Seems you are checking for `NarrowMemProj` and casting to it in multiple places. Why not enable the macro to do `is_...` and `as_...`?

Done in new commit.

> src/hotspot/share/opto/escape.cpp line 4126:
> 
>> 4124:       // Memory for non known instance can safely skip over a known instance allocation (that memory state doesn't access
>> 4125:       // the result of an allocation for a known instance).
>> 4126:       assert(result->as_Proj()->_con == TypeFunc::Memory, "a NarrowMemProj can only be a memory projection");
> 
> Can we verify that already in the `NarrowMemProj`, i.e. its constructor?

`TypeFunc::Memory` is now hardcoded in the `NarrowMemProj` constructor.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2091030783
PR Review Comment: https://git.openjdk.org/jdk/pull/24570#discussion_r2091033143


More information about the hotspot-compiler-dev mailing list