test: exception-handling spec tests and unwinding cases - #71
Merged
explodingcamera merged 2 commits intoSep 26, 2026
Merged
explodingcamera merged 2 commits into
explodingcamera merged 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
no test target ran the exceptions proposal's spec scripts: wasm-testsuite ships
tag.wast,throw.wast,throw_ref.wastandtry_table.wastonly underproposals/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):
try_tableresults on both exits;call_indirectandreturn_callframes, re-raised withthrow_refin between;try_tableinside 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 :)