[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)

Heejin Ahn via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 8 23:26:24 PST 2024


================
@@ -999,25 +1017,43 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module &M) {
       // Register __wasm_longjmp function, which calls __builtin_wasm_longjmp.
       FunctionType *FTy = FunctionType::get(
           IRB.getVoidTy(), {Int8PtrTy, IRB.getInt32Ty()}, false);
-      WasmLongjmpF = getEmscriptenFunction(FTy, "__wasm_longjmp", &M);
+      if (EnableWasmAltSjLj) {
+        WasmLongjmpF = getEmscriptenFunction(FTy, "__wasm_sjlj_longjmp", &M);
----------------
aheejin wrote:

Is this the final name? It's unclear what the difference between `__wasm_longjmp` and `__wasm_sjlj_longjmp` to people who are not familiar with the history... If the goal is to eventually to replace the current library, I'd want this to be new `__wasm_longjmp`. But given that we have to maintain both at this point, how about `__wasm_longjmp_new` or something? (I'm not too opinionated on this specific name, so please feel free to suggest otherwise.. but what I'm saying is, mainly, in the final version, I'd like to have only `__wasm_setjmp` and `__wasm_longjmp`, with your version. I think `_sjlj_` is a redundancy.

https://github.com/llvm/llvm-project/pull/84137


More information about the cfe-commits mailing list