RFR: 8294961: Convert java.base/java.lang.reflect.ProxyGenerator to use the Classfile API to generate proxy classes [v5]

Chen Liang liach at openjdk.org
Sun Dec 24 03:17:50 UTC 2023


On Thu, 21 Dec 2023 13:32:12 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy classes.
>> 
>> This patch converts it to use Classfile API.
>> 
>> It is continuation of https://github.com/openjdk/jdk/pull/10991
>> 
>> Any comments and suggestions are welcome.
>> 
>> Please review.
>> 
>> Thank you,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   minor StackCounter fix

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

> 735:         private void generateMethod(ClassBuilder clb, ClassEntry className) {
> 736:             var cp = clb.constantPool();
> 737:             var desc = new StringJoiner("", "(", ")" + returnType.descriptorString());

We should just use an MTD here; the MTD will be passed to StackCounter so we don't have to recompute a MTD.

The MT to MTD conversion shouldn't be too costly; the overhead probably comes from Optional, which we have to wait until Valhalla, as proxy generation is unlikely to be hot and compiled by C2.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17121#discussion_r1435756657


More information about the core-libs-dev mailing list