Skip to content

fix(evm): prevent C++ exception from crossing JIT frames in check mode#504

Merged
zoowii merged 3 commits into
DTVMStack:mainfrom
cmgCr:cmgCr/fix_jit_check
May 15, 2026
Merged

fix(evm): prevent C++ exception from crossing JIT frames in check mode#504
zoowii merged 3 commits into
DTVMStack:mainfrom
cmgCr:cmgCr/fix_jit_check

Conversation

@cmgCr
Copy link
Copy Markdown
Contributor

@cmgCr cmgCr commented May 14, 2026

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 14, 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 2.59 2.60 +0.1% PASS
total/main/blake2b_huff/empty 0.04 0.04 -0.2% PASS
total/main/blake2b_shifts/8415nulls 20.76 20.90 +0.7% PASS
total/main/sha1_divs/5311 8.58 8.67 +1.0% PASS
total/main/sha1_divs/empty 0.11 0.11 +0.5% PASS
total/main/sha1_shifts/5311 6.36 6.36 +0.1% PASS
total/main/sha1_shifts/empty 0.08 0.08 +0.1% PASS
total/main/snailtracer/benchmark 75.31 75.25 -0.1% PASS
total/main/structarray_alloc/nfts_rank 1.40 1.43 +2.1% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 +0.9% PASS
total/main/swap_math/received 0.01 0.01 +1.0% PASS
total/main/swap_math/spent 0.01 0.01 +1.1% PASS
total/main/weierstrudel/1 0.29 0.29 +0.1% PASS
total/main/weierstrudel/15 3.22 3.23 +0.4% PASS
total/micro/JUMPDEST_n0/empty 2.85 2.85 +0.1% PASS
total/micro/jump_around/empty 0.10 0.09 -1.6% PASS
total/micro/loop_with_many_jumpdests/empty 43.50 43.59 +0.2% PASS
total/micro/memory_grow_mload/by1 0.13 0.13 +3.1% PASS
total/micro/memory_grow_mload/by16 0.13 0.13 +0.5% PASS
total/micro/memory_grow_mload/by32 0.14 0.15 +5.2% PASS
total/micro/memory_grow_mload/nogrow 0.12 0.13 +6.3% PASS
total/micro/memory_grow_mstore/by1 0.12 0.12 +0.4% PASS
total/micro/memory_grow_mstore/by16 0.13 0.14 +1.1% PASS
total/micro/memory_grow_mstore/by32 0.15 0.15 +0.7% PASS
total/micro/memory_grow_mstore/nogrow 0.12 0.12 +0.2% PASS
total/micro/signextend/one 0.28 0.28 -0.0% PASS
total/micro/signextend/zero 0.28 0.28 +0.0% PASS
total/synth/ADD/b0 3.19 3.19 +0.1% PASS
total/synth/ADD/b1 3.79 3.60 -5.3% PASS
total/synth/ADDRESS/a0 4.88 4.88 -0.0% PASS
total/synth/ADDRESS/a1 5.35 5.36 +0.3% PASS
total/synth/AND/b0 3.10 3.11 +0.0% PASS
total/synth/AND/b1 3.61 3.50 -3.0% PASS
total/synth/BYTE/b0 6.19 6.19 -0.0% PASS
total/synth/BYTE/b1 5.12 5.15 +0.6% PASS
total/synth/CALLDATASIZE/a0 3.51 3.51 +0.0% PASS
total/synth/CALLDATASIZE/a1 3.56 3.57 +0.3% PASS
total/synth/CALLER/a0 4.81 4.81 +0.0% PASS
total/synth/CALLER/a1 5.33 5.34 +0.2% PASS
total/synth/CALLVALUE/a0 3.75 3.75 +0.0% PASS
total/synth/CALLVALUE/a1 3.76 3.77 +0.3% PASS
total/synth/CODESIZE/a0 4.00 4.00 +0.1% PASS
total/synth/CODESIZE/a1 4.01 4.03 +0.6% PASS
total/synth/DUP1/d0 1.39 1.39 -0.0% PASS
total/synth/DUP1/d1 1.76 1.77 +0.4% PASS
total/synth/DUP10/d0 1.39 1.15 -17.2% PASS
total/synth/DUP10/d1 1.73 1.74 +0.6% PASS
total/synth/DUP11/d0 1.39 1.39 +0.0% PASS
total/synth/DUP11/d1 1.73 1.74 +0.7% PASS
total/synth/DUP12/d0 1.39 1.39 +0.1% PASS
total/synth/DUP12/d1 1.74 1.74 +0.3% PASS
total/synth/DUP13/d0 1.39 1.39 +0.0% PASS
total/synth/DUP13/d1 1.73 1.74 +0.7% PASS
total/synth/DUP14/d0 1.39 1.39 +0.0% PASS
total/synth/DUP14/d1 1.73 1.74 +0.3% PASS
total/synth/DUP15/d0 1.39 1.39 -0.0% PASS
total/synth/DUP15/d1 1.73 1.74 +0.5% PASS
total/synth/DUP16/d0 1.16 1.39 +20.4% PASS
total/synth/DUP16/d1 1.73 1.74 +0.3% PASS
total/synth/DUP2/d0 1.39 1.39 +0.0% PASS
total/synth/DUP2/d1 1.73 1.74 +0.4% PASS
total/synth/DUP3/d0 1.39 1.39 +0.1% PASS
total/synth/DUP3/d1 1.73 1.74 +0.2% PASS
total/synth/DUP4/d0 1.39 1.39 -0.1% PASS
total/synth/DUP4/d1 1.73 1.74 +0.5% PASS
total/synth/DUP5/d0 1.39 1.39 -0.0% PASS
total/synth/DUP5/d1 1.73 1.74 +0.5% PASS
total/synth/DUP6/d0 1.39 1.39 -0.0% PASS
total/synth/DUP6/d1 1.73 1.74 +0.3% PASS
total/synth/DUP7/d0 1.15 1.39 +20.9% PASS
total/synth/DUP7/d1 1.73 1.74 +0.6% PASS
total/synth/DUP8/d0 1.39 1.39 -0.1% PASS
total/synth/DUP8/d1 1.73 1.74 +0.3% PASS
total/synth/DUP9/d0 1.39 1.39 -0.1% PASS
total/synth/DUP9/d1 1.73 1.74 +0.6% PASS
total/synth/EQ/b0 5.38 5.38 +0.1% PASS
total/synth/EQ/b1 5.59 5.62 +0.4% PASS
total/synth/GAS/a0 3.92 3.92 -0.0% PASS
total/synth/GAS/a1 3.97 3.99 +0.5% PASS
total/synth/GT/b0 5.39 5.39 +0.0% PASS
total/synth/GT/b1 5.36 5.36 -0.0% PASS
total/synth/ISZERO/u0 8.33 8.33 +0.0% PASS
total/synth/JUMPDEST/n0 2.85 2.85 +0.0% PASS
total/synth/LT/b0 5.40 5.40 -0.0% PASS
total/synth/LT/b1 5.37 5.36 -0.1% PASS
total/synth/MSIZE/a0 4.33 4.33 +0.1% PASS
total/synth/MSIZE/a1 4.85 4.86 +0.1% PASS
total/synth/MUL/b0 5.50 5.49 -0.1% PASS
total/synth/MUL/b1 5.91 5.94 +0.4% PASS
total/synth/NOT/u0 4.89 4.88 -0.2% PASS
total/synth/OR/b0 3.02 3.02 +0.0% PASS
total/synth/OR/b1 3.62 3.43 -5.1% PASS
total/synth/PC/a0 3.51 3.51 +0.1% PASS
total/synth/PC/a1 3.55 3.57 +0.6% PASS
total/synth/PUSH1/p0 1.39 1.40 +0.2% PASS
total/synth/PUSH1/p1 1.82 1.84 +0.9% PASS
total/synth/PUSH10/p0 1.30 1.31 +0.9% PASS
total/synth/PUSH10/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH11/p0 1.30 1.30 +0.3% PASS
total/synth/PUSH11/p1 1.83 1.84 +0.6% PASS
total/synth/PUSH12/p0 1.31 1.31 +0.1% PASS
total/synth/PUSH12/p1 1.83 1.83 +0.0% PASS
total/synth/PUSH13/p0 1.31 1.31 -0.1% PASS
total/synth/PUSH13/p1 1.83 1.83 -0.0% PASS
total/synth/PUSH14/p0 1.41 1.36 -3.4% PASS
total/synth/PUSH14/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH15/p0 1.40 1.32 -5.4% PASS
total/synth/PUSH15/p1 1.90 1.91 +0.4% PASS
total/synth/PUSH16/p0 1.30 1.39 +7.1% PASS
total/synth/PUSH16/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH17/p0 1.39 1.40 +0.1% PASS
total/synth/PUSH17/p1 1.83 1.83 -0.3% PASS
total/synth/PUSH18/p0 1.39 1.30 -6.4% PASS
total/synth/PUSH18/p1 1.84 1.83 -0.4% PASS
total/synth/PUSH19/p0 1.39 1.39 -0.0% PASS
total/synth/PUSH19/p1 1.83 1.84 +0.3% PASS
total/synth/PUSH2/p0 1.30 1.29 -0.2% PASS
total/synth/PUSH2/p1 1.82 1.83 +0.3% PASS
total/synth/PUSH20/p0 1.39 1.30 -6.5% PASS
total/synth/PUSH20/p1 1.83 1.83 +0.1% PASS
total/synth/PUSH21/p0 1.30 1.31 +0.5% PASS
total/synth/PUSH21/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH22/p0 1.32 1.39 +5.9% PASS
total/synth/PUSH22/p1 1.83 1.83 +0.1% PASS
total/synth/PUSH23/p0 1.30 1.31 +0.2% PASS
total/synth/PUSH23/p1 1.83 1.87 +1.9% PASS
total/synth/PUSH24/p0 1.39 1.30 -6.4% PASS
total/synth/PUSH24/p1 1.83 1.84 +0.1% PASS
total/synth/PUSH25/p0 1.34 1.39 +4.4% PASS
total/synth/PUSH25/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH26/p0 1.40 1.39 -0.0% PASS
total/synth/PUSH26/p1 1.83 1.83 -0.3% PASS
total/synth/PUSH27/p0 1.31 1.39 +6.8% PASS
total/synth/PUSH27/p1 1.83 1.83 +0.0% PASS
total/synth/PUSH28/p0 1.40 1.31 -6.1% PASS
total/synth/PUSH28/p1 1.83 1.83 -0.1% PASS
total/synth/PUSH29/p0 1.31 1.30 -0.8% PASS
total/synth/PUSH29/p1 1.83 1.83 +0.0% PASS
total/synth/PUSH3/p0 1.39 1.30 -6.5% PASS
total/synth/PUSH3/p1 1.83 1.83 -0.0% PASS
total/synth/PUSH30/p0 1.46 1.59 +9.1% PASS
total/synth/PUSH30/p1 1.84 1.83 -0.5% PASS
total/synth/PUSH31/p0 1.32 1.31 -1.4% PASS
total/synth/PUSH31/p1 1.94 2.03 +4.8% PASS
total/synth/PUSH32/p0 1.33 1.33 -0.3% PASS
total/synth/PUSH32/p1 1.84 1.84 -0.1% PASS
total/synth/PUSH4/p0 1.39 1.30 -6.6% PASS
total/synth/PUSH4/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH5/p0 1.40 1.39 -0.2% PASS
total/synth/PUSH5/p1 1.82 1.83 +0.4% PASS
total/synth/PUSH6/p0 1.39 1.39 -0.0% PASS
total/synth/PUSH6/p1 1.83 1.86 +1.6% PASS
total/synth/PUSH7/p0 1.40 1.30 -6.9% PASS
total/synth/PUSH7/p1 1.83 1.84 +0.6% PASS
total/synth/PUSH8/p0 1.39 1.31 -6.0% PASS
total/synth/PUSH8/p1 1.83 1.83 +0.2% PASS
total/synth/PUSH9/p0 1.39 1.39 -0.1% PASS
total/synth/PUSH9/p1 1.83 1.83 +0.1% PASS
total/synth/RETURNDATASIZE/a0 4.08 4.08 -0.1% PASS
total/synth/RETURNDATASIZE/a1 4.09 4.10 +0.4% PASS
total/synth/SAR/b0 4.01 4.01 -0.0% PASS
total/synth/SAR/b1 4.63 4.65 +0.4% PASS
total/synth/SGT/b0 4.60 4.60 +0.0% PASS
total/synth/SGT/b1 4.14 4.13 -0.4% PASS
total/synth/SHL/b0 3.61 3.61 -0.2% PASS
total/synth/SHL/b1 3.71 3.73 +0.5% PASS
total/synth/SHR/b0 3.38 3.38 +0.1% PASS
total/synth/SHR/b1 3.67 3.70 +0.8% PASS
total/synth/SIGNEXTEND/b0 3.44 3.43 -0.0% PASS
total/synth/SIGNEXTEND/b1 3.81 3.84 +0.6% PASS
total/synth/SLT/b0 4.29 4.29 -0.0% PASS
total/synth/SLT/b1 4.12 4.12 +0.0% PASS
total/synth/SUB/b0 3.17 3.19 +0.6% PASS
total/synth/SUB/b1 3.72 3.51 -5.6% PASS
total/synth/SWAP1/s0 3.34 3.34 +0.0% PASS
total/synth/SWAP10/s0 3.36 3.35 -0.1% PASS
total/synth/SWAP11/s0 3.36 3.36 -0.1% PASS
total/synth/SWAP12/s0 3.36 3.36 -0.0% PASS
total/synth/SWAP13/s0 3.36 3.36 -0.0% PASS
total/synth/SWAP14/s0 3.36 3.36 +0.0% PASS
total/synth/SWAP15/s0 3.91 3.91 -0.0% PASS
total/synth/SWAP16/s0 3.37 3.37 -0.1% PASS
total/synth/SWAP2/s0 3.34 3.34 +0.0% PASS
total/synth/SWAP3/s0 3.34 3.35 +0.1% PASS
total/synth/SWAP4/s0 3.35 3.35 -0.0% PASS
total/synth/SWAP5/s0 3.35 3.35 +0.0% PASS
total/synth/SWAP6/s0 3.35 3.35 -0.0% PASS
total/synth/SWAP7/s0 3.35 3.35 +0.0% PASS
total/synth/SWAP8/s0 3.35 3.35 -0.0% PASS
total/synth/SWAP9/s0 3.35 3.35 +0.0% PASS
total/synth/XOR/b0 3.10 3.10 -0.0% PASS
total/synth/XOR/b1 3.61 3.50 -3.0% PASS
total/synth/loop_v1 6.76 6.76 -0.0% PASS
total/synth/loop_v2 6.74 6.83 +1.3% 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.03 1.03 +0.4% PASS
total/main/blake2b_huff/empty 0.02 0.02 -0.8% PASS
total/main/blake2b_shifts/8415nulls 4.91 4.83 -1.7% PASS
total/main/sha1_divs/5311 0.62 0.61 -0.2% PASS
total/main/sha1_divs/empty 0.01 0.01 -0.3% PASS
total/main/sha1_shifts/5311 0.57 0.57 +0.2% PASS
total/main/sha1_shifts/empty 0.01 0.01 -0.5% PASS
total/main/snailtracer/benchmark 35.88 35.92 +0.1% PASS
total/main/structarray_alloc/nfts_rank 0.28 0.28 +0.8% PASS
total/main/swap_math/insufficient_liquidity 0.00 0.00 -1.9% PASS
total/main/swap_math/received 0.00 0.00 -0.7% PASS
total/main/swap_math/spent 0.00 0.00 -2.2% PASS
total/main/weierstrudel/1 0.25 0.26 +1.6% PASS
total/main/weierstrudel/15 2.99 3.01 +0.8% PASS
total/micro/JUMPDEST_n0/empty 0.00 0.00 -1.1% PASS
total/micro/jump_around/empty 0.04 0.04 -1.2% PASS
total/micro/loop_with_many_jumpdests/empty 0.00 0.00 +0.9% PASS
total/micro/memory_grow_mload/by1 0.01 0.01 +0.1% PASS
total/micro/memory_grow_mload/by16 0.01 0.01 -1.0% PASS
total/micro/memory_grow_mload/by32 0.01 0.01 +0.0% PASS
total/micro/memory_grow_mload/nogrow 0.01 0.01 +0.1% PASS
total/micro/memory_grow_mstore/by1 0.01 0.01 -0.4% PASS
total/micro/memory_grow_mstore/by16 0.01 0.01 +0.9% PASS
total/micro/memory_grow_mstore/by32 0.01 0.01 -0.4% PASS
total/micro/memory_grow_mstore/nogrow 0.01 0.01 -0.7% PASS
total/micro/signextend/one 0.09 0.08 -0.8% PASS
total/micro/signextend/zero 0.08 0.08 -0.1% PASS
total/synth/ADD/b0 0.00 0.00 -1.1% PASS
total/synth/ADD/b1 0.00 0.00 -2.4% PASS
total/synth/ADDRESS/a0 0.15 0.15 +1.5% PASS
total/synth/ADDRESS/a1 0.15 0.15 +2.5% PASS
total/synth/AND/b0 0.00 0.00 +0.2% PASS
total/synth/AND/b1 0.00 0.00 +1.0% PASS
total/synth/BYTE/b0 0.00 0.00 -0.5% PASS
total/synth/BYTE/b1 0.00 0.00 +2.2% PASS
total/synth/CALLDATASIZE/a0 0.07 0.07 +0.2% PASS
total/synth/CALLDATASIZE/a1 0.07 0.07 -0.0% PASS
total/synth/CALLER/a0 0.20 0.20 -1.4% PASS
total/synth/CALLER/a1 0.20 0.20 -1.9% PASS
total/synth/CALLVALUE/a0 0.19 0.19 +0.9% PASS
total/synth/CALLVALUE/a1 0.19 0.19 -0.2% PASS
total/synth/CODESIZE/a0 0.07 0.07 +0.0% PASS
total/synth/CODESIZE/a1 0.07 0.07 +0.1% PASS
total/synth/DUP1/d0 0.00 0.00 -0.6% PASS
total/synth/DUP1/d1 0.00 0.00 -1.0% PASS
total/synth/DUP10/d0 0.00 0.00 -1.0% PASS
total/synth/DUP10/d1 0.00 0.00 -1.9% PASS
total/synth/DUP11/d0 0.00 0.00 -1.1% PASS
total/synth/DUP11/d1 0.00 0.00 +1.8% PASS
total/synth/DUP12/d0 0.00 0.00 -1.4% PASS
total/synth/DUP12/d1 0.00 0.00 +1.7% PASS
total/synth/DUP13/d0 0.00 0.00 -1.7% PASS
total/synth/DUP13/d1 0.00 0.00 -3.4% PASS
total/synth/DUP14/d0 0.00 0.00 +0.5% PASS
total/synth/DUP14/d1 0.00 0.00 -1.6% PASS
total/synth/DUP15/d0 0.00 0.00 +0.1% PASS
total/synth/DUP15/d1 0.00 0.00 +1.3% PASS
total/synth/DUP16/d0 0.00 0.00 +1.1% PASS
total/synth/DUP16/d1 0.00 0.00 +1.2% PASS
total/synth/DUP2/d0 0.00 0.00 +3.4% PASS
total/synth/DUP2/d1 0.00 0.00 +0.8% PASS
total/synth/DUP3/d0 0.00 0.00 -1.2% PASS
total/synth/DUP3/d1 0.00 0.00 -2.1% PASS
total/synth/DUP4/d0 0.00 0.00 -0.4% PASS
total/synth/DUP4/d1 0.00 0.00 -2.0% PASS
total/synth/DUP5/d0 0.00 0.00 -2.3% PASS
total/synth/DUP5/d1 0.00 0.00 -2.6% PASS
total/synth/DUP6/d0 0.00 0.00 +2.1% PASS
total/synth/DUP6/d1 0.00 0.00 -3.6% PASS
total/synth/DUP7/d0 0.00 0.00 -0.6% PASS
total/synth/DUP7/d1 0.00 0.00 -0.7% PASS
total/synth/DUP8/d0 0.00 0.00 -0.2% PASS
total/synth/DUP8/d1 0.00 0.00 -1.1% PASS
total/synth/DUP9/d0 0.00 0.00 +3.3% PASS
total/synth/DUP9/d1 0.00 0.00 -0.3% PASS
total/synth/EQ/b0 0.00 0.00 -0.1% PASS
total/synth/EQ/b1 0.00 0.00 +0.4% PASS
total/synth/GAS/a0 0.86 0.86 +0.0% PASS
total/synth/GAS/a1 0.86 0.86 +0.0% PASS
total/synth/GT/b0 0.00 0.00 +0.7% PASS
total/synth/GT/b1 0.00 0.00 -0.1% PASS
total/synth/ISZERO/u0 0.00 0.00 -3.3% PASS
total/synth/JUMPDEST/n0 0.00 0.00 -2.2% PASS
total/synth/LT/b0 0.00 0.00 -3.0% PASS
total/synth/LT/b1 0.00 0.00 +1.1% PASS
total/synth/MSIZE/a0 0.00 0.00 +0.8% PASS
total/synth/MSIZE/a1 0.00 0.00 -0.7% PASS
total/synth/MUL/b0 0.00 0.00 -0.3% PASS
total/synth/MUL/b1 0.00 0.00 +0.1% PASS
total/synth/NOT/u0 0.00 0.00 -2.0% PASS
total/synth/OR/b0 0.00 0.00 +2.8% PASS
total/synth/OR/b1 0.00 0.00 -0.1% PASS
total/synth/PC/a0 0.00 0.00 +0.6% PASS
total/synth/PC/a1 0.00 0.00 -2.5% PASS
total/synth/PUSH1/p0 0.00 0.00 +0.1% PASS
total/synth/PUSH1/p1 0.00 0.00 -1.1% PASS
total/synth/PUSH10/p0 0.00 0.00 +5.8% PASS
total/synth/PUSH10/p1 0.00 0.00 +3.3% PASS
total/synth/PUSH11/p0 0.00 0.00 +1.4% PASS
total/synth/PUSH11/p1 0.00 0.00 +4.0% PASS
total/synth/PUSH12/p0 0.00 0.00 -3.3% PASS
total/synth/PUSH12/p1 0.00 0.00 +1.6% PASS
total/synth/PUSH13/p0 0.00 0.00 +2.4% PASS
total/synth/PUSH13/p1 0.00 0.00 +0.7% PASS
total/synth/PUSH14/p0 0.00 0.00 -1.1% PASS
total/synth/PUSH14/p1 0.00 0.00 +1.0% PASS
total/synth/PUSH15/p0 0.00 0.00 -0.9% PASS
total/synth/PUSH15/p1 0.00 0.00 -0.6% PASS
total/synth/PUSH16/p0 0.00 0.00 -0.5% PASS
total/synth/PUSH16/p1 0.00 0.00 +1.1% PASS
total/synth/PUSH17/p0 0.00 0.00 +1.3% PASS
total/synth/PUSH17/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH18/p0 0.00 0.00 -2.0% PASS
total/synth/PUSH18/p1 0.00 0.00 +0.2% PASS
total/synth/PUSH19/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH19/p1 0.00 0.00 +0.0% PASS
total/synth/PUSH2/p0 0.00 0.00 -0.6% PASS
total/synth/PUSH2/p1 0.00 0.00 -0.0% PASS
total/synth/PUSH20/p0 0.00 0.00 -0.5% PASS
total/synth/PUSH20/p1 0.00 0.00 +2.3% PASS
total/synth/PUSH21/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH21/p1 0.00 0.00 +3.3% PASS
total/synth/PUSH22/p0 1.50 1.51 +0.5% PASS
total/synth/PUSH22/p1 1.80 1.80 -0.1% PASS
total/synth/PUSH23/p0 1.52 1.52 +0.3% PASS
total/synth/PUSH23/p1 1.80 1.80 -0.4% PASS
total/synth/PUSH24/p0 1.51 1.51 -0.2% PASS
total/synth/PUSH24/p1 1.81 1.81 +0.1% PASS
total/synth/PUSH25/p0 1.52 1.51 -1.0% PASS
total/synth/PUSH25/p1 1.80 1.80 +0.2% PASS
total/synth/PUSH26/p0 1.52 1.51 -0.2% PASS
total/synth/PUSH26/p1 1.82 1.81 -0.6% PASS
total/synth/PUSH27/p0 1.52 1.52 +0.1% PASS
total/synth/PUSH27/p1 1.80 1.80 +0.0% PASS
total/synth/PUSH28/p0 1.52 1.52 +0.3% PASS
total/synth/PUSH28/p1 1.80 1.80 +0.0% PASS
total/synth/PUSH29/p0 1.53 1.53 -0.0% PASS
total/synth/PUSH29/p1 1.80 1.80 -0.0% PASS
total/synth/PUSH3/p0 0.00 0.00 +3.1% PASS
total/synth/PUSH3/p1 0.00 0.00 +0.7% PASS
total/synth/PUSH30/p0 1.52 1.59 +4.1% PASS
total/synth/PUSH30/p1 1.80 1.80 +0.0% PASS
total/synth/PUSH31/p0 1.52 1.53 +0.5% PASS
total/synth/PUSH31/p1 1.85 1.83 -1.0% PASS
total/synth/PUSH32/p0 1.52 1.53 +0.9% PASS
total/synth/PUSH32/p1 1.81 1.80 -0.9% PASS
total/synth/PUSH4/p0 0.00 0.00 -0.1% PASS
total/synth/PUSH4/p1 0.00 0.00 -0.8% PASS
total/synth/PUSH5/p0 0.00 0.00 +2.3% PASS
total/synth/PUSH5/p1 0.00 0.00 +2.7% PASS
total/synth/PUSH6/p0 0.00 0.00 -1.4% PASS
total/synth/PUSH6/p1 0.00 0.00 -1.5% PASS
total/synth/PUSH7/p0 0.00 0.00 +3.6% PASS
total/synth/PUSH7/p1 0.00 0.00 +0.5% PASS
total/synth/PUSH8/p0 0.00 0.00 +0.2% PASS
total/synth/PUSH8/p1 0.00 0.00 -1.0% PASS
total/synth/PUSH9/p0 0.00 0.00 +1.4% PASS
total/synth/PUSH9/p1 0.00 0.00 +2.7% PASS
total/synth/RETURNDATASIZE/a0 0.03 0.03 +0.2% PASS
total/synth/RETURNDATASIZE/a1 0.03 0.03 -0.0% PASS
total/synth/SAR/b0 0.00 0.00 +1.2% PASS
total/synth/SAR/b1 0.00 0.00 -1.3% PASS
total/synth/SGT/b0 0.00 0.00 -4.7% PASS
total/synth/SGT/b1 0.00 0.00 -2.1% PASS
total/synth/SHL/b0 0.00 0.00 -2.6% PASS
total/synth/SHL/b1 0.00 0.00 -2.3% PASS
total/synth/SHR/b0 0.00 0.00 -2.7% PASS
total/synth/SHR/b1 0.00 0.00 +1.7% PASS
total/synth/SIGNEXTEND/b0 0.00 0.00 -2.1% PASS
total/synth/SIGNEXTEND/b1 0.00 0.00 +1.6% PASS
total/synth/SLT/b0 0.00 0.00 +2.1% PASS
total/synth/SLT/b1 0.00 0.00 -0.3% PASS
total/synth/SUB/b0 0.00 0.00 -0.3% PASS
total/synth/SUB/b1 0.00 0.00 +1.4% PASS
total/synth/SWAP1/s0 0.00 0.00 -0.2% PASS
total/synth/SWAP10/s0 0.00 0.00 -3.6% PASS
total/synth/SWAP11/s0 0.00 0.00 -1.5% PASS
total/synth/SWAP12/s0 0.00 0.00 -0.9% PASS
total/synth/SWAP13/s0 0.00 0.00 -2.1% PASS
total/synth/SWAP14/s0 0.00 0.00 +1.6% PASS
total/synth/SWAP15/s0 0.00 0.00 +2.4% PASS
total/synth/SWAP16/s0 0.00 0.00 -1.0% PASS
total/synth/SWAP2/s0 0.00 0.00 -0.6% PASS
total/synth/SWAP3/s0 0.00 0.00 -1.4% PASS
total/synth/SWAP4/s0 0.00 0.00 -0.6% PASS
total/synth/SWAP5/s0 0.00 0.00 -1.5% PASS
total/synth/SWAP6/s0 0.00 0.00 +1.1% PASS
total/synth/SWAP7/s0 0.00 0.00 +4.4% PASS
total/synth/SWAP8/s0 0.00 0.00 +0.6% PASS
total/synth/SWAP9/s0 0.00 0.00 -0.3% PASS
total/synth/XOR/b0 0.00 0.00 +0.9% PASS
total/synth/XOR/b1 0.00 0.00 -0.1% PASS
total/synth/loop_v1 1.65 1.68 +1.4% PASS
total/synth/loop_v2 1.59 1.60 +0.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

In "check mode" (ZEN_ENABLE_JIT && !ZEN_ENABLE_CPU_EXCEPTION), the previous code in EVMInstance::chargeGas/addGas threw a C++ exception across JIT-compiled frames when out of gas, which is undefined behavior. This PR converts the gas-accounting helpers to return a bool, propagates the failure through callers (expandMemory*, all of evm_imported.cpp's host helpers), and adds a JIT-side soft-error check (emitRuntimeSoftErrorCheck) that branches to a gas/static-violation trap BB after each potentially-failing host call. A new evmGetErrorCode runtime helper is exposed so the JIT can inspect the instance error code.

Changes:

  • Convert chargeGas/addGas/expandMemory to return bool and replace throw/triggerInstanceExceptionOnJIT with setInstanceExceptionOnJIT + early return in check mode; update all runtime helpers to bail out on chargeGas failure.
  • Add callRuntimeForMayFail overloads in EVMMirBuilder and switch most JIT-emitted host calls (BALANCE, SLOAD, SSTORE, KECCAK256, CALL/STATICCALL/DELEGATECALL/CALLCODE, CREATE/CREATE2, COPY, LOG, RETURN/REVERT/SELFDESTRUCT, EXTCODE*) to use it.
  • Introduce evmGetErrorCode host helper and emitRuntimeSoftErrorCheck, which compares the post-call error code against GasLimitExceeded and EVMStaticModeViolation and branches to the corresponding exception-set BB.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/runtime/evm_instance.h Change expandMemory/chargeGas/addGas return types to bool.
src/runtime/evm_instance.cpp Implement bool-returning gas helpers; in check mode, set instance error and return false instead of throwing.
src/compiler/evm_frontend/evm_imported.h Declare evmGetErrorCode and add GetErrorCode to runtime function table.
src/compiler/evm_frontend/evm_imported.cpp Propagate chargeGas/addGas boolean returns through all helpers; add evmGetErrorCode.
src/compiler/evm_frontend/evm_mir_compiler.h Declare callRuntimeForMayFail overloads and emitRuntimeSoftErrorCheck.
src/compiler/evm_frontend/evm_mir_compiler.cpp Implement callRuntimeForMayFail and the soft error check; switch most opcode handlers to use it.
Comments suppressed due to low confidence (2)

src/runtime/evm_instance.cpp:300

  • The return false; on line 299 (after #endif) is unreachable in every preprocessor branch: the CPU-exception branch traps via triggerInstanceExceptionOnJIT -> ud2, the soft-exception branch already returns on line 295, and the no-JIT branch throws. It will likely produce -Wunreachable-code-return warnings under some configs and is inconsistent with addGas below (which has no trailing return false; after #endif). Either drop the trailing return false; here or align the two functions.
#if defined(ZEN_ENABLE_JIT) && defined(ZEN_ENABLE_CPU_EXCEPTION)
    triggerInstanceExceptionOnJIT(this, common::ErrorCode::GasLimitExceeded);
#elif defined(ZEN_ENABLE_JIT) && !defined(ZEN_ENABLE_CPU_EXCEPTION)
    setInstanceExceptionOnJIT(this, common::ErrorCode::GasLimitExceeded);
    return false;
#else
    throw common::getError(common::ErrorCode::GasLimitExceeded);
#endif
    return false;
  }

src/runtime/evm_instance.cpp:321

  • The preprocessor branches in chargeGas (lines 291-299) and addGas (lines 311-321) are ordered differently: chargeGas puts the CPU-exception branch first and has a trailing return false; after #endif, while addGas puts the soft branch first and has no trailing return. The behavior is equivalent, but the inconsistency is confusing and makes diffing/maintenance harder. Consider unifying the structure of these two helpers.
bool EVMInstance::addGas(uint64_t GasAmount) {
  evmc_message *Msg = getCurrentMessage();
  ZEN_ASSERT(Msg && "Active message required for gas accounting");
  uint64_t GasLeft = getGas();
  if (GasLeft > UINT64_MAX - GasAmount) {
#if defined(ZEN_ENABLE_JIT) && !defined(ZEN_ENABLE_CPU_EXCEPTION)
    setInstanceExceptionOnJIT(this, common::ErrorCode::GasLimitExceeded);
    return false;
#elif defined(ZEN_ENABLE_JIT) && defined(ZEN_ENABLE_CPU_EXCEPTION)
    triggerInstanceExceptionOnJIT(this, common::ErrorCode::GasLimitExceeded);
    return false;
#else
    throw common::getError(common::ErrorCode::GasLimitExceeded);
#endif
  }

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

Comment thread src/compiler/evm_frontend/evm_mir_compiler.cpp
Comment thread src/compiler/evm_frontend/evm_mir_compiler.cpp
Comment thread src/runtime/evm_instance.cpp
Comment thread src/compiler/evm_frontend/evm_mir_compiler.h
Comment thread src/compiler/evm_frontend/evm_mir_compiler.cpp
cmgCr added 3 commits May 15, 2026 20:56
When ZEN_ENABLE_CPU_EXCEPTION=OFF (check mode), JIT-compiled code lacks
DWARF unwind info, so C++ exceptions thrown from host API functions
(e.g. chargeGas's throw on out-of-gas) cannot propagate through JIT
frames and cause std::terminate.

Fix by replacing all throw paths in host API call chains with
setInstanceExceptionOnJIT + early return, and adding post-call error
code checks in the compiler IR:

- Add chargeGasHostApi() wrapper that pre-checks gas and uses
  setInstanceExceptionOnJIT instead of throw in JIT+check mode
- Guard expandMemory/expandMemoryChecked with pre-check and
  markOutOfGas lambda (no-throw in JIT+check mode)
- Add JIT+check branch in addGas() overflow handling
- Add overflow pre-check before addGas(CALL_GAS_STIPEND) in
  evmHandleCallInternal
- Add evmGetErrorCode host function and insert error-code checks
  after every callRuntimeFor in the MIR compiler, branching to
  GasLimitExceeded or EVMStaticModeViolation exception BBs
- Make chargeGas() and addGas() return bool; all three modes
  (interpreter, JIT+CPU_EXCEPTION, JIT+check) now handled
  internally, eliminating the chargeGasHostApi wrapper
- Simplify expandMemory() to use chargeGas() return value instead
  of separate #if branches; remove markOutOfGas lambda from
  expandMemoryChecked()
- Remove addGas(CALL_GAS_STIPEND) overflow pre-check in favor of
  addGas() returning false on overflow
- Split callRuntimeFor into callRuntimeFor (pure reads) and
  callRuntimeForMayFail (may charge gas/fail), extracting
  emitRuntimeSoftErrorCheck as a shared helper
Rename callRuntimeForMayFail to callRuntimeForWithErrorCheck, keep TSTORE on checked runtime path, and document oversize-memory OOG signaling to make check-mode behavior explicit and safer to maintain.
@cmgCr cmgCr force-pushed the cmgCr/fix_jit_check branch from 40bd256 to 5849547 Compare May 15, 2026 12:58
@zoowii zoowii merged commit ef062ae into DTVMStack:main May 15, 2026
16 checks passed
@cmgCr cmgCr deleted the cmgCr/fix_jit_check branch May 18, 2026 03:28
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