Skip to content

Keep AVM.executeTuples under the JIT huge-method limit - #563

Merged
bertysentry merged 1 commit into
mainfrom
562-performance-keep-avm-executetuples-under-the-jit-huge-method-limit
Aug 17, 2026
Merged

Keep AVM.executeTuples under the JIT huge-method limit#563
bertysentry merged 1 commit into
mainfrom
562-performance-keep-avm-executetuples-under-the-jit-huge-method-limit

Conversation

@bertysentry

Copy link
Copy Markdown
Contributor

Fixes #562

Problem

HotSpot never JIT-compiles a method whose bytecode exceeds HugeMethodLimit (8000, default -XX:+DontCompileHugeMethods). AVM.executeTuples — the interpreter dispatch loop — sat at 7994 bytecodes under javac and 8013 under ECJ. Any growth (or simply compiling with Eclipse JDT, as VS Code's Java extension does) crossed the cliff and made every AWK script ~4× slower, silently: no error, no JIT warmup, constant low throughput. This shipped once already via an ECJ-compiled local build (mandelbrot.awk: 40–50 fps → ~7 fps).

Fix

  • Extract the five fattest inline opcode blocks into private exec* helpers (following the file's existing convention): INDIRECT_CALL and the four compound-assignment families (*_EQ, *_EQ_ARRAY, *_EQ_MAP_ELEMENT, *_EQ_INPUT_FIELD). Pure mechanical moves — bodies unchanged, early breaks become returns in execIndirectCall.
  • executeTuples is now 6728 bytecodes (javac) / 6767 (ECJ) — >1200 of headroom under both compilers.
  • New AVMExecuteTuplesSizeTest parses AVM.class (minimal dependency-free class-file reader) and fails the build if executeTuples exceeds 7500 bytecodes, converting the silent cliff into a loud build failure.

Measurements

mandelbrot.awk -v profile=1, 100 frames, WSL2 / Temurin 25, output redirected:

build executeTuples time
before, javac (7994, JIT-compiled) 7994 B 3.16 s
before, ECJ (8013, never compiled) 8013 B 12.96 s
after, javac 6728 B 2.86 s

No user-visible behavior change, so no behavior-changes.md entry.

Verification

mvn clean verify: 769 unit tests pass (2 new), checkstyle/pmd/spotbugs clean, compatibility baseline unchanged.

🤖 Generated with Claude Code

HotSpot never JIT-compiles a method larger than HugeMethodLimit (8000
bytecodes); executeTuples sat at 7994 under javac and 8013 under ECJ,
so depending on the compiler the interpreter loop was silently never
compiled, making every AWK script ~4x slower with no warning.

Extract the five fattest inline opcode blocks (INDIRECT_CALL and the
four compound-assignment families) into private exec* helpers,
following the existing helper convention. executeTuples drops to 6728
bytecodes under javac and 6767 under ECJ.

Add AVMExecuteTuplesSizeTest, which parses AVM.class and fails the
build if executeTuples exceeds 7500 bytecodes, turning this silent
performance cliff into a loud build failure.

Fixes #562

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bertysentry

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: dc2aee1bbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bertysentry
bertysentry merged commit 6eda986 into main Aug 17, 2026
5 checks passed
@bertysentry
bertysentry deleted the 562-performance-keep-avm-executetuples-under-the-jit-huge-method-limit branch August 17, 2026 12:20
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.

Performance: AVM.executeTuples sits 6 bytecodes under HotSpot's HugeMethodLimit — any growth silently disables JIT compilation (4x slowdown)

1 participant