[lworld] RFR: 8354068: [lworld] Fold strict final fields more aggressively [v2]
Tobias Hartmann
thartmann at openjdk.org
Thu Apr 24 14:01:18 UTC 2025
On Thu, 24 Apr 2025 01:13:35 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> src/hotspot/share/opto/memnode.cpp line 237:
>>
>>> 235: // current compilation unit, or is the first parameter when we are in a constructor
>>> 236: static bool call_can_modify_local_object(ciField* field, CallNode* call, Node* base_local) {
>>> 237: // The fields can only be modified in this method or in a constructor
>>
>> Comments and naming of this method are a bit confusing. Isn't this basically checking if `base_local` is the receiver of a constructor call `call`?
>
> Yes the comment should refer to `base_local` not `base`. I have also added a section clarifying that this method is equivalent to asking whether `base_local` is the receiver of a constructor call `call` and the holder of `call` is a subclass of the holder of `field`.
Looks good, thanks for updating.
>> src/hotspot/share/opto/memnode.cpp line 288:
>>
>>> 286: if (tmp != nullptr) {
>>> 287: result = tmp;
>>> 288: }
>>
>> Suggestion:
>>
>> result = optimize_strict_final_load_memory(phase, field, adr, base_local);
>> if (result == nullptr) {
>> result = mchain;
>> }
>
> I find it easier to say that this method tries to find a memory node and if it succeeds we set `result` to the found node.
Okay, fine with me.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1424#discussion_r2058518459
PR Review Comment: https://git.openjdk.org/valhalla/pull/1424#discussion_r2058518828
More information about the valhalla-dev
mailing list