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

Quan Anh Mai qamai at openjdk.org
Sat Dec 13 07:25:58 UTC 2025


On Sat, 13 Dec 2025 03:54:47 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>> 
>>  - Merge branch 'master' into foldmem
>>  - grammar, safe change
>>  - more detailed explanations
>>  - store values need normalizing
>>  - Just use candidate_set directly
>>  - Some runtime calls may receive a derived pointer but not the base
>>  - Aggressively fold loads from objects that have not escaped
>
> src/hotspot/share/opto/phaseloadfolding.cpp line 349:
> 
>> 347:     assert(store->Opcode() == candidate->store_Opcode(), "must match %s - %s", store->Name(), candidate->Name());
>> 348:     Node* res = store->in(MemNode::ValueIn);
>> 349:     if (candidate->Opcode() == Op_LoadUB) {
> 
> Is such adaptation needed? `MemNode::can_see_stored_value()` solves a similar task, but it doesn't perform any adaptation.

Yes, it only looks for a matching store, the one doing the normalization is `Load[B|US|S|US]Node::Ideal`.

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

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


More information about the hotspot-compiler-dev mailing list