On Wed, 2 Oct 2024 11:09:52 GMT, ExE Boss <d...@openjdk.org> wrote: >> A small optimization to the RawBytecodeHelper::next method >> * Remove `len <= 0` once >> * merge store opcode and isWide > > src/java.base/share/classes/jdk/internal/classfile/impl/RawBytecodeHelper.java > line 350: > >> 348: */ >> 349: public boolean isWide() { >> 350: return (opcode & (WIDE << 8)) != 0; > > Suggestion: > > return (opcode >>> 8) == WIDE;
WIDE is a constant, WIDE << 8 will do constant folding, your suggestion will be longer in bytecode. > src/java.base/share/classes/jdk/internal/classfile/impl/RawBytecodeHelper.java > line 449: > >> 447: } >> 448: >> 449: if ((nextBci += len) > end) { > > This change makes it that `nextBci` will no longer monotonically increase in > case of a malformed special instruction. > > Suggestion: > > if (len <= 0 || (nextBci += len) > end) { The checkSpecialInstruction has already added the 'len <= 0' process, so there is no need to check 'len <= '0' again. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21300#discussion_r1784531869 PR Review Comment: https://git.openjdk.org/jdk/pull/21300#discussion_r1784533279