Skip to content

Interpreter improvements: extract opcodes, arrow syntax, simplify LOAD_STRING#275

Merged
fglock merged 1 commit into
masterfrom
improve-croak-error-messages
Mar 6, 2026
Merged

Interpreter improvements: extract opcodes, arrow syntax, simplify LOAD_STRING#275
fglock merged 1 commit into
masterfrom
improve-croak-error-messages

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Mar 6, 2026

Summary

  • Extract 84 opcode handlers from BytecodeInterpreter.execute() into new InlineOpcodeHandler.java, reducing method size from 12007 to 7137 bytes (under 7500 JVM JIT limit)
  • Convert all switch statements to arrow syntax (case X -> {}) for clarity, eliminating break statements
  • Add comments explaining the nested try/catch/finally structure (outer for cleanup, inner for Perl eval/die)
  • Simplify LOAD_STRING and LOAD_BYTE_STRING opcodes — remove redundant cache-check optimization (benchmarked: no measurable difference on ExifTool CanonRaw.t)
  • Add 76 missing opcode mappings to InterpretedCode disassembler
  • Remove dead executeArithmetic() method (326 lines)
  • Improve LOAD_BYTE_STRING javadoc in Opcodes.java
  • Reformat code across the codebase
  • Fix check-bytecode-size.sh for renamed package path
  • Improve parser error messages for croak.t (11→44/330)
  • Fix $# check to allow special array names ($#+, $#-, $#{^CAPTURE})

Test plan

  • ./gradlew classes builds successfully
  • bash dev/tools/check-bytecode-size.sh — all methods under limit
  • ./gradlew classes testUnitParallel --parallel shadowJar — all tests pass
  • Benchmarked LOAD_STRING simplification on ExifTool CanonRaw.t — no regression

Generated with Devin

Remove redundant cache-check optimization that compared the existing
register value before allocating. Benchmarking on ExifTool CanonRaw.t
showed no measurable difference — the String.equals() cost offsets
the saved allocation.

Also improve LOAD_BYTE_STRING javadoc in Opcodes.java.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <noreply@cognition.ai>
@fglock fglock merged commit 1dbb2f3 into master Mar 6, 2026
2 checks passed
@fglock fglock deleted the improve-croak-error-messages branch March 6, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant