On Tue, 3 Sep 2024 12:17:45 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> A small optimization, optimize the BufferWriter implementation and use of >> ClassFile, provide faster patchInt and skip > > Shaojin Wen has updated the pull request incrementally with one additional > commit since the last revision: > > Update src/java.base/share/classes/jdk/internal/classfile/impl/Util.java > > Co-authored-by: Claes Redestad <claes.redes...@oracle.com> Looks ok, a couple of nits. src/java.base/share/classes/jdk/internal/classfile/impl/BufWriterImpl.java line 197: > 195: grow(nextOffset); > 196: } > 197: this.offset = nextOffset; Let's not duplicate code to get rid of a simple addition Suggestion: reserveSpace(skipSize); this.offset += skipSize; src/java.base/share/classes/jdk/internal/classfile/impl/Util.java line 285: > 283: b.writeBytes(bytecode.array(), 0, > bytecode.limit()); > 284: b.skip(2);//exception handlers > 285: b.skip(2);//attributes Suggestion: b.skip(4); //exception handlers (2) + attributes (2) ------------- PR Review: https://git.openjdk.org/jdk/pull/20780#pullrequestreview-2277250897 PR Review Comment: https://git.openjdk.org/jdk/pull/20780#discussion_r1741955557 PR Review Comment: https://git.openjdk.org/jdk/pull/20780#discussion_r1741948921