Request for Position: WebAssembly Exception Handling #573
Comments
We're talking about it, I'll file something within a day or two. |
In #575 I was asked by @tantek for a little more background on our position. TLDR: we consider exception handling important because it plugs a large gap in the wasm platform, we think the design is good because it is an MVP with few constraints on future growth, and we plan to implement and ship this ourselves. The feature adds the necessary structure to webassembly to efficiently model the semantics of exception propagation, exception handling, and unwinding (eg for executing destructors). "Efficiency" here has two aspects. Functions or parts of programs that do not need exception handling or unwinding pays nothing in run-time cost (time or memory) for its presence in the language, even when other parts of the same program do use it. At the same time, the design supports an implementation that requires less (on-the-wire) bytecode and (on-device) machine code and metadata than the comparable translation that simulates these semantics using existing wasm structures. (We're still waiting on concrete data from a good implementation to back these claims up but we believe this to be the case, and our own prototype design is aligned with these claims.) Regarding the importance of the feature: Exception handling has immediate applicability to existing C++ code bases, many of which are built around efficient exception handling to propagate errors and perform unwinding during exception propagation. Partners with large existing code bases have been asking for this feature repeatedly. Exception handling is one of the last missing large pieces for good C++ support in webassembly. The current design is the result of extensive discussions and prototyping work in the wasm CG and has benefited from considering languages other than C++ (which was initially the only focus). It is a forward-looking MVP; we know it is possible to add tweaks such as "finally" and we believe it is compatible with larger semantic changes such as two-phase exception handling. The current design is likely sufficient to model exceptions in languages such as Java and is forward-compatible to a richer system that can handle languages such as C#. The design is web-aware and it is possible for JS code to interact smoothly with wasm code that uses exceptions. We are already prototyping this feature (cf intent-to-prototype sent to the old dev-platform@moz by Asumu Takikawa on 25 March 2021, https://groups.google.com/g/mozilla.dev.platform/c/9ioehBRsEnw) and plan to ship it once it is complete and standardized. |
Request for Mozilla Position on WebAssembly Exception Handling
The text was updated successfully, but these errors were encountered: