WebAssembly / exception-handling

Proposal to add exception handling to WebAssembly
https://webassembly.github.io/exception-handling/
Other
163 stars 36 forks source link

Can catch_ref / catch_all_ref's destinations have type (ref exn)? #336

Closed aheejin closed 1 month ago

aheejin commented 1 month ago

Can catch_ref or catch_all_ref's destination blocks have a non-nullable exnref as the return type?

block (ref exn)
  try_table (catch_all_ref 0)
    ...
  end
end

The current EH spec interpreter does not handle (ref ..) keyword (it is included in the GC spec), so I can't test this with the current interpreter. The formal spec only says exnref. Does this mean it can't be (ref exn)?

rossberg commented 1 month ago

Yes. For example, this type-checks with the interpreter on the wasm-3.0 branch:

(module
  (func (result (ref exn))
    (try_table (catch_all_ref 0))
    (unreachable)
  )
)
aheejin commented 1 month ago

Thanks!