On Mon, 23 Sep 2024 13:53:13 GMT, Shaojin Wen <s...@openjdk.org> wrote:
> A small optimization of processMethod, by using local variables and > extracting exception methods, reduces codeSize from 326 to 286 src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 432: > 430: nextFrame.dirty = false; > 431: } else if (thisOffset < bcs.bci()) { > 432: throw new ClassFormatError(String.format("Bad stack > map offset %d", thisOffset)); @asotona Is this CFE an outdated implementation behavior from an older implementation? If yes, we can just use `generatorError("Bad stack map offset");` instead. src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java line 444: > 442: > 443: private static ClassFormatError classFormatError(int thisOffset) { > 444: throw new ClassFormatError(String.format("Bad stack map offset > %d", thisOffset)); Suggestion: return new ClassFormatError(String.format("Bad stack map offset %d", thisOffset)); Prefer to return instead of throw in such convenience methods. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21137#discussion_r1771672919 PR Review Comment: https://git.openjdk.org/jdk/pull/21137#discussion_r1771673590