[clang] [llvm] [WebAssembly] Implement an alternative translation for -wasm-enable-sjlj (PR #84137)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 23:26:22 PST 2024
https://github.com/aheejin commented:
Nice work! Sorry for the late reply. I thought we needed the table because we need to distinguish two different calls from the same function, for example, if `foo` calls `setjmp` and also recursively calls `foo` again, so the same callsite can have two different `setjmpId` (e.g., https://github.com/emscripten-core/emscripten/blob/main/test/core/test_longjmp3.c). But this fixes that problem by adding `function_invocation_id`, which is simpler and nicer.
I also ran all Emscripten SjLj tests with this implementation (+ your `rt.c`) and all of them seemed to pass. 🎉
---
I left some inline comments.
+ Given that we don't need `setjmpTableSize` anymore and `setjmpTable` doesn't change, we don't need the whole block here from line 1463 ~ line 1503 doing SSA updates anymore:
https://github.com/llvm/llvm-project/blob/578e66ac45dfcc5c739f3525bfb82d71282d925c/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp#L1409-L1449
So you can wrap this part with `(!EnableWasmAltSjLj)`.
https://github.com/llvm/llvm-project/pull/84137
More information about the llvm-commits
mailing list