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

Derek Schuff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 17:16:43 PDT 2018


dschuff added inline comments.


================
Comment at: lib/CodeGen/CGCXXABI.h:610
 
+struct CatchRetScope final : EHScopeStack::Cleanup {
+  llvm::CatchPadInst *CPI;
----------------
Should be `public`?


================
Comment at: lib/CodeGen/CGCleanup.h:630
   static const EHPersonality MSVC_CxxFrameHandler3;
+  static const EHPersonality GNU_Wasm_CPlusCPlus;
 
----------------
We might consider having 2 personalities: one for use with builtin exceptions, and other for emulated exceptions? I'm imagining that with this style of IR we might be able to do emulated exceptions better than we have for emscripten today. We don't have to think about that now, but maybe the name of the personality might reflect it: e.g. `GNU_Wasm_CPlusPlus_Native` (or builtin) vs `GNU_Wasm_CPlusPlus_Emulated` (or external).


================
Comment at: lib/CodeGen/CGException.cpp:1236
+  // them, we should unwind to the next EH enclosing scope. We generate a call
+  // to rethrow function here to do that.
+  if (EHPersonality::get(*this).isWasmPersonality() && !HasCatchAll) {
----------------
Why do we need to call `__cxa_rethrow` instead of just emitting a rethrow instruction intrinsic to unwind?


================
Comment at: lib/CodeGen/CGException.cpp:1534
+  // In case of wasm personality, we need to pass the exception value to
+  // __clang_call_terminate function.
+  if (getLangOpts().CPlusPlus &&
----------------
Why?


Repository:
  rC Clang

https://reviews.llvm.org/D44931





More information about the cfe-commits mailing list