On Sun, 7 Jan 2024 18:18:32 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   StackCounter fix
>
> 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.

Calculation of MTD for each method invocation is extremely ineffective way to 
just count the size.

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

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

Reply via email to