[libcxx-commits] [PATCH] D158918: [libc++abi][WebAssembly] Support Wasm EH

Heejin Ahn via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 25 20:19:17 PDT 2023


aheejin created this revision.
aheejin added reviewers: dschuff, sbc100.
Herald added subscribers: pmatos, wingo, sunfish, jgravelle-google.
Herald added a project: All.
aheejin requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

This adds Wasm-specific libc++abi changes to support Wasm exception
handling (https://github.com/WebAssembly/exception-handling).

Wasm EH requires `__USING_WASM_EXCEPTIONS__` to be defined. Changes are:

- In Wasm, a destructor returns its argument.
- Wasm EH's LSDA handling mostly shared that of SjLj EH. So we defined a shared macro, `__USING_SJLJ_OR_WASM_EXCEPTIONS__` in `cxa_personality.cpp`, and used it in place of the current `__USING_SJLJ_EXCEPTIONS__`.
- Wasm EH currently only has one phase (search) that does both search and cleanup. So added an additional `set_registers` to support that.

The bulk of these changes was added back in Mar 2020 in
https://github.com/emscripten-core/emscripten/pull/10577 to emscripten
repo and has been used ever since. Now we'd like to upstream this so
that other toolchains that don't use emscripten libraries, e.g., WASI,
can use this too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158918

Files:
  libcxxabi/include/cxxabi.h
  libcxxabi/src/cxa_exception.cpp
  libcxxabi/src/cxa_exception.h
  libcxxabi/src/cxa_personality.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158918.553693.patch
Type: text/x-patch
Size: 9073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230826/db5b2306/attachment-0001.bin>


More information about the libcxx-commits mailing list