RFR: 8345485: C2 MergeLoads: merge adjacent array/native memory loads into larger load [v12]

Emanuel Peter epeter at openjdk.org
Mon Apr 21 11:23:44 UTC 2025


On Mon, 21 Apr 2025 11:15:41 GMT, kuaiwei <duke at openjdk.org> wrote:

>> src/hotspot/share/opto/addnode.cpp line 828:
>> 
>>> 826: };
>>> 827: 
>>> 828: typedef GrowableArray<MergeLoadInfo*> MergeLoadInfoList;
>> 
>> Do you need to have this Resource allocated? Why not just have the elements in-place? And then make the `MergeLoadInfo` a `StackObj`. That would remove the extra pointer indirection.
>
> I choose `GrowableArray` for convenience. And it can be changed as a stack allocate data.

Ah, we have a misunderstanding. I was asking why not 
Suggestion:

typedef GrowableArray<MergeLoadInfo> MergeLoadInfoList;

i.e. allocate the elements of the array directly in the array (in-place), rather than allocating separate elements.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24023#discussion_r2052279839


More information about the hotspot-compiler-dev mailing list