Skip to content

Commit 1b3950d

Browse files
authored
Add some comments regarding __c_longjmp. NFC (#21442)
1 parent c0cda71 commit 1b3950d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

system/lib/compiler-rt/emscripten_setjmp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ struct __WasmLongjmpArgs {
8181

8282
thread_local struct __WasmLongjmpArgs __wasm_longjmp_args;
8383

84+
// llvm uses `1` for the __c_longjmp tag.
85+
// See https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
86+
#define C_LONGJMP 1
87+
8488
// Wasm EH allows us to throw and catch multiple values, but that requires
8589
// multivalue support in the toolchain, whch is not reliable at the time.
8690
// TODO Consider switching to throwing two values at the same time later.
8791
void __wasm_longjmp(void *env, int val) {
8892
__wasm_longjmp_args.env = env;
8993
__wasm_longjmp_args.val = val;
90-
__builtin_wasm_throw(1, &__wasm_longjmp_args);
94+
__builtin_wasm_throw(C_LONGJMP, &__wasm_longjmp_args);
9195
}
9296

9397
#endif

0 commit comments

Comments
 (0)