Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wast doesn't seem to have a way to test uncaught exception in start function #322

Open
yamt opened this issue Jul 5, 2024 · 1 comment

Comments

@yamt
Copy link
Contributor

yamt commented Jul 5, 2024

maybe we need to add assert_exception for a module?

@rossberg
Copy link
Member

rossberg commented Jul 5, 2024

Usually one can encode such checks in Wasm itself with some wrapper function, but the start function is an interesting exception.

An assert_exception might make sense, the only problem is that there is no obvious way to refer to a specific exception, i.e., a tag, outside of a module. We could have an assertion that cannot check the exception, but that seems a bit half-arsed. Perhaps the tag would have to be identified by a module + export name?

Strawman:

(assert_exception (tag moduleid? "name") value*)

where the values are the exception's expected payload.

But can such an assertion always be translated to JS easily, e.g., if the exception carries a v128? In the case of call results, the interpreter's JS translation synthesises a Wasm wrapper performing the check in such cases, but for exceptions that's a bit more more work and won't directly extend to the implicit invocation of the start function. It would at least require some extra indirection bouncing back between Wasm and JS to wrap a Wasm handler around module instantiation.

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

No branches or pull requests

2 participants