[PATCH] D44931: [WebAssembly] Use Windows EH instructions for Wasm EH

Heejin Ahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 07:15:40 PDT 2018


aheejin created this revision.
aheejin added reviewers: majnemer, dschuff.
Herald added subscribers: cfe-commits, sunfish, jgravelle-google, sbc100, jfb.

Because wasm control flow needs to be structured, using WinEH
instructions to support wasm EH brings several benefits. This patch
makes wasm EH uses Windows EH instructions, with some changes:

1. Because wasm uses a single catch block to catch all C++ exceptions, this merges all catch clauses into a single catchpad, within which we test the EH selector as in Itanium EH.
2. Generates a call to `__clang_call_terminate` in case a cleanup throws. Wasm does not have a runtime to handle this.
3. In case there is no catch-all clause, inserts a call to `__cxa_rethrow` at the end of a catchpad in order to unwind to an enclosing EH scope.


Repository:
  rC Clang

https://reviews.llvm.org/D44931

Files:
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGCleanup.h
  lib/CodeGen/CGException.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGenCXX/wasm-eh.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44931.139919.patch
Type: text/x-patch
Size: 27178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180327/2108f3c0/attachment-0001.bin>


More information about the cfe-commits mailing list