On Mon, 27 May 2024 11:47:15 GMT, Adam Sotona <asot...@openjdk.org> wrote:

>> [JDK-8294961](https://bugs.openjdk.org/browse/JDK-8294961) changed to use 
>> classfile API for reflection proxy-generation. Actual implementation of 
>> `ProxyGenerator` is focused on performance, however it causes JDK bootstrap 
>> regressions. `ProxyGenerator.TEMPLATE` class model is statically created and 
>> each proxy class is transformed from the template.
>> 
>> This patch is intended to examine plain proxy generation impact on 
>> performance and JDK bootstrap (vs proxy transformation from template).
>> 
>> Please review.
>> 
>> Thank you,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   performance improvements

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 76:

> 74: 
> 75:     private static final MethodTypeDesc
> 76:             MTD_boolean = MethodTypeDescImpl.ofValidated(CD_boolean, 
> ConstantUtils.EMPTY_CLASSDESC),

Maybe we can change the `MethodTypeDescImpl.ofValidated` to varargs so we don't 
need explicit array initializations.

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 822:

> 820:                .iconst_0() // false
> 821:                .aload(0)// classLoader
> 822:                .invokestatic(CD_Class, "forName", 
> MTD_Class_String_boolean_ClassLoader);

We can probably replace this `forName(name, false, thisClassLoader)` with 
loading a class constant to reduce load on symbols.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1615978269
PR Review Comment: https://git.openjdk.org/jdk/pull/19410#discussion_r1615982718

Reply via email to