On Wed, 28 Aug 2024 22:38:11 GMT, Chen Liang <li...@openjdk.org> wrote:
>> A small optimization to reduce the code size of StackMapGenerator.Frame's >> pushStack and setLocalsFromArg methods >> >> Below is the compiler log of C2 >> >> >> # baseline >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (27 bytes) >> failed to inline: callee uses too much stack >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (46 bytes) >> failed to inline: callee is too large >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (183 bytes) >> failed to inline: callee is too large >> jdk.internal.classfile.impl.StackMapGenerator$Frame::setLocalsFromArg (367 >> bytes) failed to inline: callee is too large >> >> # current >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (26 bytes) >> inline >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (37 bytes) >> failed to inline: callee is too large >> jdk.internal.classfile.impl.StackMapGenerator$Frame::pushStack (82 bytes) >> jdk.internal.classfile.impl.StackMapGenerator$Frame::setLocalsFromArg (255 >> bytes) failed to inline: callee is too large > > src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java > line 1060: > >> 1058: if (desc == CD_void) throw new AssertionError("Should >> not reach here"); >> 1059: Type type; >> 1060: if (desc instanceof PrimitiveClassDescImpl) { > > Can we use `desc.isPrimitive()`? I have tried isPrimitive(). The codeSize of the virtual function call isPrimitive() is 2 bytes larger than instanceof. The performance of instanceof should be better. But isPrimitive() is a public API and easier to understand. If you think isPrimitive is better, I think it's OK too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20756#discussion_r1735374088