RFR: 8340280: Avoid calling MT.invokerType() when creating LambdaForms [v2]
Chen Liang
liach at openjdk.org
Tue Sep 17 22:37:05 UTC 2024
On Tue, 17 Sep 2024 22:28:17 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> This PR exploits the observation that in many of the cases where we call `methodType.invokerType()` we immediately translate it into a `Name[]` where the only effect is to create an array with an additional leading `BasicType.L_TYPE` argument. Only in a subset of cases will a corresponding `invokerType()` be created later to bind the MH to an invoker.
>>
>> Providing methods to bypass the creationg of such transient, intermediary `MethodType` creation avoids excessive allocations and adding types to the MT interning table that quickly become stale.
>>
>> Number of executed bytecode on a trivial HelloLambda application drops locally from ~517k to ~505k.
>
> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove argumentsWithTrailingObjectArguments (only one use), handle the logic at callsite
src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java line 256:
> 254: if (doesAlloc) {
> 255: var ptypes = mtype.ptypes();
> 256: var newPtypes = new Class<?>[ptypes.length + (doesAlloc ? 2 : 1)];
Suggestion:
var newPtypes = new Class<?>[ptypes.length + 2];
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21035#discussion_r1764097518
More information about the core-libs-dev
mailing list