feat(evm): add block-local runtime stack overlay#551
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a block-local runtime stack overlay for the EVM bytecode visitor when ZEN_ENABLE_EVM_STACK_SSA_LIFT is disabled, aiming to reduce per-op stack load/store pressure while preserving correctness across helper/gas/control-flow boundaries. It also refines analyzer metadata to distinguish “JIT entry state materializable” from “stack SSA liftable”, and updates module-level JIT fallback gating accordingly.
Changes:
- Add a block-local runtime-stack overlay to
EVMByteCodeVisitor(SSA-lift-off mode), including lazy stack loads and explicit flush/sync points at runtime-visible boundaries. - Extend the MIR builder with
stackDrop()andhasOpcodeGasMeteringBoundary()to support efficient overlay flushing and safe gas-check boundaries. - Update analyzer metadata (
CanMaterializeJITEntryState) and adjust runtime module fallback checks to only apply deep-entry / dynamic-trampoline gates in SSA-lift mode; add/adjust tests and documentation.
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/action/evm_bytecode_visitor.h | Implements the SSA-off runtime stack overlay, flush/sync logic at boundaries, and integrates gas-boundary syncing. |
| src/compiler/evm_frontend/evm_mir_compiler.h | Adds new builder surface: stackDrop() and hasOpcodeGasMeteringBoundary(). |
| src/compiler/evm_frontend/evm_mir_compiler.cpp | Implements gas-boundary detection and stackDrop() lowering to runtime stack top/size updates. |
| src/compiler/evm_frontend/evm_analyzer.h | Adds CanMaterializeJITEntryState, refactors deep-entry risk detection, and separates materializability from liftability. |
| src/runtime/evm_module.cpp | Gates deep-entry and dynamic-trampoline fallback checks behind ZEN_ENABLE_EVM_STACK_SSA_LIFT. |
| src/tests/evm_jit_frontend_tests.cpp | Updates mocks and adds/adjusts tests to validate overlay behavior and analyzer materializability metadata. |
| docs/modules/compiler/spec.md | Documents SSA-off overlay semantics and how it affects fallback gating. |
| docs/changes/2026-06-23-evm-block-local-overlay/README.md | Adds a Light change proposal documenting motivation, design, and validation pointers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions
|
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):
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
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:
6. Release note