Skip to content

Make cmp+branch execution handlers use 2 branch sites - #2027

Merged
Robbepop merged 2 commits into
mainfrom
rf-make-cmp-branch-handlers-use-2-branch-sites
Aug 10, 2026
Merged

Make cmp+branch execution handlers use 2 branch sites#2027
Robbepop merged 2 commits into
mainfrom
rf-make-cmp-branch-handlers-use-2-branch-sites

Conversation

@Robbepop

@Robbepop Robbepop commented Aug 10, 2026

Copy link
Copy Markdown
Member

This dramatically improves branch prediction.
Benchmarks show that performance improves significantly across the board on the tested Apple M2 Pro.

Codegen (Before)

wasmi::engine::executor::handler::exec::branch_i32_lt_ri:
Lfunc_begin1321:
        .cfi_startproc
        ldr x8, [x1, #8]
        ldr w9, [x1, #16]
        add x10, x1, #24
        cmp w9, w6
        csel x1, x8, x10, gt
        ldr x7, [x1]
        br x7

Codegen (After)

wasmi::engine::executor::handler::exec::branch_i32_lt_ri:
Lfunc_begin1321:
        .cfi_startproc
        ldr w8, [x1, #16]
        cmp w8, w6
        b.le LBB1321_2
        ldr x1, [x1, #8]
        ldr x7, [x1]
        br x7
LBB1321_2:
        ldr x7, [x1, #24]!
        br x7

Benchmarks

image image image image

this dramatically improves branch prediction.
benchmarks indicate wild performance improvements.
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.28%. Comparing base (c242c15) to head (bd67def).

Files with missing lines Patch % Lines
crates/wasmi/src/engine/executor/handler/exec.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2027      +/-   ##
==========================================
- Coverage   76.29%   76.28%   -0.01%     
==========================================
  Files         168      168              
  Lines       15531    15532       +1     
==========================================
  Hits        11849    11849              
- Misses       3682     3683       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Robbepop
Robbepop merged commit bd25cc1 into main Aug 10, 2026
23 of 24 checks passed
@Robbepop
Robbepop deleted the rf-make-cmp-branch-handlers-use-2-branch-sites branch August 10, 2026 12:26
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.

1 participant