RFR 8207814: (proxy) upgrade the proxy class generator

Mandy Chung mandy.chung at oracle.com
Wed Aug 21 00:42:36 UTC 2019

Hi Roger,

The new test case looks good.  Thanks for adding that.

I like the renamed ProxyGenerator_v49 better.  ProxyPerf.java needs to 
be updated to call the renamed class.

Other than that, the patch looks good.  I'll rely on the test runs to 
verify this patch.  No need for a new webrev.

I filed JDK-8229959 on Remi's idea on using constant dynamic.


On 8/20/19 2:08 PM, Roger Riggs wrote:
> Hi,
> 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).
> http://cr.openjdk.java.net/~rriggs/webrev-upgrade-proxy-gen-8207814/
> 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