RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v20]

Jorn Vernee jvernee at openjdk.org
Tue Jul 4 15:11:21 UTC 2023


On Tue, 4 Jul 2023 13:37:45 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 pull request now contains 44 commits:
>> 
>>  - Merge branch 'master' into explore/mhp-iface
>>  - stage
>>    
>>    Signed-off-by: liach <liach at users.noreply.github.com>
>>  - Review comments
>>  - Code cleanup, thanks mandy!
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into explore/mhp-iface
>>  - 1. Change WRAPPER_TYPES to WeakHashMap to accurately determine if the given class is
>>       the proxy class
>>    
>>    Discussion:
>>    2. I dropped ProxyClassInfo and use Lookup just to see the simplication.
>>       If wrapperInstanceTarget and wrapperInstanceType are frequently called, it makes
>>       sense to cache the method handles.
>>    
>>    3. Should it use SoftReference or WeakReference?  It depends if asInterfaceInstance
>>       will be used heavily.
>>    
>>    3. I also dropped SamInfo and getStats as it can be inlined in the caller, which
>>       I think it's clearer to see what it does in place.
>>  - SecurityManager fixed, minimize changes
>>  - Merge branch 'master' into explore/mhp-iface
>>  - Some changes per Mandy's review. SecurityManager test fails in this patch
>>  - Merge branch 'master' into explore/mhp-iface
>>  - ... and 34 more: https://git.openjdk.org/jdk/compare/0e3d91dc...44e62271
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 186:
> 
>> 184:      * Discussion:
>> 185:      * Since project leyden aims to improve startup speed, asInterfaceInstance
>> 186:      * will share one implementation class for each interface than one implementation
> 
> Suggestion:
> 
>      * will share one implementation class for each interface rather than one implementation

Perhaps this (and the above three notes) should be put into `@implNote`s.

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

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


More information about the core-libs-dev mailing list