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

Vladimir Kozlov kvn at openjdk.org
Fri Dec 12 19:46:54 UTC 2025


On Fri, 12 Dec 2025 02:30:05 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

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

Okay

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

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


More information about the hotspot-compiler-dev mailing list