RFR: 8265606: Reduce allocations in AdapterHandlerLibrary::get_adapter

Claes Redestad redestad at openjdk.java.net
Wed Apr 21 17:25:34 UTC 2021


On Wed, 21 Apr 2021 16:51:51 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Use stack allocated arrays used when looking up and creating adapters. Resource allocate if number of args grows large, which is relatively rare.
>
> src/hotspot/share/runtime/sharedRuntime.cpp line 2964:
> 
>> 2962:   // ResourceObject, so do not put any ResourceMarks in here.
>> 2963: 
>> 2964:   BasicType sig_bt[256];
> 
> Was this line changed by mistake? The rest of the PR looks good to me.

It was intentional, but it's also a bit of a scope creep: this method is about creating and returning the VMRegPair array, but it also resource-allocs this sig_bt array and keeps it alive for however long the regs array is kept alive, which means we hold on to a bit more memory for longer for no reason.

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

PR: https://git.openjdk.java.net/jdk/pull/3595


More information about the hotspot-runtime-dev mailing list