Add libc++abi Objective-C exception bridge for WebAssembly - #417
Add libc++abi Objective-C exception bridge for WebAssembly#417HendrikHuebner wants to merge 1 commit into
Conversation
|
This looks very similar to the code in objcxx_eh_mingw, which also wraps C++ exceptions. Is there a reason to have an entirely new parallel implementation for WAsm? |
|
Conceptually its doing the same thing as The problem is that both rely on internal implementation details from different standard libraries. For targetting emscripten we need our type infos to be subclasses of libc++abi's The existing implementation relies on gcc/libsupc++ implementation details instead, where the I don't think these implementations can be merged, sadly. Edit: maybe some things could be reused, such as the implementation of |
This PR is the counterpart to llvm/llvm-project#215562.
For native WebAssembly exceptions, Clang emits references to the personality function
__gxx_wasm_personality_v0.In order to support Objective-C exception semantics for WASM targets, we could either define our own personality function, or box Objective-C exceptions inside of C++ exceptions and rely on emscriptens libc++abi / exception runtime to handle those correctly for us.
To support Objective-C catch semantics, we need to supply our own type info objects which override the
can_catchmethod of libc++abi's internal__shim_type_info.For now, this PR is Apple compatible but does not implement the non-compatible mode.
I'll leave this as future work. I'm not sure whether
AppleCompatibleModeis currently implemented as it was originally intended, since disabling compatibility would affect both@catchand C++catchhandler semantics as it is currently written, making them both use static-type matching instead of dynamic-type matching.