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

Quan Anh Mai qamai at openjdk.org
Wed Jan 21 02:57:17 UTC 2026


On Tue, 20 Jan 2026 20:01:34 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Do you mean adding an early return in `check_escape_control` when the queried control is a transitive input of the cached one like this:
>> 
>>     if (_not_escaped_controls.member(ctl)) {
>>       return NOT_ESCAPED;
>>     }
>> 
>> I think it is correct to do so, but an assert that `_not_escaped_controls` does contain the `ctl` is a little bit stronger in terms of strictness. Moving this assert into `check_escape_status` will make it harder to reuse a `LocalEA` across multiple calls of `find_previous_store`. This is useful, for example, when the load is from a memory `Phi`, and we try to follow the `Phi` inputs to find the stored value along different paths of the merge.
>
>> Moving this assert into check_escape_status will make it harder to reuse a LocalEA across multiple calls of find_previous_store. This is useful, for example, when the load is from a memory Phi, and we try to follow the Phi inputs to find the stored value along different paths of the merge.
> 
> Do I get it right that it's something for a future enhancement? Because I don't see where multiple `find_previous_store` can share a `LocalEA` now. In the future , we can look into enhancing `LocalEA` with incremental analysis capabilities, but for now I'm more concerned with the noise introduced by `has_not_escaped` caching in `find_previous_store`.

Yes, it is for future enhancement. I have refactored this part and removed the use of the `TriBool`. I hope it is less noisy now, what do you think?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28812#discussion_r2710768460


More information about the hotspot-compiler-dev mailing list