On Wed, 3 Jan 2024 12:36:26 GMT, Adam Sotona <asot...@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:
> 
>   StackCounter fix

Also `StackMapDecoder::initFrameFromLocals(ClassEntry, ...)` can benefit from 2 
changes:
1. Iterate MTD by index instead of creating copies
2. Pass ClassEntry from reader/writer constant pool to 
ObjectVerificationTypeInfoImpl instead of using the temporary pool

src/java.base/share/classes/jdk/internal/classfile/impl/StackCounter.java line 
306:

> 304:                         var cpe = cp.entryByIndex(bcs.getIndexU2());
> 305:                         var nameAndType = opcode == INVOKEDYNAMIC ? 
> ((DynamicConstantPoolEntry)cpe).nameAndType() : 
> ((MemberRefEntry)cpe).nameAndType();
> 306:                         
> addStackSlot(-countMethodStack(nameAndType.type(), true));

Can use something like:

var mtd = Util.methodTypeSymbol(nameAndType);
addStackSlot(Util.slotSize(mtd.returnType()) - Util.parameterSlots(mtd));

if you stick with MTD.

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

PR Review: https://git.openjdk.org/jdk/pull/17121#pullrequestreview-1807849802
PR Review Comment: https://git.openjdk.org/jdk/pull/17121#discussion_r1444049814

Reply via email to