RFR: 8264288: Performance issue with MethodHandle.asCollector [v3]

Vladimir Ivanov vlivanov at openjdk.java.net
Mon Apr 5 12:45:13 UTC 2021


On Mon, 5 Apr 2021 12:37:06 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   - Revert back to injected constructor handle
>>   - Add lambda form sharing
>>   - Add test case for collecting a custom class
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 1909:
> 
>> 1907:         boolean isSharedLambdaForm = parameterCount == 0 || basicType.parameterType(0) == Object.class;
>> 1908:         if (isSharedLambdaForm) {
>> 1909:             LambdaForm lform = basicType.form().cachedLambdaForm(MethodTypeForm.LF_COLLECTOR);
> 
> How does sharing work w.r.t. array store check? Unless you put `storeFunc` on the BMH, I don't see how sharing preserves proper check.

Nevermind, it's the type of the method handle produced by `makeCollector` which ensures that all the arguments have proper type.

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

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


More information about the core-libs-dev mailing list