You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 WebAssembly/design#417
Linked repositories github.com/WebAssembly/exception-handling
Details
The WebAssembly MVP supports four no-exception modes for C++:
throw
toabort()
.-fno-exceptions
mode (note caveats).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 ofsetjmp
/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.The text was updated successfully, but these errors were encountered: