RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion [v4]

Mandy Chung mchung at openjdk.org
Thu Apr 6 17:59:15 UTC 2023


On Wed, 5 Apr 2023 13:22:30 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
>> 
>>  - Use a dumper for interface instances, other cleanup
>>  - Merge branch 'master' into explore/mhp-iface
>>  - Merge branch 'master' into explore/mhp-iface
>>  - Remove unused JavaLangReflectReflectAccess.invokeDefault
>>  - rethrow error
>>  - Benchmark compareing to lamda metafactory, various minor updates
>>  - Cache the spinned class, loading is still slow
>>  - Wrapper instance type is already available
>>  - mark records as private
>>  - Merge branch 'master' into explore/mhp-iface
>>  - ... and 3 more: https://git.openjdk.org/jdk/compare/3fd633cd...0eec507d
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 213:
> 
>> 211:                     .defineClassAsLookup(true, List.of(mhs));
>> 212:             proxy = lookup.findConstructor(lookup.lookupClass(), methodType(void.class))
>> 213:                     .asType(methodType(Object.class)).invokeExact();
> 
> This can use `invoke` instead of an explicit `asType` and `invokeExact`. It is more or less the same.
> Suggestion:
> 
>             proxy = lookup.findConstructor(lookup.lookupClass(), methodType(void.class)).invoke();

@JornVernee Is there any performance difference with `invokeExact` vs `invoke`?   I have the impression there is.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1160099637


More information about the core-libs-dev mailing list