@@ -315,7 +315,6 @@ class WebAssemblyLowerEmscriptenEHSjLj final : public ModulePass {
315
315
bool EnableEmEH; // Enable Emscripten exception handling
316
316
bool EnableEmSjLj; // Enable Emscripten setjmp/longjmp handling
317
317
bool EnableWasmSjLj; // Enable Wasm setjmp/longjmp handling
318
- bool EnableWasmAltSjLj; // Alt ABI for EnableWasmSjLj
319
318
bool DoSjLj; // Whether we actually perform setjmp/longjmp handling
320
319
321
320
GlobalVariable *ThrewGV = nullptr ; // __THREW__ (Emscripten)
@@ -384,8 +383,7 @@ class WebAssemblyLowerEmscriptenEHSjLj final : public ModulePass {
384
383
WebAssemblyLowerEmscriptenEHSjLj ()
385
384
: ModulePass(ID), EnableEmEH(WebAssembly::WasmEnableEmEH),
386
385
EnableEmSjLj (WebAssembly::WasmEnableEmSjLj),
387
- EnableWasmSjLj(WebAssembly::WasmEnableSjLj),
388
- EnableWasmAltSjLj(WebAssembly::WasmEnableAltSjLj) {
386
+ EnableWasmSjLj(WebAssembly::WasmEnableSjLj) {
389
387
assert (!(EnableEmSjLj && EnableWasmSjLj) &&
390
388
" Two SjLj modes cannot be turned on at the same time" );
391
389
assert (!(EnableEmEH && EnableWasmSjLj) &&
@@ -1017,7 +1015,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module &M) {
1017
1015
// Register __wasm_longjmp function, which calls __builtin_wasm_longjmp.
1018
1016
FunctionType *FTy = FunctionType::get (
1019
1017
IRB.getVoidTy (), {Int8PtrTy, IRB.getInt32Ty ()}, false );
1020
- if (EnableWasmAltSjLj ) {
1018
+ if (EnableWasmSjLj ) {
1021
1019
WasmLongjmpF = getEmscriptenFunction (FTy, " __wasm_sjlj_longjmp" , &M);
1022
1020
} else {
1023
1021
WasmLongjmpF = getEmscriptenFunction (FTy, " __wasm_longjmp" , &M);
@@ -1030,7 +1028,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runOnModule(Module &M) {
1030
1028
Type *Int32PtrTy = IRB.getPtrTy ();
1031
1029
Type *Int32Ty = IRB.getInt32Ty ();
1032
1030
1033
- if (EnableWasmAltSjLj ) {
1031
+ if (EnableWasmSjLj ) {
1034
1032
// Register saveSetjmp function
1035
1033
FunctionType *SetjmpFTy = SetjmpF->getFunctionType ();
1036
1034
FunctionType *FTy = FunctionType::get (
@@ -1317,7 +1315,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function &F) {
1317
1315
1318
1316
BinaryOperator *SetjmpTableSize;
1319
1317
Instruction *SetjmpTable;
1320
- if (EnableWasmAltSjLj ) {
1318
+ if (EnableWasmSjLj ) {
1321
1319
IRB.SetInsertPoint (Entry->getTerminator ());
1322
1320
// This alloca'ed pointer is used by the runtime to identify function
1323
1321
// inovactions. It's just for pointer comparisons. It will never
@@ -1397,7 +1395,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function &F) {
1397
1395
// Our index in the function is our place in the array + 1 to avoid index
1398
1396
// 0, because index 0 means the longjmp is not ours to handle.
1399
1397
IRB.SetInsertPoint (CI);
1400
- if (EnableWasmAltSjLj ) {
1398
+ if (EnableWasmSjLj ) {
1401
1399
Value *Args[] = {CI->getArgOperand (0 ), IRB.getInt32 (SetjmpRetPHIs.size ()),
1402
1400
SetjmpTable};
1403
1401
IRB.CreateCall (SaveSetjmpF, Args);
@@ -1426,7 +1424,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runSjLjOnFunction(Function &F) {
1426
1424
for (Instruction *I : ToErase)
1427
1425
I->eraseFromParent ();
1428
1426
1429
- if (!EnableWasmAltSjLj ) {
1427
+ if (!EnableWasmSjLj ) {
1430
1428
// Free setjmpTable buffer before each return instruction + function-exiting
1431
1429
// call
1432
1430
SmallVector<Instruction *, 16 > ExitingInsts;
@@ -1794,16 +1792,8 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
1794
1792
BasicBlock *ThenBB = BasicBlock::Create (C, " if.then" , &F);
1795
1793
BasicBlock *EndBB = BasicBlock::Create (C, " if.end" , &F);
1796
1794
Value *EnvP = IRB.CreateBitCast (Env, getAddrPtrType (&M), " env.p" );
1797
- Value *Label;
1798
- if (EnableWasmAltSjLj) {
1799
- Label = IRB.CreateCall (TestSetjmpF, {EnvP, SetjmpTable},
1800
- OperandBundleDef (" funclet" , CatchPad), " label" );
1801
- } else {
1802
- Value *SetjmpID = IRB.CreateLoad (getAddrIntType (&M), EnvP, " setjmp.id" );
1803
- Label =
1804
- IRB.CreateCall (TestSetjmpF, {SetjmpID, SetjmpTable, SetjmpTableSize},
1805
- OperandBundleDef (" funclet" , CatchPad), " label" );
1806
- }
1795
+ Value *Label = IRB.CreateCall (TestSetjmpF, {EnvP, SetjmpTable},
1796
+ OperandBundleDef (" funclet" , CatchPad), " label" );
1807
1797
Value *Cmp = IRB.CreateICmpEQ (Label, IRB.getInt32 (0 ));
1808
1798
IRB.CreateCondBr (Cmp, ThenBB, EndBB);
1809
1799
0 commit comments