Add support for C++ exceptions
Host implementation should support running Wasm code that was built with C++ exceptions.
Notably, those functions must be implemented:
-
__cxa_begin_catch, -
__cxa_end_catch, -
__cxa_free_exception, -
__cxa_get_exception_ptr, -
__cxa_uncaught_exceptions, -
__cxa_find_matching_catch_2,__cxa_find_matching_catch_3,__cxa_find_matching_catch_4, -
__resumeException, -
getTempRet0, -
invoke_ii,invoke_iii,invoke_iiii,invoke_iiiii,invoke_v,invoke_vi,invoke_vii,invoke_viii,invoke_viiii, -
llvm_eh_typeid_for.
It looks like a large ABI extension. Is there a way around it? It feels odd to include libc++ ABI for non c++ code. Thinking of it as RPC, it looks very chatty.
Only the host implementations (i.e. Envoy and other proxies that wish to support C++ exceptions) need to implement this, so it wouldn't leak to non-C++ SDKs at all.
I couldn't find a way around it using various settings in Emscripten.
Is emscripten C++ exception supported in the native Wasmtime or any other native WASI runtime? If so, I would like to see their implementation but I couldn't find :\
I don't think so. But it's unclear if this is worth the trouble. We probably should wait until Wasm Exceptions are supported (see some discussion here: https://github.com/emscripten-core/emscripten/issues/12475), unless there is an urgent business need for it.
I see that emcc experimentally supports -fwasm-exception flag in LLVM(https://reviews.llvm.org/D67208) and the staging V8 has already implementation for that(https://bugs.chromium.org/p/v8/issues/detail?id=6577) based on the Wasm exception proposal.
https://github.com/emscripten-core/emscripten/issues/11233#issuecomment-635332613
now the latest V8 has been shipped with Wasm's native exception proposal and the latest Emscripten support for that. Maybe worth a try
Just wanted to check if anybody is able to get exceptions working in c++ wasm extensions in envoy. It is not working for us in envoy 1.15-alpha.9a54da0237daa254460ee2e92592ac0eeb602c56