Skip to content

Add support for Exceptions Handling proposal#311

Open
MaxDesiatov wants to merge 9 commits intomainfrom
maxd/exception-handling
Open

Add support for Exceptions Handling proposal#311
MaxDesiatov wants to merge 9 commits intomainfrom
maxd/exception-handling

Conversation

@MaxDesiatov
Copy link
Copy Markdown
Member

See proposal overview for more details.

Resolves #224.

@MaxDesiatov
Copy link
Copy Markdown
Member Author

MaxDesiatov commented Feb 26, 2026

M1 MacBook Air with containerized Ubuntu Noble:

Benchmark                                        main (ms)      eh (ms)   delta%
     --------------------------------------------------------------------------------
     aead_chacha20poly1305.wasm.csv                      401.8        395.6     -1.6%
     aead_chacha20poly13052.wasm.csv                     848.0        836.7     -1.3%
     aead_xchacha20poly1305.wasm.csv                     421.1        413.3     -1.9%
     auth.wasm.csv                                       113.6        112.2     -1.2%
     auth2.wasm.csv                                       19.6         18.8     -3.9%
     auth3.wasm.csv                                       24.6         23.7     -3.7%
     auth6.wasm.csv                                       22.5         21.3     -5.3%
     box.wasm.csv                                       1335.1       1308.0     -2.0%
     box2.wasm.csv                                      1339.8       1316.6     -1.7%
     box_easy.wasm.csv                                  2605.7       2593.9     -0.5%
● CoreMark (higher is better):

  ┌───────┬─────────┬───────────┬───────┐
  │       │  main   │ eh-branch │ Delta │
  ├───────┼─────────┼───────────┼───────┤
  │ Score │ 2125.04 │ 2140.33   │ +0.7% │
  └───────┴─────────┴───────────┴───────┘
  WishYouWereFast / hyperfine (lower is better):

  ┌────────────────────────┬───────────┬─────────┬───────┐
  │       Benchmark        │ main (ms) │ eh (ms) │ Delta │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ aead_chacha20poly1305  │ 401.8     │ 395.6   │ -1.6% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ aead_chacha20poly13052 │ 848.0     │ 836.7   │ -1.3% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ aead_xchacha20poly1305 │ 421.1     │ 413.3   │ -1.9% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ auth                   │ 113.6     │ 112.2   │ -1.2% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ auth2                  │ 19.6      │ 18.8    │ -3.9% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ auth3                  │ 24.6      │ 23.7    │ -3.7% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ auth6                  │ 22.5      │ 21.3    │ -5.3% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ box                    │ 1335.1    │ 1308.0  │ -2.0% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ box2                   │ 1339.8    │ 1316.6  │ -1.7% │
  ├────────────────────────┼───────────┼─────────┼───────┤
  │ box_easy               │ 2605.7    │ 2593.9  │ -0.5% │
  └────────────────────────┴───────────┴─────────┴───────┘

@MaxDesiatov
Copy link
Copy Markdown
Member Author

MaxDesiatov commented Feb 26, 2026

Verified end-to-end with

clang version 21.1.4-wasi-sdk (https://github.com/llvm/llvm-project 222fc11f2b8f25f6a0f4976272ef1bb7bf49521d) 

and an invocation like this

clang --target=wasm32-wasi \
    -fwasm-exceptions -mllvm -wasm-enable-sjlj \
    -mllvm -wasm-use-legacy-eh=false \
    -O1 -lsetjmp

simple setjmp/longjmp examples run same on Linux and WASI. Unfortunately, WASI SDK doesn't build libc++ with exceptions enabled to verify those.

@MaxDesiatov MaxDesiatov marked this pull request as ready for review February 26, 2026 23:01
@MaxDesiatov
Copy link
Copy Markdown
Member Author

I temporarily pushed ec7f3a1 for detailed library benchmarks on macOS M1 MBA.

On macOS CoreMark main is 2288.147742, and this branch is 2293.072187: 0.2% difference

Copy link
Copy Markdown
Member

@kateinoigakukun kateinoigakukun left a comment

Choose a reason for hiding this comment

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

I'll take a dedicated time to review but I don't think I can make it this week 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception handling

2 participants