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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃洡 Exception handling #1078

jfbastien opened this issue May 25, 2017 · 1 comment

馃洡 Exception handling #1078

jfbastien opened this issue May 25, 2017 · 1 comment


Copy link

jfbastien commented May 25, 2017

This is a tracking issue for a post-MVP feature
It will be updated as the issue progresses.

Topic Exception handling
Champion Heejin Ahn (@aheejin)
Status In progress
Phase Feature proposal
Linked issues #417
Linked repositories


The WebAssembly MVP supports four no-exception modes for C++:

  • Compiler transforms throw to abort().
  • Compiler-enforced -fno-exceptions mode (note caveats).
  • Compiler conversion of exceptions to branching at all callsites.
  • In a Web environment exception handling can be emulated using JavaScript exception handling, which can provide correct semantics but isn't fast.

These modes are suboptimal for code bases which rely on C++ exception handling, but are perfectly acceptable for C code, or for C++ code which avoids exceptions. This doesn't prevent developers from using the C++ standard library: their code will function correctly (albeit slower at times) as long as it doesn't encounter exceptional cases.

Post-MVP, WebAssembly will gain support for zero-cost exception handling.

In turn, this can be used to implement setjmp/longjmp, and can enable all of the defined behavior of setjmp/longjmp, namely unwinding the stack without calling C++ destructors. It does not, however, allow the undefined behavior case of jumping forward to a stack that was already unwound which is sometimes used to implement coroutines. Coroutine support is being considered separately.

jfbastien added a commit that referenced this issue May 25, 2017
Now tracked by: #1078
As discussed here: #1066
@WebAssembly WebAssembly locked and limited conversation to collaborators May 25, 2017
olonho referenced this issue in JetBrains/kotlin-native Jul 7, 2017
@binji binji assigned aheejin and unassigned KarlSchimpf Aug 7, 2018
Copy link

binji commented Oct 16, 2018

Moved to WebAssembly/proposals#4.

@binji binji closed this as completed Oct 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

5 participants