RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v4]

Quan Anh Mai qamai at openjdk.org
Fri Dec 12 02:32:55 UTC 2025


On Thu, 11 Dec 2025 21:25:11 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   store values need normalizing
>
> src/hotspot/share/opto/phaseloadfolding.cpp line 94:
> 
>> 92: //   We can see that the object can be considered non-escape at NarrowMemProj, CallJava(null), and
>> 93: //   Proj2, while it is considered escape at CallJava(o), Proj1, Phi. The loads x and z will be
>> 94: //   from NarrowMemProj and Proj2, respectively, which means they can be considered loads from an
> 
> So this optimization is based on JDK-8327963 changes which introduced NarrowMemProj. But I don't see you can for it in code.

This is only for demonstration based on the current shape of the graph. Implementation-wise, we walk the graph until we meet an `InitializeNode`, at that point we call `InitializeNode::find_captured_store`, so you can say it is not important what kind of `Proj` an `InitializeNode` has.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28764#discussion_r2612666993


More information about the hotspot-compiler-dev mailing list