RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v10]
Vladimir Kozlov
kvn at openjdk.org
Tue Dec 16 18:49:14 UTC 2025
On Tue, 16 Dec 2025 04:47:42 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Hi,
>>
>> This patch is an alternative to #28764 but it does the analysis during IGVN instead.
>>
>> The current escape analysis mechanism is all-or-nothing: either the object does not escape, or it does. If the object escapes, we lose the ability to analyse the values of its fields completely, even if the object only escapes at return.
>>
>> This PR tries to find the escape status of an object at a load, and if it is decided that the object has not escaped there, we can try folding the load aggressively, ignoring calls and memory barriers to find a corresponding store that the load observes. Implementation-wise, when walking at `find_previous_store`, if we encounter a call or memory barrier, we start looking at all nodes that make the allocation escape. If all such nodes have a control input that is not a transitive control input of the call/barrier we are at, then we can decidedly say that the allocation has not escaped at that call/barrier, and walk past that call/barrier to find a corresponding store.
>>
>> I do not see a noticeable difference in C2 runtime with and without this patch.
>>
>> Please take a look and leave your thoughts, thanks a lot.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>
> Much more comments, refactor the data into a separate class
Looks reasonable at first glance but I need more time to go through.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28812#pullrequestreview-3584508583
More information about the hotspot-compiler-dev
mailing list