-
Notifications
You must be signed in to change notification settings - Fork 3.4k
How to abort #9715
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
Comments
/cc @aheejin |
+1 on implementing |
Could we do
in JS? Seems like that would show up as a RuntimeError in the wasm unwinding, and be handled properly. The benefit to doing it from JS is that we need to set up some state on the JS side too (set the global |
Yeah that would be even better! |
Other JS errors may be seen as foreign exceptions which means native wasm exception handling will run destructors, but we do not want anything to run, and to just abort. Fixes #9715
Other JS errors may be seen as foreign exceptions which means native wasm exception handling will run destructors, but we do not want anything to run, and to just abort. Fixes emscripten-core#9715
Currently emscripten's implementation of
abort()
calls to JS (where it calls some user hooks and collects a stack trace) and throws an exception, allowing it to propagate through all the wasm frames out to the caller.Once we have wasm exceptions, that probably won't be what we want, because foreign exceptions unwinding through wasm frames will cause destructors to run, which isn't what we want for
abort
(and it may eventually be the case that in some configurations C++catch(...)
clauses may catch foreign exceptions). We need some other way to abort.One straighforward option could be to export a wasm function that executes
unreachable
. IIUC with MVP wasm that would be functionally the same, but I don't know if anywhere in emscripten's runtime actually tries to catch or check an abort. Also the issue of traps vs exceptions isn't 100% settled yet but it will certainly be the case that the wasm code will ensure that traps do not cause destructor execution.It's a little unfortunate to have to export an extra function, but it would be nice to have the same API for EH and non-EH builds.
Any ideas I'm missing?
The text was updated successfully, but these errors were encountered: