RFR 8207814: (proxy) upgrade the proxy class generator

Roger Riggs Roger.Riggs at oracle.com
Tue Aug 20 21:08:43 UTC 2019


Updated the webrev to rename the old ProxyGenerator to reflect the 
bytecode version (v49)
and added a combo test for throwing exceptions in the handler (expected 
and unexpected).


Thanks, Roger

On 8/19/19 6:13 PM, Mandy Chung wrote:
> This is a good idea to explore.  We should keep this patch to focus on 
> switching ASM.I will file a JBS issue for this suggestion.
> Mandy
> On 8/19/19 2:19 PM, Remi Forax wrote:
>> A follow up should to use constant dynamic (introduce in Java 11) to 
>> get the j.l.r.Method object instead of pre-calculating all of them in 
>> the static init block.
>> The idea is that a ldc on a constant dynamic with bootstrap method 
>> that takes a MethodHandle as parameter (as boostrap argument) can 
>> return the corresponding Method by using Lookup.revealDirect + 
>> reflectAs.
>> The bootstrap method can be added to j.l.i.ConstantBootstraps
>> This should consume less bytecode (the MethodHandle is directly 
>> encodable as a constant pool constant) and only creates the 
>> j.l.r.Method if the interface method is actually called.
>> Rémi
>> ----- Mail original -----
>>> De: "Roger Riggs" <Roger.Riggs at oracle.com>
>>> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
>>> Envoyé: Vendredi 16 Août 2019 21:15:30
>>> Objet: RFR 8207814: (proxy) upgrade the proxy class generator
>>> Please review an enhancement to replace the java.lang.reflect.Proxy
>>> class file generation.
>>> The new generator uses ASM and generates stackmaps. The implementation
>>> follows
>>> the same structure as before but has many differences as it leverages
>>> ASM for generating the bytecode.
>>> A Combo test is included and two JMH based benchmarks.
>>> The ancient ProxyGenerator_15 implementation is temporarily retained
>>> to allow comparisons of generated class files and performance.
>>> Issue:
>>>    https://bugs.openjdk.java.net/browse/JDK-8207814
>>> Webrev:
>>> http://cr.openjdk.java.net/~rriggs/webrev-upgrade-proxy-gen-8207814/
>>> (Upgrading bytecode generation is necessary for Valhalla but makes 
>>> sense
>>> for the main line.)
>>> Thanks, Roger

More information about the core-libs-dev mailing list