perf(evm): batch runtime stack boundary access - #599
Open
ZR74 wants to merge 2 commits into
Open
Conversation
Batch non-lifted block entry loads, depth drops, and exit stores so each boundary updates runtime stack metadata once. Keep full stack SSA unchanged and cover both SSA-on residual paths and SSA-off execution with frontend and differential tests.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves EVM multipass frontend compilation performance by batching runtime-stack loads/stores at basic-block boundaries, reducing repeated address calculations and stack top/size maintenance while preserving existing stack-SSA behavior and external ABI semantics.
Changes:
- Add
EVMMirBuilderbatch stack boundary helpers (peekStackBatch,dropStackBatch,pushStackBatch) and use them in the bytecode visitor’s non-lifted boundary protocol. - Add targeted frontend and differential tests covering empty/1/16/17-slot batches, ordering, and underflow/overflow parity with the interpreter.
- Document the batching contract in compiler module docs and add a validated change proposal entry.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tests/evm_jit_frontend_tests.cpp | Adds mock batch-stack protocol + unit tests for ordering, skip-top semantics, and update-count behavior. |
| src/tests/evm_differential_tests.cpp | Adds differential stress/edge-case coverage to validate boundary batching correctness vs interpreter. |
| src/compiler/evm_frontend/evm_mir_compiler.h | Exposes batch stack APIs on EVMMirBuilder. |
| src/compiler/evm_frontend/evm_mir_compiler.cpp | Implements batched runtime-stack peek/drop/push lowering and single-update top/size maintenance. |
| src/action/evm_bytecode_visitor.h | Switches non-lifted boundary lowering to the batched protocol and uses batched exit materialization. |
| docs/modules/compiler/spec.md | Documents the batched boundary contract and scope/invariants. |
| docs/changes/README.md | Registers the new change proposal entry. |
| docs/changes/2026-07-29-evm-stack-boundary-batch/README.md | Adds the full change proposal with contract, validation, and reproduction details. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use batched runtime-stack access for every non-lifted boundary and remove the experimental build gate and scalar fallback. Full stack SSA continues to take priority.
ZR74
force-pushed
the
codex/stack-boundary-batch
branch
from
August 7, 2026 05:27
6f90e56 to
7a032dd
Compare
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions ✅ Performance Check Passed (multipass)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
EVM multipass frontend runtime-stack boundary lowering, frontend tests, differential tests, and compiler documentation.
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
The multipass frontend previously materialized non-lifted block boundaries with per-slot runtime-stack operations. This repeated address calculations and runtime
top/sizemaintenance for every live value.This PR makes batched boundary access the standard lowering:
peekStackBatch,dropStackBatch, andpushStackBatchoperations;top/sizeonce per batch;There are no changes to
EVMInstance, the EVMC ABI, gas accounting, exception behavior, or dynamic-jump dispatch.Experimental results:
The formal Osaka benchmark used CPU 24, 29 unique code hashes, 12 fresh-process cold rounds, three warmups per variant, and 100 ms hot calibration. Both compile/code-size and hot-execution regression gates passed. The detailed methodology and reproduction commands are documented in
docs/changes/2026-07-29-evm-stack-boundary-batch/README.md.4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
Validation after making batching unconditional:
cmake-format,clang-format -Werror, andgit diff --check: passed.6. Release note