ReviewOS

zig-utils/zig-js

WebAssembly exceptions: tags, binary IR, validation, and unwinding

#290
Closed chris opened this 9 days ago ·
9 days ago

Parent: #266 Roadmap: #142, #134

Implement the exact pinned exception-handling core before exposing the JavaScript API.

Acceptance:

  • Inventory every section kind, opcode, immediate, validation rule, and proposal corpus file at WebAssembly/exception-handling@af287a7.
  • Decode, own, import/export, link, and feature-gate tag types with exact diagnostics and rollback-safe teardown.
  • Validate and execute the pinned try_table/throw/throw_ref surface exactly as declared by that revision.
  • Preserve typed payload bits/references through nested unwinding, calls, traps, and unreachable-polymorphic control.
  • Keep unwinding roots precise and pass deep nesting, lifecycle, leak, and sanitizer witnesses.
  • Check in machine-readable opcode/file inventories and drift verification.
9 days ago

The exact finished proposal inventory landed in e6fe573 and is presented in 4148c72. It pins exnref 0x69, tag section 13, tag external kind 4, throw/throw_ref/try_table, four catch kinds, validation rules, and 86 commands across the four dedicated corpus files. Commit 87ce0df replaces the stale legacy-opcode refusal with exact modern gates across value types, sections, imports, exports, and instructions. The exact CI compiler decoder slice passes 20/20 with zero failures or leaks. Core IR/validation/unwinding remains open.

9 days ago

Correction: the modern binary feature-gate commit is 331625f (the inventory and presentation commits remain e6fe573 and 4148c72).

9 days ago

Core exception-tag infrastructure landed in 4eccd08, with the README/status and runtime drift verifier in 639bf61. The opted-in decoder now owns section 13, tag imports/exports, exact zero attributes, and proposal section order; validation enforces defined types, empty results, and tag export bounds. Runtime linking preserves imported identity, creates distinct defined tags, checks exact payload types/counts, and tears down partial allocations failure-atomically. Module imports/exports reflection reports kind tag; JS Tag/Exception objects remain scoped to #291.

Focused local evidence on Zig 0.17.0-dev.956: 7/7 exception-tag tests passed, 0 skipped/failed/leaked, including exhaustive allocation-failure injection. tools/wasm-feature-profiles.py, formatting, and diff checks pass. Instruction IR, exnref, unwinding, payload roots, and the corpus score remain open here.

9 days ago

Completed by 92aae85 (modern exnref/instruction/catch IR and validation), 979bb19 (typed execution, unwinding, lifetime, and precise roots), and e16c4f6 (README/status and drift evidence).

Final focused evidence: all 8 wasm.exec exception tests pass normally and under ThreadSanitizer with 0 failures, skips, leaks, or races; binary/validation passes 4/4; exception-payload GC tracing passes 3/3. Witnesses cover 512 nested handlers, tag identity, every catch form, exact NaN/integer bits, externref identity, ordinary calls, cross-invocation rethrow, tail-frame removal, trap bypass, null/uncaught behavior, eight concurrent publishers, dropped-reference reclamation, and exhaustive allocation-failure rollback.

The JavaScript WebAssembly.Tag/Exception boundary remains #291. Exact proposal-corpus totals and bounded CI remain #292, so neither is being overclaimed here.

Sign in to comment on this issue.