-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Exceptions are slow in Wasm since the stack is unwound in a generic way.
One could experiment with changing the calling convention to return null on exception (storing the exception in a global value). That should not be too much work since it only involves the generated code (and the runtime code to invoke callbacks). The runtime would still throw Wasm exceptions.
Another approach would be to change the calling convention only for functions that may throw an exception and which we know are called from within an exception handler. If the optimized function may escape, we can call it from a wrapper function that will raise a Wasm exception. This will cover many cases like searching in a list or a map while keeping a faster calling convention in most cases.