Skip to content

test: exception-handling spec tests and unwinding cases - #71

Merged
explodingcamera merged 2 commits into
explodingcamera:nextfrom
rebeckerspecialties:test/exception-handling-coverage
Sep 26, 2026
Merged

explodingcamera merged 2 commits into
explodingcamera:nextfrom
rebeckerspecialties:test/exception-handling-coverage

Conversation

@matthargett

Copy link
Copy Markdown
Contributor

no test target ran the exceptions proposal's spec scripts: wasm-testsuite ships tag.wast, throw.wast, throw_ref.wast and try_table.wast only under proposals/exceptions.

  • Added a test-wasm-exceptions target that runs them, like test-wasm-gc does for GC, and puts results in tests/generated/wasm-exceptions.csv . All 105 expectations pass (w00t!).

  • tests/wasm-custom/exception-unwinding.wast adds 19 assertions for unwinding shapes the spec scripts only partly cover (maybe I should contribute those to upstream CTS at some point):

    • typed catch selection;
    • mixed-width payloads, with values left under the handler block;
    • try_table results on both exits;
    • the inner handler going out of scope once an outer catch takes the exception, repeated in a loop;
    • a payload crossing call_indirect and return_call frames, re-raised with throw_ref in between;
    • branches out of try_table inside loops, including a catch whose label is a loop.

    These shapes found bugs in other interpreter's exception handling (most of those fixes were already contributed, and they're in my forks' patches used by my WasmBench app).

tinywasm passes all of them, so no production code changes in this PR, this is just to guard against future regressions against the spec and give a nice safety net for upcoming optimization work :)

wasm-testsuite ships the exceptions proposal's tag, throw, throw_ref and
try_table scripts under proposals/exceptions, and no test target ran
them. All 105 assertions pass.
Exnref versions of shapes that exposed unwinding bugs in another
interpreter's exception handling: typed catch selection, mixed-width
payloads with values left under the handler block, try_table results,
handler scope once an outer catch takes the exception (also in a loop),
payloads crossing call_indirect and return_call frames with a throw_ref
in between, and branches out of try_table inside loops.
@explodingcamera
explodingcamera merged commit d1165c2 into explodingcamera:next Sep 26, 2026
13 checks passed
@matthargett
matthargett deleted the test/exception-handling-coverage branch September 27, 2026 05:06
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.

2 participants