core/vm: port GEVM performance optimisations#2143
Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (66.15%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #2143 +/- ##
===========================================
+ Coverage 51.33% 51.88% +0.55%
===========================================
Files 882 884 +2
Lines 154236 155357 +1121
===========================================
+ Hits 79178 80614 +1436
+ Misses 69908 69528 -380
- Partials 5150 5215 +65
... and 29 files with indirect coverage changes
🚀 New features to boost your workflow:
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
cffls
left a comment
There was a problem hiding this comment.
Looks good overall. The patch coverage is 66%. Any ideas if we can bump it up?
marcello33
left a comment
There was a problem hiding this comment.
LGTM, 2 minor comments
The test coverage for runSwitch is now |
There was a problem hiding this comment.
Pull request overview
Ports GEVM-style EVM execution performance optimizations into core/vm, introducing a fixed-size stack and an optional switch-dispatch fast interpreter, and wires the new toggle through config/CLI so it can be enabled for both block import and block production.
Changes:
- Replace slice-based EVM stack with a fixed-size
[1024]uint256.Int+topcounter and add stack microbenchmarks. - Add a generated
runSwitchinterpreter fast path (behindEnableEVMSwitchDispatch) plus differential tests and a benchmark harness. - Plumb
evm-switch-dispatchthrough CLI/config → eth backend VM config → miner usage.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| miner/worker.go | Uses chain VM config when constructing EVM instances in mining/prefetch paths. |
| internal/cli/server/flags.go | Adds --evm-switch-dispatch CLI flag wired into server config. |
| internal/cli/server/config.go | Adds config field + defaults + wiring into ethconfig. |
| eth/backend.go | Propagates EnableEVMSwitchDispatch into core.BlockChainConfig.VmConfig. |
| docs/cli/server.md | Documents the new CLI flag. |
| docs/cli/default_config.toml | Adds default evm-switch-dispatch = false. |
| core/vm/stack.go | Implements fixed-size stack representation. |
| core/vm/stack_test.go | Adds stack benchmarks for common operations/workloads. |
| core/vm/interpreter.go | Adds EnableEVMSwitchDispatch config and gates fast-path entry. |
| core/vm/interpreter_dispatch.go | Generated switch-dispatch interpreter loop (runSwitch). |
| core/vm/gen_dispatch/main.go | Generator that emits interpreter_dispatch.go. |
| core/vm/gen_dispatch/CLAUDE.md | Internal documentation for generator/fast-path invariants. |
| core/vm/dispatch_test.go | Differential test suite comparing runSwitch vs standard interpreter. |
| core/vm/dispatch_bench_test.go | Benchmark harness using embedded bytecode workload. |
| core/vm/instructions_test.go | Adjusts tests/benchmarks for new stack internals. |
| core/vm/testdata/snailtracer.hex | Embedded benchmark bytecode payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |


Description
[1024]uint256.Intarray stack replacing slice-based stack, eliminating append/slice-header overhead on push/poprunSwitch) with inlined hot opcodes and gas accumulation, gated behind--switch-dispatchflaggen_dispatch/) to produceinterpreter_dispatch.goEnableSwitchDispatchthrough CLI, ethconfig, and blockchain to both block import and block production paths