Skip to content

perf(evm): bypass virtual stack and cache InterpreterExecContext for …#419

Merged
zoowii merged 2 commits intoDTVMStack:mainfrom
starwarfan:perf/bypass-virtual-stack
Apr 2, 2026
Merged

perf(evm): bypass virtual stack and cache InterpreterExecContext for …#419
zoowii merged 2 commits intoDTVMStack:mainfrom
starwarfan:perf/bypass-virtual-stack

Conversation

@starwarfan
Copy link
Copy Markdown
Contributor

…interpreter mode

Interpreter mode manages call depth via InterpreterExecContext::FrameStack and never emits native code, so it does not need the virtual stack's mprotect/setjmp/longjmp round-trip that was designed for JIT stack guard pages. Skip it entirely when Mode == InterpMode.

Additionally, cache the InterpreterExecContext in a thread-local for top-level calls (depth == 0) to avoid re-allocating the ~33 KB EVMFrame on every callEVMInInterpMode invocation. Nested calls (CALL/CREATE re-entering via Host->call()) still create a fresh context for safety.

1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

  • N
  • Y

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):

  • Affects user behaviors
  • Contains CI/CD configuration changes
  • Contains documentation changes
  • Contains experimental features
  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Other

4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

  • N
  • Y

5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

  • Unit test
  • Integration test
  • Benchmark (add benchmark stats below)
  • Manual test (add detailed scripts or steps below)
  • Other

6. Release note

None

…interpreter mode

Interpreter mode manages call depth via InterpreterExecContext::FrameStack
and never emits native code, so it does not need the virtual stack's
mprotect/setjmp/longjmp round-trip that was designed for JIT stack guard
pages. Skip it entirely when Mode == InterpMode.

Additionally, cache the InterpreterExecContext in a thread-local for
top-level calls (depth == 0) to avoid re-allocating the ~33 KB EVMFrame
on every callEVMInInterpMode invocation. Nested calls (CALL/CREATE
re-entering via Host->call()) still create a fresh context for safety.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 19, 2026

⚡ Performance Regression Check Results

✅ Performance Check Passed (interpreter)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.70 1.76 +3.4% PASS
total/main/blake2b_huff/empty 0.03 0.03 +3.2% PASS
total/main/blake2b_shifts/8415nulls 12.87 12.80 -0.5% PASS
total/main/sha1_divs/5311 5.73 5.73 -0.1% PASS
total/main/sha1_divs/empty 0.07 0.07 +0.6% PASS
total/main/sha1_shifts/5311 3.24 3.25 +0.3% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.5% PASS
total/main/snailtracer/benchmark 53.88 53.72 -0.3% PASS
total/main/structarray_alloc/nfts_rank 1.09 1.10 +0.6% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -0.6% PASS
total/main/swap_math/received 0.01 0.01 -0.4% PASS
total/main/swap_math/spent 0.00 0.00 -1.5% PASS
total/main/weierstrudel/1 0.29 0.29 -0.5% PASS
total/main/weierstrudel/15 3.36 3.33 -0.6% PASS
total/micro/JUMPDEST_n0/empty 1.63 1.62 -0.1% PASS
total/micro/jump_around/empty 0.06 0.06 -0.8% PASS
total/micro/loop_with_many_jumpdests/empty 22.71 25.31 +11.5% PASS
total/micro/memory_grow_mload/by1 0.10 0.10 +1.4% PASS
total/micro/memory_grow_mload/by16 0.11 0.11 -1.5% PASS
total/micro/memory_grow_mload/by32 0.12 0.12 -0.2% PASS
total/micro/memory_grow_mload/nogrow 0.10 0.10 -6.4% PASS
total/micro/memory_grow_mstore/by1 0.10 0.11 +1.6% PASS
total/micro/memory_grow_mstore/by16 0.12 0.12 +0.3% PASS
total/micro/memory_grow_mstore/by32 0.13 0.13 +0.3% PASS
total/micro/memory_grow_mstore/nogrow 0.11 0.11 -0.8% PASS
total/micro/signextend/one 0.26 0.25 -1.6% PASS
total/micro/signextend/zero 0.25 0.24 -3.1% PASS
total/synth/ADD/b0 2.19 2.20 +0.1% PASS
total/synth/ADD/b1 2.29 2.28 -0.4% PASS
total/synth/ADDRESS/a0 5.47 5.46 -0.1% PASS
total/synth/ADDRESS/a1 5.97 6.09 +2.1% PASS
total/synth/AND/b0 1.86 1.86 +0.1% PASS
total/synth/AND/b1 1.88 1.87 -0.3% PASS
total/synth/BYTE/b0 6.79 6.79 -0.1% PASS
total/synth/BYTE/b1 5.39 5.38 -0.3% PASS
total/synth/CALLDATASIZE/a0 3.36 3.35 -0.3% PASS
total/synth/CALLDATASIZE/a1 4.00 3.61 -9.8% PASS
total/synth/CALLER/a0 5.44 5.45 +0.2% PASS
total/synth/CALLER/a1 6.08 6.08 -0.1% PASS
total/synth/CALLVALUE/a0 3.74 3.74 +0.2% PASS
total/synth/CALLVALUE/a1 3.65 3.54 -2.8% PASS
total/synth/CODESIZE/a0 3.84 3.80 -1.1% PASS
total/synth/CODESIZE/a1 4.05 3.85 -5.0% PASS
total/synth/DUP1/d0 1.48 1.57 +5.9% PASS
total/synth/DUP1/d1 1.58 1.57 -0.3% PASS
total/synth/DUP10/d0 1.48 1.48 +0.0% PASS
total/synth/DUP10/d1 1.57 1.57 -0.1% PASS
total/synth/DUP11/d0 1.48 1.47 -0.5% PASS
total/synth/DUP11/d1 1.32 1.30 -1.5% PASS
total/synth/DUP12/d0 1.55 1.57 +1.3% PASS
total/synth/DUP12/d1 1.58 1.57 -0.3% PASS
total/synth/DUP13/d0 1.56 1.56 -0.4% PASS
total/synth/DUP13/d1 1.31 1.30 -0.4% PASS
total/synth/DUP14/d0 1.47 1.48 +0.3% PASS
total/synth/DUP14/d1 1.58 1.57 -0.3% PASS
total/synth/DUP15/d0 1.49 1.56 +5.3% PASS
total/synth/DUP15/d1 1.58 1.57 -0.3% PASS
total/synth/DUP16/d0 1.56 1.47 -6.0% PASS
total/synth/DUP16/d1 1.30 1.30 -0.4% PASS
total/synth/DUP2/d0 1.57 1.47 -5.9% PASS
total/synth/DUP2/d1 1.57 1.30 -17.7% PASS
total/synth/DUP3/d0 1.57 1.47 -5.9% PASS
total/synth/DUP3/d1 1.58 1.30 -17.8% PASS
total/synth/DUP4/d0 1.57 1.55 -1.0% PASS
total/synth/DUP4/d1 1.32 1.30 -1.9% PASS
total/synth/DUP5/d0 1.57 1.57 -0.0% PASS
total/synth/DUP5/d1 1.57 1.30 -17.6% PASS
total/synth/DUP6/d0 1.57 1.44 -7.9% PASS
total/synth/DUP6/d1 1.57 1.30 -17.7% PASS
total/synth/DUP7/d0 1.48 1.56 +5.7% PASS
total/synth/DUP7/d1 1.30 1.57 +20.7% PASS
total/synth/DUP8/d0 1.57 1.57 -0.2% PASS
total/synth/DUP8/d1 1.58 1.57 -0.3% PASS
total/synth/DUP9/d0 1.57 1.57 +0.2% PASS
total/synth/DUP9/d1 1.57 1.30 -17.6% PASS
total/synth/EQ/b0 3.12 3.12 +0.0% PASS
total/synth/EQ/b1 1.48 1.47 -0.6% PASS
total/synth/GAS/a0 3.78 3.48 -7.8% PASS
total/synth/GAS/a1 3.96 3.82 -3.6% PASS
total/synth/GT/b0 3.03 3.03 +0.2% PASS
total/synth/GT/b1 1.49 1.48 -0.8% PASS
total/synth/ISZERO/u0 0.96 0.96 +0.2% PASS
total/synth/JUMPDEST/n0 1.66 1.65 -0.6% PASS
total/synth/LT/b0 3.04 3.04 -0.0% PASS
total/synth/LT/b1 1.49 1.48 -0.8% PASS
total/synth/MSIZE/a0 4.78 4.78 +0.0% PASS
total/synth/MSIZE/a1 5.45 5.17 -5.0% PASS
total/synth/MUL/b0 6.19 6.19 -0.0% PASS
total/synth/MUL/b1 6.17 6.17 -0.1% PASS
total/synth/NOT/u0 1.84 1.83 -0.3% PASS
total/synth/OR/b0 1.87 1.87 -0.1% PASS
total/synth/OR/b1 1.88 1.87 -0.6% PASS
total/synth/PC/a0 3.26 3.23 -0.9% PASS
total/synth/PC/a1 3.93 3.75 -4.7% PASS
total/synth/PUSH1/p0 1.11 1.02 -8.3% PASS
total/synth/PUSH1/p1 1.20 1.47 +22.6% PASS
total/synth/PUSH10/p0 1.04 1.11 +6.8% PASS
total/synth/PUSH10/p1 1.49 1.21 -18.9% PASS
total/synth/PUSH11/p0 1.30 1.02 -21.5% PASS
total/synth/PUSH11/p1 1.48 1.47 -0.8% PASS
total/synth/PUSH12/p0 1.11 1.11 -0.4% PASS
total/synth/PUSH12/p1 1.47 1.26 -14.4% PASS
total/synth/PUSH13/p0 1.02 0.89 -12.6% PASS
total/synth/PUSH13/p1 1.48 1.47 -1.1% PASS
total/synth/PUSH14/p0 1.39 1.11 -20.0% PASS
total/synth/PUSH14/p1 1.48 1.50 +1.1% PASS
total/synth/PUSH15/p0 1.11 1.11 -0.0% PASS
total/synth/PUSH15/p1 1.50 1.60 +6.4% PASS
total/synth/PUSH16/p0 1.02 1.29 +26.8% PASS
total/synth/PUSH16/p1 1.48 1.51 +1.8% PASS
total/synth/PUSH17/p0 0.94 1.38 +46.7% PASS
total/synth/PUSH17/p1 1.48 1.47 -0.6% PASS
total/synth/PUSH18/p0 1.02 1.02 -0.1% PASS
total/synth/PUSH18/p1 1.23 1.22 -0.3% PASS
total/synth/PUSH19/p0 1.12 1.39 +23.5% PASS
total/synth/PUSH19/p1 1.49 1.23 -17.0% PASS
total/synth/PUSH2/p0 1.02 1.38 +36.1% PASS
total/synth/PUSH2/p1 1.19 1.47 +23.6% PASS
total/synth/PUSH20/p0 1.12 1.29 +15.9% PASS
total/synth/PUSH20/p1 1.48 1.48 +0.1% PASS
total/synth/PUSH21/p0 1.11 1.11 -0.0% PASS
total/synth/PUSH21/p1 1.21 1.47 +21.5% PASS
total/synth/PUSH22/p0 1.11 1.11 -0.2% PASS
total/synth/PUSH22/p1 1.49 1.48 -0.7% PASS
total/synth/PUSH23/p0 1.11 1.02 -8.2% PASS
total/synth/PUSH23/p1 1.48 1.49 +0.4% PASS
total/synth/PUSH24/p0 1.11 1.11 -0.1% PASS
total/synth/PUSH24/p1 1.49 1.51 +1.3% PASS
total/synth/PUSH25/p0 1.02 1.39 +35.4% PASS
total/synth/PUSH25/p1 1.27 1.49 +16.9% PASS
total/synth/PUSH26/p0 1.02 1.29 +27.1% PASS
total/synth/PUSH26/p1 1.49 1.50 +0.2% PASS
total/synth/PUSH27/p0 1.11 0.93 -16.2% PASS
total/synth/PUSH27/p1 1.48 1.51 +1.6% PASS
total/synth/PUSH28/p0 1.02 1.02 -0.1% PASS
total/synth/PUSH28/p1 1.49 1.49 -0.0% PASS
total/synth/PUSH29/p0 1.02 0.93 -8.6% PASS
total/synth/PUSH29/p1 1.49 1.24 -16.8% PASS
total/synth/PUSH3/p0 1.11 1.29 +16.5% PASS
total/synth/PUSH3/p1 1.48 1.20 -18.5% PASS
total/synth/PUSH30/p0 1.12 1.39 +23.9% PASS
total/synth/PUSH30/p1 1.49 1.27 -15.0% PASS
total/synth/PUSH31/p0 1.38 1.02 -26.4% PASS
total/synth/PUSH31/p1 1.55 1.54 -1.0% PASS
total/synth/PUSH32/p0 1.02 1.02 +0.4% PASS
total/synth/PUSH32/p1 1.50 1.52 +1.3% PASS
total/synth/PUSH4/p0 1.02 0.91 -10.5% PASS
total/synth/PUSH4/p1 1.47 1.47 -0.2% PASS
total/synth/PUSH5/p0 1.03 1.11 +7.4% PASS
total/synth/PUSH5/p1 1.47 1.47 -0.2% PASS
total/synth/PUSH6/p0 1.11 1.31 +17.4% PASS
total/synth/PUSH6/p1 1.47 1.47 -0.4% PASS
total/synth/PUSH7/p0 1.02 1.11 +8.5% PASS
total/synth/PUSH7/p1 1.48 1.48 -0.3% PASS
total/synth/PUSH8/p0 1.11 1.11 +0.0% PASS
total/synth/PUSH8/p1 1.49 1.48 -0.4% PASS
total/synth/PUSH9/p0 1.11 1.11 -0.1% PASS
total/synth/PUSH9/p1 1.22 1.48 +21.2% PASS
total/synth/RETURNDATASIZE/a0 3.77 3.86 +2.4% PASS
total/synth/RETURNDATASIZE/a1 4.19 3.89 -7.2% PASS
total/synth/SAR/b0 4.34 4.37 +0.5% PASS
total/synth/SAR/b1 4.86 4.82 -0.8% PASS
total/synth/SGT/b0 3.01 3.01 +0.0% PASS
total/synth/SGT/b1 1.49 1.48 -0.5% PASS
total/synth/SHL/b0 3.50 3.50 -0.0% PASS
total/synth/SHL/b1 1.68 1.67 -0.2% PASS
total/synth/SHR/b0 3.51 3.51 +0.0% PASS
total/synth/SHR/b1 1.67 1.66 -0.7% PASS
total/synth/SIGNEXTEND/b0 3.77 3.77 -0.0% PASS
total/synth/SIGNEXTEND/b1 3.52 3.52 +0.0% PASS
total/synth/SLT/b0 3.07 3.08 +0.1% PASS
total/synth/SLT/b1 1.49 1.48 -0.2% PASS
total/synth/SUB/b0 2.20 2.20 +0.2% PASS
total/synth/SUB/b1 2.29 2.28 -0.2% PASS
total/synth/SWAP1/s0 1.71 1.67 -2.2% PASS
total/synth/SWAP10/s0 1.69 1.69 -0.2% PASS
total/synth/SWAP11/s0 1.69 1.69 -0.1% PASS
total/synth/SWAP12/s0 1.69 1.69 -0.1% PASS
total/synth/SWAP13/s0 1.69 1.69 -0.2% PASS
total/synth/SWAP14/s0 1.69 1.69 +0.0% PASS
total/synth/SWAP15/s0 1.69 1.69 -0.1% PASS
total/synth/SWAP16/s0 1.69 1.70 +0.1% PASS
total/synth/SWAP2/s0 1.72 1.67 -2.7% PASS
total/synth/SWAP3/s0 1.67 1.70 +1.7% PASS
total/synth/SWAP4/s0 1.67 1.67 +0.0% PASS
total/synth/SWAP5/s0 1.67 1.67 +0.0% PASS
total/synth/SWAP6/s0 1.68 1.68 -0.2% PASS
total/synth/SWAP7/s0 1.68 1.68 -0.0% PASS
total/synth/SWAP8/s0 1.68 1.68 -0.1% PASS
total/synth/SWAP9/s0 1.69 1.69 +0.2% PASS
total/synth/XOR/b0 1.74 1.74 +0.0% PASS
total/synth/XOR/b1 1.75 1.75 -0.2% PASS
total/synth/loop_v1 4.62 4.54 -1.7% PASS
total/synth/loop_v2 4.53 4.54 +0.1% PASS

Summary: 194 benchmarks, 0 regressions


✅ Performance Check Passed (multipass)

Performance Benchmark Results (threshold: 25%)

Benchmark Baseline (us) Current (us) Change Status
total/main/blake2b_huff/8415nulls 1.55 1.57 +1.7% PASS
total/main/blake2b_huff/empty 0.07 0.07 -1.1% PASS
total/main/blake2b_shifts/8415nulls 5.25 5.17 -1.5% PASS
total/main/sha1_divs/5311 1.90 1.89 -0.1% PASS
total/main/sha1_divs/empty 0.03 0.03 -0.2% PASS
total/main/sha1_shifts/5311 2.76 2.77 +0.3% PASS
total/main/sha1_shifts/empty 0.04 0.04 -0.0% PASS
total/main/snailtracer/benchmark 53.16 53.17 +0.0% PASS
total/main/structarray_alloc/nfts_rank 0.29 0.29 -0.6% PASS
total/main/swap_math/insufficient_liquidity 0.02 0.02 +0.3% PASS
total/main/swap_math/received 0.02 0.02 +0.9% PASS
total/main/swap_math/spent 0.02 0.02 +0.4% PASS
total/main/weierstrudel/1 0.35 0.34 -1.0% PASS
total/main/weierstrudel/15 3.19 3.20 +0.3% PASS
total/micro/JUMPDEST_n0/empty 0.13 0.13 +0.7% PASS
total/micro/jump_around/empty 0.62 0.63 +2.3% PASS
total/micro/loop_with_many_jumpdests/empty 1.96 1.97 +0.2% PASS
total/micro/memory_grow_mload/by1 0.18 0.18 -1.7% PASS
total/micro/memory_grow_mload/by16 0.19 0.18 -2.5% PASS
total/micro/memory_grow_mload/by32 0.20 0.20 -1.8% PASS
total/micro/memory_grow_mload/nogrow 0.18 0.17 -1.4% PASS
total/micro/memory_grow_mstore/by1 0.21 0.19 -9.6% PASS
total/micro/memory_grow_mstore/by16 0.20 0.19 -2.7% PASS
total/micro/memory_grow_mstore/by32 0.21 0.20 -3.7% PASS
total/micro/memory_grow_mstore/nogrow 0.18 0.18 +0.5% PASS
total/micro/signextend/one 0.38 0.34 -9.4% PASS
total/micro/signextend/zero 0.38 0.34 -10.8% PASS
total/synth/ADD/b0 0.01 0.01 +1.6% PASS
total/synth/ADD/b1 0.01 0.01 +0.5% PASS
total/synth/ADDRESS/a0 0.16 0.16 +0.2% PASS
total/synth/ADDRESS/a1 0.16 0.16 +0.0% PASS
total/synth/AND/b0 0.01 0.01 +2.0% PASS
total/synth/AND/b1 0.01 0.01 +0.5% PASS
total/synth/BYTE/b0 1.96 1.96 -0.0% PASS
total/synth/BYTE/b1 2.35 2.35 -0.1% PASS
total/synth/CALLDATASIZE/a0 0.08 0.08 +0.2% PASS
total/synth/CALLDATASIZE/a1 0.08 0.08 +0.5% PASS
total/synth/CALLER/a0 0.16 0.16 -0.0% PASS
total/synth/CALLER/a1 0.16 0.16 +0.1% PASS
total/synth/CALLVALUE/a0 0.27 0.28 +0.5% PASS
total/synth/CALLVALUE/a1 0.28 0.28 +0.3% PASS
total/synth/CODESIZE/a0 0.08 0.08 +0.1% PASS
total/synth/CODESIZE/a1 0.08 0.08 -0.2% PASS
total/synth/DUP1/d0 0.01 0.01 +2.0% PASS
total/synth/DUP1/d1 0.01 0.01 +0.5% PASS
total/synth/DUP10/d0 0.01 0.01 +0.8% PASS
total/synth/DUP10/d1 0.01 0.01 +0.6% PASS
total/synth/DUP11/d0 0.01 0.01 +0.6% PASS
total/synth/DUP11/d1 0.01 0.01 +0.4% PASS
total/synth/DUP12/d0 0.01 0.01 +0.6% PASS
total/synth/DUP12/d1 0.01 0.01 +0.8% PASS
total/synth/DUP13/d0 0.01 0.01 +0.6% PASS
total/synth/DUP13/d1 0.01 0.01 +0.5% PASS
total/synth/DUP14/d0 0.01 0.01 +0.6% PASS
total/synth/DUP14/d1 0.01 0.01 +0.5% PASS
total/synth/DUP15/d0 0.01 0.01 +0.5% PASS
total/synth/DUP15/d1 0.01 0.01 +0.6% PASS
total/synth/DUP16/d0 0.01 0.01 +0.7% PASS
total/synth/DUP16/d1 0.01 0.01 +0.6% PASS
total/synth/DUP2/d0 0.01 0.01 +1.6% PASS
total/synth/DUP2/d1 0.01 0.01 +0.6% PASS
total/synth/DUP3/d0 0.01 0.01 +0.4% PASS
total/synth/DUP3/d1 0.01 0.01 +0.5% PASS
total/synth/DUP4/d0 0.01 0.01 +0.5% PASS
total/synth/DUP4/d1 0.01 0.01 +0.6% PASS
total/synth/DUP5/d0 0.01 0.01 +0.5% PASS
total/synth/DUP5/d1 0.01 0.01 +0.5% PASS
total/synth/DUP6/d0 0.01 0.01 +0.7% PASS
total/synth/DUP6/d1 0.01 0.01 +0.5% PASS
total/synth/DUP7/d0 0.01 0.01 +0.7% PASS
total/synth/DUP7/d1 0.01 0.01 +0.7% PASS
total/synth/DUP8/d0 0.01 0.01 +0.5% PASS
total/synth/DUP8/d1 0.01 0.01 +0.4% PASS
total/synth/DUP9/d0 0.01 0.01 +0.5% PASS
total/synth/DUP9/d1 0.01 0.01 +0.5% PASS
total/synth/EQ/b0 0.01 0.01 +2.2% PASS
total/synth/EQ/b1 0.01 0.01 +0.6% PASS
total/synth/GAS/a0 0.80 0.80 +0.0% PASS
total/synth/GAS/a1 0.76 0.76 +0.1% PASS
total/synth/GT/b0 0.01 0.01 +1.9% PASS
total/synth/GT/b1 0.01 0.01 +0.8% PASS
total/synth/ISZERO/u0 0.01 0.01 +0.5% PASS
total/synth/JUMPDEST/n0 0.13 0.13 -0.0% PASS
total/synth/LT/b0 0.01 0.01 +1.6% PASS
total/synth/LT/b1 0.01 0.01 +0.2% PASS
total/synth/MSIZE/a0 0.01 0.01 +0.5% PASS
total/synth/MSIZE/a1 0.01 0.01 +0.5% PASS
total/synth/MUL/b0 0.01 0.01 +1.5% PASS
total/synth/MUL/b1 0.01 0.01 +0.5% PASS
total/synth/NOT/u0 0.01 0.01 +0.7% PASS
total/synth/OR/b0 0.01 0.01 +1.6% PASS
total/synth/OR/b1 0.01 0.01 +0.5% PASS
total/synth/PC/a0 0.01 0.01 +0.6% PASS
total/synth/PC/a1 0.01 0.01 +0.5% PASS
total/synth/PUSH1/p0 0.01 0.02 +53.7% PASS
total/synth/PUSH1/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH10/p0 0.01 0.02 +51.2% PASS
total/synth/PUSH10/p1 0.01 0.01 +0.3% PASS
total/synth/PUSH11/p0 0.01 0.02 +59.5% PASS
total/synth/PUSH11/p1 0.01 0.01 +0.7% PASS
total/synth/PUSH12/p0 0.01 0.02 +54.1% PASS
total/synth/PUSH12/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH13/p0 0.01 0.02 +58.0% PASS
total/synth/PUSH13/p1 0.01 0.01 +0.4% PASS
total/synth/PUSH14/p0 0.01 0.02 +56.7% PASS
total/synth/PUSH14/p1 0.01 0.01 +0.2% PASS
total/synth/PUSH15/p0 0.01 0.02 +55.6% PASS
total/synth/PUSH15/p1 0.01 0.01 +0.2% PASS
total/synth/PUSH16/p0 0.01 0.02 +54.5% PASS
total/synth/PUSH16/p1 0.01 0.01 +0.4% PASS
total/synth/PUSH17/p0 0.01 0.02 +58.8% PASS
total/synth/PUSH17/p1 0.01 0.01 +0.4% PASS
total/synth/PUSH18/p0 0.01 0.02 +57.5% PASS
total/synth/PUSH18/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH19/p0 0.01 0.02 +58.1% PASS
total/synth/PUSH19/p1 0.01 0.01 +0.2% PASS
total/synth/PUSH2/p0 0.01 0.02 +52.7% PASS
total/synth/PUSH2/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH20/p0 0.01 0.02 +58.4% PASS
total/synth/PUSH20/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH21/p0 0.01 0.02 +56.8% PASS
total/synth/PUSH21/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH22/p0 1.16 1.16 -0.1% PASS
total/synth/PUSH22/p1 1.44 1.46 +1.2% PASS
total/synth/PUSH23/p0 1.08 1.16 +6.9% PASS
total/synth/PUSH23/p1 1.44 1.44 -0.1% PASS
total/synth/PUSH24/p0 1.01 1.16 +15.0% PASS
total/synth/PUSH24/p1 1.46 1.44 -1.0% PASS
total/synth/PUSH25/p0 1.00 0.94 -6.1% PASS
total/synth/PUSH25/p1 1.44 1.47 +2.1% PASS
total/synth/PUSH26/p0 1.12 0.85 -24.2% PASS
total/synth/PUSH26/p1 1.45 1.46 +0.8% PASS
total/synth/PUSH27/p0 1.07 1.16 +8.1% PASS
total/synth/PUSH27/p1 1.44 1.45 +0.4% PASS
total/synth/PUSH28/p0 1.16 1.16 -0.1% PASS
total/synth/PUSH28/p1 1.45 1.46 +0.8% PASS
total/synth/PUSH29/p0 1.13 1.16 +2.7% PASS
total/synth/PUSH29/p1 1.46 1.44 -1.4% PASS
total/synth/PUSH3/p0 0.01 0.02 +52.4% PASS
total/synth/PUSH3/p1 0.01 0.01 +0.2% PASS
total/synth/PUSH30/p0 1.08 1.17 +7.6% PASS
total/synth/PUSH30/p1 1.46 1.46 +0.2% PASS
total/synth/PUSH31/p0 1.15 1.16 +0.9% PASS
total/synth/PUSH31/p1 1.54 1.57 +1.4% PASS
total/synth/PUSH32/p0 1.12 0.85 -24.0% PASS
total/synth/PUSH32/p1 1.45 1.46 +0.8% PASS
total/synth/PUSH4/p0 0.01 0.02 +54.7% PASS
total/synth/PUSH4/p1 0.01 0.01 +0.8% PASS
total/synth/PUSH5/p0 0.01 0.02 +51.3% PASS
total/synth/PUSH5/p1 0.01 0.01 +0.7% PASS
total/synth/PUSH6/p0 0.01 0.02 +51.8% PASS
total/synth/PUSH6/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH7/p0 0.01 0.02 +51.6% PASS
total/synth/PUSH7/p1 0.01 0.01 +0.5% PASS
total/synth/PUSH8/p0 0.01 0.02 +54.5% PASS
total/synth/PUSH8/p1 0.01 0.01 +0.6% PASS
total/synth/PUSH9/p0 0.01 0.02 +54.9% PASS
total/synth/PUSH9/p1 0.01 0.01 +0.5% PASS
total/synth/RETURNDATASIZE/a0 0.53 0.53 +0.2% PASS
total/synth/RETURNDATASIZE/a1 0.49 0.49 +0.1% PASS
total/synth/SAR/b0 3.80 3.81 +0.1% PASS
total/synth/SAR/b1 4.33 4.32 -0.3% PASS
total/synth/SGT/b0 0.01 0.01 +1.6% PASS
total/synth/SGT/b1 0.01 0.01 +0.7% PASS
total/synth/SHL/b0 3.05 3.05 -0.2% PASS
total/synth/SHL/b1 1.63 1.64 +0.7% PASS
total/synth/SHR/b0 2.95 2.94 -0.0% PASS
total/synth/SHR/b1 1.64 1.64 +0.3% PASS
total/synth/SIGNEXTEND/b0 3.75 3.35 -10.6% PASS
total/synth/SIGNEXTEND/b1 3.98 3.50 -12.1% PASS
total/synth/SLT/b0 0.01 0.01 +1.9% PASS
total/synth/SLT/b1 0.01 0.01 +0.8% PASS
total/synth/SUB/b0 0.01 0.01 +1.8% PASS
total/synth/SUB/b1 0.01 0.01 +0.5% PASS
total/synth/SWAP1/s0 0.01 0.01 +1.0% PASS
total/synth/SWAP10/s0 0.01 0.01 +0.8% PASS
total/synth/SWAP11/s0 0.01 0.01 +0.8% PASS
total/synth/SWAP12/s0 0.01 0.01 +0.7% PASS
total/synth/SWAP13/s0 0.01 0.01 +0.8% PASS
total/synth/SWAP14/s0 0.01 0.01 +0.6% PASS
total/synth/SWAP15/s0 0.01 0.01 +0.7% PASS
total/synth/SWAP16/s0 0.01 0.01 +0.9% PASS
total/synth/SWAP2/s0 0.01 0.01 +0.5% PASS
total/synth/SWAP3/s0 0.01 0.01 -4.4% PASS
total/synth/SWAP4/s0 0.01 0.01 +0.8% PASS
total/synth/SWAP5/s0 0.01 0.01 +0.9% PASS
total/synth/SWAP6/s0 0.01 0.01 +0.8% PASS
total/synth/SWAP7/s0 0.01 0.01 +0.6% PASS
total/synth/SWAP8/s0 0.01 0.01 +0.7% PASS
total/synth/SWAP9/s0 0.01 0.01 +0.5% PASS
total/synth/XOR/b0 0.01 0.01 +1.8% PASS
total/synth/XOR/b1 0.01 0.01 +0.4% PASS
total/synth/loop_v1 1.39 1.45 +4.2% PASS
total/synth/loop_v2 1.32 1.37 +3.2% PASS

Summary: 194 benchmarks, 0 regressions


Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes EVM execution in interpreter mode by removing virtual-stack overhead and reusing interpreter execution context for top-level calls to reduce per-call allocations.

Changes:

  • Cache evm::InterpreterExecContext in thread-local storage for top-level interpreter calls to avoid repeated allocation of the large EVMFrame.
  • Bypass ZEN_ENABLE_VIRTUAL_STACK handling when RunMode::InterpMode is active, executing directly on the physical stack.
  • Add explanatory comments and performance rationale for interpreter-mode behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime/runtime.cpp Outdated
Comment thread src/runtime/runtime.cpp Outdated
Comment thread src/runtime/runtime.cpp Outdated
…ization

- Use RAII guard for TLCtxInUse flag to ensure exception safety
- Replace raw pointer with std::unique_ptr for thread-local context
- Fix misleading comment about FrameStack depth management

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zoowii zoowii merged commit 798fe7d into DTVMStack:main Apr 2, 2026
16 checks passed
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.

3 participants