RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v5]
Quan Anh Mai
qamai at openjdk.org
Fri Dec 12 02:53:51 UTC 2025
On Fri, 12 Dec 2025 02:43:46 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> more detailed explanations
>
> Interesting idea, Quan!
>
> Why can't the same be done as part of `MemNode::can_see_stored_value()`? Based on your reasoning in the comments, if the base escapes, the walk over memory graph happening there should encounter it as well. (But you need to ensure it climbs up to the Allocation node to be sure.)
@iwanowww No, the walk over the memory graph only visits the memory nodes in the alias class of the load, the escape can happen in a different alias class and be made visible by a `MergeMem`. For example:
Integer o = new Integer(v);
*p = o;
VarHandle.fullFence();
int x = o.value;
Then the load is in the alias class `Integer.value`, while the escape is in the alias class `p` and is made visible by the full fence.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28764#issuecomment-3644678568
More information about the hotspot-compiler-dev
mailing list