RFR: 8265606: Reduce allocations in AdapterHandlerLibrary::get_adapter

Ioi Lam iklam at openjdk.java.net
Wed Apr 21 17:57:33 UTC 2021


On Wed, 21 Apr 2021 17:21:30 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> 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.

The think the original code was written to avoid allocating large arrays on the stack.

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

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


More information about the hotspot-runtime-dev mailing list