perf: split BytecodeInterpreter.execute for default C2 compilation
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 重構
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- java
- 領域
- backend, performance
研究方向
Start by reading BytecodeInterpreter.execute(SuspendedInterpreterFrame) and the profiling skill at .agents/skills/profile-perlonjava/SKILL.md; use dev/bench/benchmark_eval_string.pl to reproduce the eval STRING workload. Split the dispatch path while preserving opcode behavior and JVM/interpreter parity, then check HotSpot diagnostics, project tests, and the make gate. Compare randomized paired runs against the exact parent and check representative workloads and startup cost; done means default flags produce effective C2 compilation with a measured improvement and no material regression.
由索引模型根據 Issue 內容生成。
描述
Summary
Split BytecodeInterpreter.execute(SuspendedInterpreterFrame) into smaller dispatch/handler methods so HotSpot's default C2 policy can optimize the eval STRING interpreter path without globally enabling compilation of huge methods.
This is follow-up work to eval performance investigations on master. PR #2059 contains allocation and frame-pooling changes, but its performance effect was small and did not address the dispatch method's JIT compilation limit.
Evidence
On master commit 3e725aa6e1 (Temurin 24.0.2, Apple Silicon), async-profiler sampling of dev/bench/benchmark_eval_string.pl showed BytecodeInterpreter.execute as the largest CPU leaf (199 of 1,694 samples, C1), followed by StatementResolver.parseStatement (59) and CompileAssignment.compileAssignmentOperator (48).
HotSpot compilation diagnostics report the private execute(SuspendedInterpreterFrame) method at 23,790 bytecodes. The default DontCompileHugeMethods policy prevents C2 from optimizing this hot dispatch path; the log also reports it as too large to inline.
As a diagnostic, disabling that policy with -XX:-DontCompileHugeMethods caused the 23,790-byte method to reach C2 level 4. Five randomized default/flag pairs on the same master JAR measured:
| Default | C2 enabled | Speedup |
|---|---|---|
| 52.4k/s | 102.7k/s | 1.96x |
| 60.7k/s | 98.1k/s | 1.62x |
| 65.7k/s | 98.3k/s | 1.50x |
| 71.2k/s | 106.9k/s | 1.50x |
| 73.2k/s | 114.3k/s | 1.56x |
Each run executes one million iterations of dev/bench/benchmark_eval_string.pl. The geometric mean paired gain is about 1.60x. Host load caused variance in both modes; all five pairs favored C2.
Goal
Reduce the dispatch method's bytecode size enough that the normal JVM policy compiles its hot path effectively. Prefer extracting cold opcode families and keeping common eval opcodes on a direct, JIT-friendly path. Keep opcode semantics, exception behavior, interpreter state, and JVM/interpreter parity unchanged.
The global -XX:-DontCompileHugeMethods flag is a measured interim option, but this issue is to determine whether a source-level split can get the same or better result without changing HotSpot's huge-method policy for every method in the process.
Acceptance
- HotSpot diagnostics on supported Java versions show the refactored hot interpreter path gets C2 compilation with default JVM flags.
- Standard Perl behavior and project-owned tests cover affected opcode families; JVM and interpreter backends remain compatible.
- Run the repository
makegate on the immutable candidate. - Compare default-flag performance against the exact parent using randomized paired eval STRING benchmark runs with operation counts/checksums; retain the split only when the paired interval shows a real improvement.
- Check representative non-eval workloads and startup/compilation cost so a faster eval benchmark does not hide a material regression elsewhere.
Related
- PR #2059: https://github.com/fglock/PerlOnJava/pull/2059
- Performance goal #1196: https://github.com/fglock/PerlOnJava/issues/1196
dev/bench/benchmark_eval_string.pl.agents/skills/profile-perlonjava/SKILL.md
- 主要語言
- Perl
- 星號
- 67
- 分支
- 8
- 平均合併
- 5 小時 12 分鐘
- 30 天內合併 PR
- 131
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
fglock/PerlOnJava 的其他 Issue
-
area:cpan-port bug
難度 2/5 1-3 小時 新手友好度 70/100
fglock/PerlOnJava#2153 ·
維護者通常 1 天內回覆
-
area:cpan-port area:parser bug
難度 2/5 1-3 小時 新手友好度 68/100
fglock/PerlOnJava#2137 ·
維護者通常 1 天內回覆
-
area:backend area:cpan-port area:runtime bug
難度 2/5 1-3 小時 新手友好度 76/100
fglock/PerlOnJava#2071 ·
維護者通常 1 天內回覆
-
area:runtime documentation enhancement
難度 2/5 1-3 小時 新手友好度 72/100
fglock/PerlOnJava#1579 ·
維護者通常 1 天內回覆
-
area:cpan-port bug
難度 3/5 1-2 天 新手友好度 62/100
fglock/PerlOnJava#2157 ·
維護者通常 1 天內回覆
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling links未關閉team-cli
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
-
難度 1/5 1 小時以內 新手友好度 93/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 73/100
inverse-inc/packetfence#9728 ·
維護者通常 1 天內回覆
-
fix(char-create): show the real reason a character is refused可能已有人在做 @baphomello 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
維護者通常 1 天內回覆