RFR: 8339205: Optimize StackMapGenerator$Frame

Shaojin Wen swen at openjdk.org
Wed Aug 28 23:37:27 UTC 2024


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

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

Commit messages:
 - from @liach 's suggestion
 - Update src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java
 - optimize frame#setLocalsFromArg
 - optimize frame#pushStack

Changes: https://git.openjdk.org/jdk/pull/20756/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20756&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339205
  Stats: 41 lines in 1 file changed: 10 ins; 9 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/20756.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20756/head:pull/20756

PR: https://git.openjdk.org/jdk/pull/20756


More information about the core-libs-dev mailing list