diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index 5e49c861468..db0dbc66f37 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -43,15 +43,6 @@ ("data.drop", "makeDataDrop(s)"), ("memory.copy", "makeMemoryCopy(s)"), ("memory.fill", "makeMemoryFill(s)"), - ("i32.pop", "makePop(Type::i32)"), - ("i64.pop", "makePop(Type::i64)"), - ("f32.pop", "makePop(Type::f32)"), - ("f64.pop", "makePop(Type::f64)"), - ("v128.pop", "makePop(Type::v128)"), - ("funcref.pop", "makePop(Type::funcref)"), - ("externref.pop", "makePop(Type::externref)"), - ("exnref.pop", "makePop(Type::exnref)"), - ("anyref.pop", "makePop(Type::anyref)"), ("i32.load", "makeLoad(s, Type::i32, /*isAtomic=*/false)"), ("i64.load", "makeLoad(s, Type::i64, /*isAtomic=*/false)"), ("f32.load", "makeLoad(s, Type::f32, /*isAtomic=*/false)"), @@ -503,7 +494,8 @@ ("br_on_exn", "makeBrOnExn(s)"), # Multivalue pseudoinstructions ("tuple.make", "makeTupleMake(s)"), - ("tuple.extract", "makeTupleExtract(s)") + ("tuple.extract", "makeTupleExtract(s)"), + ("pop", "makePop(s)") ] diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index 4b02b09c27b..6d9160c8898 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -8,21 +8,13 @@ char op[27] = {'\0'}; strncpy(op, s[0]->c_str(), 26); switch (op[0]) { case 'a': { - switch (op[1]) { + switch (op[7]) { + case 'f': + if (strcmp(op, "atomic.fence") == 0) { return makeAtomicFence(s); } + goto parse_error; case 'n': - if (strcmp(op, "anyref.pop") == 0) { return makePop(Type::anyref); } + if (strcmp(op, "atomic.notify") == 0) { return makeAtomicNotify(s); } goto parse_error; - case 't': { - switch (op[7]) { - case 'f': - if (strcmp(op, "atomic.fence") == 0) { return makeAtomicFence(s); } - goto parse_error; - case 'n': - if (strcmp(op, "atomic.notify") == 0) { return makeAtomicNotify(s); } - goto parse_error; - default: goto parse_error; - } - } default: goto parse_error; } } @@ -78,25 +70,9 @@ switch (op[0]) { default: goto parse_error; } } - case 'e': { - switch (op[1]) { - case 'l': - if (strcmp(op, "else") == 0) { return makeThenOrElse(s); } - goto parse_error; - case 'x': { - switch (op[2]) { - case 'n': - if (strcmp(op, "exnref.pop") == 0) { return makePop(Type::exnref); } - goto parse_error; - case 't': - if (strcmp(op, "externref.pop") == 0) { return makePop(Type::externref); } - goto parse_error; - default: goto parse_error; - } - } - default: goto parse_error; - } - } + case 'e': + if (strcmp(op, "else") == 0) { return makeThenOrElse(s); } + goto parse_error; case 'f': { switch (op[1]) { case '3': { @@ -235,9 +211,6 @@ switch (op[0]) { default: goto parse_error; } } - case 'p': - if (strcmp(op, "f32.pop") == 0) { return makePop(Type::f32); } - goto parse_error; case 'r': if (strcmp(op, "f32.reinterpret_i32") == 0) { return makeUnary(s, UnaryOp::ReinterpretInt32); } goto parse_error; @@ -536,17 +509,9 @@ switch (op[0]) { default: goto parse_error; } } - case 'p': { - switch (op[5]) { - case 'o': - if (strcmp(op, "f64.pop") == 0) { return makePop(Type::f64); } - goto parse_error; - case 'r': - if (strcmp(op, "f64.promote_f32") == 0) { return makeUnary(s, UnaryOp::PromoteFloat32); } - goto parse_error; - default: goto parse_error; - } - } + case 'p': + if (strcmp(op, "f64.promote_f32") == 0) { return makeUnary(s, UnaryOp::PromoteFloat32); } + goto parse_error; case 'r': if (strcmp(op, "f64.reinterpret_i64") == 0) { return makeUnary(s, UnaryOp::ReinterpretInt64); } goto parse_error; @@ -717,9 +682,6 @@ switch (op[0]) { default: goto parse_error; } } - case 'u': - if (strcmp(op, "funcref.pop") == 0) { return makePop(Type::funcref); } - goto parse_error; default: goto parse_error; } } @@ -1306,17 +1268,9 @@ switch (op[0]) { case 'o': if (strcmp(op, "i32.or") == 0) { return makeBinary(s, BinaryOp::OrInt32); } goto parse_error; - case 'p': { - switch (op[7]) { - case '\0': - if (strcmp(op, "i32.pop") == 0) { return makePop(Type::i32); } - goto parse_error; - case 'c': - if (strcmp(op, "i32.popcnt") == 0) { return makeUnary(s, UnaryOp::PopcntInt32); } - goto parse_error; - default: goto parse_error; - } - } + case 'p': + if (strcmp(op, "i32.popcnt") == 0) { return makeUnary(s, UnaryOp::PopcntInt32); } + goto parse_error; case 'r': { switch (op[5]) { case 'e': { @@ -2056,17 +2010,9 @@ switch (op[0]) { case 'o': if (strcmp(op, "i64.or") == 0) { return makeBinary(s, BinaryOp::OrInt64); } goto parse_error; - case 'p': { - switch (op[7]) { - case '\0': - if (strcmp(op, "i64.pop") == 0) { return makePop(Type::i64); } - goto parse_error; - case 'c': - if (strcmp(op, "i64.popcnt") == 0) { return makeUnary(s, UnaryOp::PopcntInt64); } - goto parse_error; - default: goto parse_error; - } - } + case 'p': + if (strcmp(op, "i64.popcnt") == 0) { return makeUnary(s, UnaryOp::PopcntInt64); } + goto parse_error; case 'r': { switch (op[5]) { case 'e': { @@ -2571,6 +2517,9 @@ switch (op[0]) { case 'n': if (strcmp(op, "nop") == 0) { return makeNop(); } goto parse_error; + case 'p': + if (strcmp(op, "pop") == 0) { return makePop(s); } + goto parse_error; case 'r': { switch (op[2]) { case 'f': { @@ -2696,9 +2645,6 @@ switch (op[0]) { case 'o': if (strcmp(op, "v128.or") == 0) { return makeBinary(s, BinaryOp::OrVec128); } goto parse_error; - case 'p': - if (strcmp(op, "v128.pop") == 0) { return makePop(Type::v128); } - goto parse_error; case 's': if (strcmp(op, "v128.store") == 0) { return makeStore(s, Type::v128, /*isAtomic=*/false); } goto parse_error; diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 04fcdc0b35a..f4131db37fd 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -1469,8 +1469,11 @@ struct PrintExpressionContents void visitNop(Nop* curr) { printMinor(o, "nop"); } void visitUnreachable(Unreachable* curr) { printMinor(o, "unreachable"); } void visitPop(Pop* curr) { - prepareColor(o) << curr->type; - o << ".pop"; + prepareColor(o) << "pop"; + for (auto type : curr->type) { + assert(type.isBasic() && "TODO: print and parse compound types"); + o << " " << type; + } restoreNormalColor(o); } void visitTupleMake(TupleMake* curr) { printMedium(o, "tuple.make"); } diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index d77062e3379..a4559012d24 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -217,7 +217,7 @@ class SExpressionWasmBuilder { Expression* makeMemoryCopy(Element& s); Expression* makeMemoryFill(Element& s); Expression* makePush(Element& s); - Expression* makePop(Type type); + Expression* makePop(Element& s); Expression* makeIf(Element& s); Expression* makeMaybeBlock(Element& s, size_t i, Type type); Expression* makeLoop(Element& s); diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index e4a33c03419..97bfe55f952 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1620,9 +1620,13 @@ Expression* SExpressionWasmBuilder::makeMemoryFill(Element& s) { return ret; } -Expression* SExpressionWasmBuilder::makePop(Type type) { +Expression* SExpressionWasmBuilder::makePop(Element& s) { auto ret = allocator.alloc(); - ret->type = type; + std::vector types; + for (size_t i = 1; i < s.size(); ++i) { + types.push_back(stringToType(s[i]->str())); + } + ret->type = Type(types); ret->finalize(); return ret; } diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt index d590d0b4b82..21eb9a70ddc 100644 --- a/test/binaryen.js/exception-handling.js.txt +++ b/test/binaryen.js/exception-handling.js.txt @@ -12,7 +12,7 @@ ) (catch (local.set $0 - (exnref.pop) + (pop exnref) ) (drop (block $l (result i32) diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 52b15f8ff34..d31e341b2ea 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -1844,7 +1844,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) (catch (local.set $5 - (exnref.pop) + (pop exnref) ) (drop (block $try-block (result i32) @@ -1896,28 +1896,28 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) (drop - (i32.pop) + (pop i32) ) (drop - (i64.pop) + (pop i64) ) (drop - (f32.pop) + (pop f32) ) (drop - (f64.pop) + (pop f64) ) (drop - (v128.pop) + (pop v128) ) (drop - (externref.pop) + (pop externref) ) (drop - (funcref.pop) + (pop funcref) ) (drop - (exnref.pop) + (pop exnref) ) (nop) (unreachable) @@ -3684,7 +3684,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) (catch (local.set $5 - (exnref.pop) + (pop exnref) ) (drop (block $try-block (result i32) @@ -3736,28 +3736,28 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} ) ) (drop - (i32.pop) + (pop i32) ) (drop - (i64.pop) + (pop i64) ) (drop - (f32.pop) + (pop f32) ) (drop - (f64.pop) + (pop f64) ) (drop - (v128.pop) + (pop v128) ) (drop - (externref.pop) + (pop externref) ) (drop - (funcref.pop) + (pop funcref) ) (drop - (exnref.pop) + (pop exnref) ) (nop) (unreachable) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index e242cfc8e02..e6450db6c77 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -723,8 +723,11 @@ void test_core() { BinaryenRefIsNull(module, externrefExpr), BinaryenRefIsNull(module, funcrefExpr), BinaryenRefIsNull(module, exnrefExpr), - BinaryenSelect( - module, temp10, BinaryenRefNull(module, BinaryenTypeFuncref()), BinaryenRefFunc(module, "kitchen()sinker"), BinaryenTypeFuncref()), + BinaryenSelect(module, + temp10, + BinaryenRefNull(module, BinaryenTypeFuncref()), + BinaryenRefFunc(module, "kitchen()sinker"), + BinaryenTypeFuncref()), // Exception handling BinaryenTry(module, tryBody, catchBody), // Atomics @@ -752,6 +755,7 @@ void test_core() { BinaryenPop(module, BinaryenTypeFuncref()), BinaryenPop(module, BinaryenTypeExternref()), BinaryenPop(module, BinaryenTypeExnref()), + BinaryenPop(module, iIfF), // TODO: Host BinaryenNop(module), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index c5958ff1d87..d4ff78dd2a1 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -1782,7 +1782,7 @@ BinaryenFeatureAll: 2047 ) (catch (local.set $5 - (exnref.pop) + (pop exnref) ) (drop (block $try-block (result i32) @@ -1834,25 +1834,28 @@ BinaryenFeatureAll: 2047 ) ) (drop - (i32.pop) + (pop i32) ) (drop - (i64.pop) + (pop i64) ) (drop - (f32.pop) + (pop f32) ) (drop - (f64.pop) + (pop f64) ) (drop - (funcref.pop) + (pop funcref) ) (drop - (externref.pop) + (pop externref) ) (drop - (exnref.pop) + (pop exnref) + ) + (drop + (pop i32 i64 f32 f64) ) (nop) (unreachable) diff --git a/test/exception-handling.wast b/test/exception-handling.wast index 3dcff41e4e6..862b82d88ee 100644 --- a/test/exception-handling.wast +++ b/test/exception-handling.wast @@ -17,7 +17,7 @@ (catch ;; Multi-value is not available yet, so block can't take a value from ;; stack. So this uses locals for now. - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (drop (block $l0 (result i32) (rethrow @@ -42,7 +42,7 @@ (try (do) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) @@ -53,7 +53,7 @@ (call $bar) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (call $foo) (call $bar) ) diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast index a5fb02d56a4..9fd06c0b1aa 100644 --- a/test/exception-handling.wast.from-wast +++ b/test/exception-handling.wast.from-wast @@ -24,7 +24,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (drop (block $l0 (result i32) @@ -53,7 +53,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -64,7 +64,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (call $foo) (call $bar) diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary index 24af9294e67..7add5b33e04 100644 --- a/test/exception-handling.wast.fromBinary +++ b/test/exception-handling.wast.fromBinary @@ -24,7 +24,7 @@ ) (catch (local.set $0 - (exnref.pop) + (pop exnref) ) (drop (block $label$3 (result i32) @@ -44,7 +44,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (br $label$4) ) @@ -56,7 +56,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -67,7 +67,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (call $foo) (call $bar) diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo index 69abafdbf6b..0b5a7d89667 100644 --- a/test/exception-handling.wast.fromBinary.noDebugInfo +++ b/test/exception-handling.wast.fromBinary.noDebugInfo @@ -24,7 +24,7 @@ ) (catch (local.set $0 - (exnref.pop) + (pop exnref) ) (drop (block $label$3 (result i32) @@ -44,7 +44,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (br $label$4) ) @@ -56,7 +56,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -67,7 +67,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (call $1) (call $2) diff --git a/test/passes/Os_print-stack-ir.txt b/test/passes/Os_print-stack-ir_all-features.txt similarity index 84% rename from test/passes/Os_print-stack-ir.txt rename to test/passes/Os_print-stack-ir_all-features.txt index 9fbde2f4a9e..7e880985ed4 100644 --- a/test/passes/Os_print-stack-ir.txt +++ b/test/passes/Os_print-stack-ir_all-features.txt @@ -41,6 +41,7 @@ ) (module (type $none_=>_i32 (func (result i32))) + (type $none_=>_i32_f64 (func (result i32 f64))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32 (func (result f32))) (type $none_=>_f64 (func (result f64))) @@ -48,6 +49,7 @@ (export "ppi64" (func $1)) (export "ppf32" (func $2)) (export "ppf64" (func $3)) + (export "pair" (func $4)) (func $0 (result i32) ) @@ -59,10 +61,14 @@ ) (func $3 (result f64) + ) + (func $4 (result i32 f64) + ) ) (module (type $none_=>_i32 (func (result i32))) + (type $none_=>_i32_f64 (func (result i32 f64))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32 (func (result f32))) (type $none_=>_f64 (func (result f64))) @@ -70,16 +76,20 @@ (export "ppi64" (func $1)) (export "ppf32" (func $2)) (export "ppf64" (func $3)) + (export "pair" (func $4)) (func $0 (; has Stack IR ;) (result i32) - (i32.pop) + (pop i32) ) (func $1 (; has Stack IR ;) (result i64) - (i64.pop) + (pop i64) ) (func $2 (; has Stack IR ;) (result f32) - (f32.pop) + (pop f32) ) (func $3 (; has Stack IR ;) (result f64) - (f64.pop) + (pop f64) + ) + (func $4 (; has Stack IR ;) (result i32 f64) + (pop i32 f64) ) ) diff --git a/test/passes/Os_print-stack-ir.wast b/test/passes/Os_print-stack-ir_all-features.wast similarity index 86% rename from test/passes/Os_print-stack-ir.wast rename to test/passes/Os_print-stack-ir_all-features.wast index 6944a320770..8521c40473c 100644 --- a/test/passes/Os_print-stack-ir.wast +++ b/test/passes/Os_print-stack-ir_all-features.wast @@ -19,15 +19,18 @@ ;; used alone. This just tests we can emit them/handle them in the ;; optimizer. (func "ppi32" (result i32) - (i32.pop) + (pop i32) ) (func "ppi64" (result i64) - (i64.pop) + (pop i64) ) (func "ppf32" (result f32) - (f32.pop) + (pop f32) ) (func "ppf64" (result f64) - (f64.pop) + (pop f64) + ) + (func "pair" (result i32 f64) + (pop i32 f64) ) ) diff --git a/test/passes/code-pushing_all-features.txt b/test/passes/code-pushing_all-features.txt index 90215ff2f7e..30eb7e45816 100644 --- a/test/passes/code-pushing_all-features.txt +++ b/test/passes/code-pushing_all-features.txt @@ -51,7 +51,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -83,7 +83,7 @@ ) (catch (rethrow - (exnref.pop) + (pop exnref) ) ) ) diff --git a/test/passes/code-pushing_all-features.wast b/test/passes/code-pushing_all-features.wast index 725ddf010c8..b67b98d7e81 100644 --- a/test/passes/code-pushing_all-features.wast +++ b/test/passes/code-pushing_all-features.wast @@ -36,7 +36,7 @@ (throw $e (i32.const 0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) (drop (i32.const 1)) @@ -56,7 +56,7 @@ (throw $e (i32.const 0)) ) (catch - (rethrow (exnref.pop)) + (rethrow (pop exnref)) ) ) (drop (i32.const 1)) diff --git a/test/passes/dce_all-features.txt b/test/passes/dce_all-features.txt index c5094b301f2..4b76b2f12ba 100644 --- a/test/passes/dce_all-features.txt +++ b/test/passes/dce_all-features.txt @@ -514,7 +514,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) diff --git a/test/passes/dce_all-features.wast b/test/passes/dce_all-features.wast index 78324b941de..bf0c188d0cd 100644 --- a/test/passes/dce_all-features.wast +++ b/test/passes/dce_all-features.wast @@ -748,7 +748,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) diff --git a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.txt b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.txt index ada155fd640..28348883ad7 100644 --- a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.txt +++ b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.txt @@ -33,7 +33,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (drop (block $l0 (result i32) diff --git a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.wast b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.wast index 6a53b22834a..e2bbfff2d49 100644 --- a/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.wast +++ b/test/passes/generate-stack-ir_optimize-stack-ir_print-stack-ir_all-features.wast @@ -7,7 +7,7 @@ (throw $e0 (i32.const 0)) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (drop (block $l0 (result i32) (rethrow diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index cb46cb3efcb..8943c2d5641 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -237,13 +237,13 @@ ) ) (local.set $F - (funcref.pop) + (pop funcref) ) (local.set $X - (externref.pop) + (pop externref) ) (local.set $E - (exnref.pop) + (pop exnref) ) (drop (call $get_v128 diff --git a/test/passes/instrument-locals_all-features.wast b/test/passes/instrument-locals_all-features.wast index 2110ce7dbb3..4b396a79bde 100644 --- a/test/passes/instrument-locals_all-features.wast +++ b/test/passes/instrument-locals_all-features.wast @@ -42,9 +42,9 @@ (local.set $E (local.get $E)) ;; Pop instructions should not be instrumented - (local.set $F (funcref.pop)) - (local.set $X (externref.pop)) - (local.set $E (exnref.pop)) + (local.set $F (pop funcref)) + (local.set $X (pop externref)) + (local.set $E (pop exnref)) ;; Add new instructions here so expected output doesn't change too much, it ;; depends on order of instructions in this file. @@ -52,4 +52,3 @@ (local.set $S (v128.const i32x4 0x00000000 0x00000001 0x00000002 0x00000003)) ) ) - diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index 6ff608ab77c..f223cb838c4 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -225,7 +225,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.const 456) ) diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index aafb6c9d8b7..6e106ad1b08 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -249,7 +249,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.eqz (i32.eqz diff --git a/test/passes/remove-unused-module-elements_all-features.txt b/test/passes/remove-unused-module-elements_all-features.txt index b04e00a5e54..47f02aeb5e8 100644 --- a/test/passes/remove-unused-module-elements_all-features.txt +++ b/test/passes/remove-unused-module-elements_all-features.txt @@ -297,7 +297,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (drop (block $l0 (result i32) diff --git a/test/passes/remove-unused-module-elements_all-features.wast b/test/passes/remove-unused-module-elements_all-features.wast index edbb5aab28c..265ef0e5f2a 100644 --- a/test/passes/remove-unused-module-elements_all-features.wast +++ b/test/passes/remove-unused-module-elements_all-features.wast @@ -276,7 +276,7 @@ (throw $e-throw (i32.const 0)) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (drop (block $l0 (result i32) (rethrow diff --git a/test/passes/remove-unused-names_code-folding_all-features.txt b/test/passes/remove-unused-names_code-folding_all-features.txt index 9465451446d..c9e9b90e765 100644 --- a/test/passes/remove-unused-names_code-folding_all-features.txt +++ b/test/passes/remove-unused-names_code-folding_all-features.txt @@ -1721,7 +1721,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (br $folding-inner0) ) @@ -1729,7 +1729,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (br $folding-inner0) ) @@ -1804,7 +1804,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (call $foo) (call $foo) @@ -1823,7 +1823,7 @@ (try (do (local.set $exn - (exnref.pop) + (pop exnref) ) (call $foo) (call $foo) @@ -1832,7 +1832,7 @@ ) (catch (local.set $exn - (exnref.pop) + (pop exnref) ) (call $foo) (call $foo) diff --git a/test/passes/remove-unused-names_code-folding_all-features.wast b/test/passes/remove-unused-names_code-folding_all-features.wast index b982a10fb50..a35fe6cdafc 100644 --- a/test/passes/remove-unused-names_code-folding_all-features.wast +++ b/test/passes/remove-unused-names_code-folding_all-features.wast @@ -1198,9 +1198,9 @@ (try (do) (catch - ;; Expressions containing exnref.pop should NOT be taken out and + ;; Expressions containing (pop exnref) should NOT be taken out and ;; folded. - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (drop (i32.const 111)) (drop (i32.const 222)) (drop (i32.const 333)) @@ -1209,7 +1209,7 @@ ) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (drop (i32.const 111)) (drop (i32.const 222)) (drop (i32.const 333)) @@ -1257,7 +1257,7 @@ (return (ref.null exn)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (call $foo) (call $foo) (call $foo) @@ -1273,14 +1273,14 @@ (try (do ;; Expressions that can throw should NOT be taken out of 'try' scope. - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (call $foo) (call $foo) (call $foo) (br $x) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (call $foo) (call $foo) (call $foo) diff --git a/test/passes/remove-unused-names_optimize-instructions_all-features.txt b/test/passes/remove-unused-names_optimize-instructions_all-features.txt index 182916755c4..8b7fc343b12 100644 --- a/test/passes/remove-unused-names_optimize-instructions_all-features.txt +++ b/test/passes/remove-unused-names_optimize-instructions_all-features.txt @@ -17,7 +17,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.const 3) ) @@ -34,7 +34,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.const 3) ) @@ -57,7 +57,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -65,7 +65,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.const 3) ) @@ -83,7 +83,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (throw $e (i32.const 0) @@ -94,7 +94,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (i32.const 3) ) diff --git a/test/passes/remove-unused-names_optimize-instructions_all-features.wast b/test/passes/remove-unused-names_optimize-instructions_all-features.wast index 119667f4292..7c75c2bcf90 100644 --- a/test/passes/remove-unused-names_optimize-instructions_all-features.wast +++ b/test/passes/remove-unused-names_optimize-instructions_all-features.wast @@ -15,7 +15,7 @@ (i32.const 1) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) @@ -30,7 +30,7 @@ (i32.const 1) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) @@ -46,13 +46,13 @@ (throw $e (i32.const 0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) (i32.const 1) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) @@ -66,14 +66,14 @@ (try (do) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (throw $e (i32.const 0)) ) ) (i32.const 1) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) diff --git a/test/passes/rse_all-features.txt b/test/passes/rse_all-features.txt index b66cad73594..95773bb237b 100644 --- a/test/passes/rse_all-features.txt +++ b/test/passes/rse_all-features.txt @@ -483,7 +483,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.set $x (i32.const 1) @@ -507,7 +507,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -525,7 +525,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.set $x (i32.const 1) @@ -550,7 +550,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -569,7 +569,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -589,14 +589,14 @@ ) (catch (rethrow - (exnref.pop) + (pop exnref) ) ) ) ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.set $x (i32.const 1) diff --git a/test/passes/rse_all-features.wast b/test/passes/rse_all-features.wast index 0f5f72c1706..d77dae379e0 100644 --- a/test/passes/rse_all-features.wast +++ b/test/passes/rse_all-features.wast @@ -293,7 +293,7 @@ (try (do) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.set $x (i32.const 1)) ) ) @@ -307,7 +307,7 @@ (local.set $x (i32.const 1)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) (local.set $x (i32.const 1)) ;; should NOT be dropped @@ -319,7 +319,7 @@ (throw $e (i32.const 0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.set $x (i32.const 1)) ) ) @@ -334,7 +334,7 @@ (local.set $x (i32.const 1)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) (local.set $x (i32.const 1)) ;; should NOT be dropped @@ -347,7 +347,7 @@ (call $foo) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) (local.set $x (i32.const 1)) ;; should be dropped @@ -361,12 +361,12 @@ (throw $e (i32.const 0)) ) (catch - (rethrow (exnref.pop)) + (rethrow (pop exnref)) ) ) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.set $x (i32.const 1)) ) ) diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt index e04b8fb7a96..81fca48efde 100644 --- a/test/passes/simplify-locals_all-features.txt +++ b/test/passes/simplify-locals_all-features.txt @@ -1952,7 +1952,7 @@ ) (catch (local.set $0 - (exnref.pop) + (pop exnref) ) (call $foo (i32.const 3) @@ -1976,7 +1976,7 @@ (ref.null exn) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -1999,7 +1999,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) @@ -2015,7 +2015,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) ) ) diff --git a/test/passes/simplify-locals_all-features.wast b/test/passes/simplify-locals_all-features.wast index 0a51e5371a2..177b096884a 100644 --- a/test/passes/simplify-locals_all-features.wast +++ b/test/passes/simplify-locals_all-features.wast @@ -1717,10 +1717,10 @@ (try (do) (catch - ;; This (local.set $0) of (exnref.pop) cannot be sinked to - ;; (local.get $0) below, because exnref.pop should follow right after + ;; This (local.set $0) of (pop exnref) cannot be sinked to + ;; (local.get $0) below, because pop exnref should follow right after ;; 'catch'. - (local.set $0 (exnref.pop)) + (local.set $0 (pop exnref)) (call $foo (i32.const 3) (local.get $0) @@ -1739,7 +1739,7 @@ (local.set $0 (try (result exnref) (do (ref.null exn)) - (catch (exnref.pop)) + (catch (pop exnref)) ) ) (call $foo @@ -1762,7 +1762,7 @@ (drop (local.get $0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) ) @@ -1777,7 +1777,7 @@ (drop (local.get $0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) ) diff --git a/test/passes/vacuum_all-features.txt b/test/passes/vacuum_all-features.txt index 351a84a9a7f..2581f765483 100644 --- a/test/passes/vacuum_all-features.txt +++ b/test/passes/vacuum_all-features.txt @@ -457,7 +457,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.set $0 (i32.const 1) diff --git a/test/passes/vacuum_all-features.wast b/test/passes/vacuum_all-features.wast index 593fed09885..9eb13b55fa9 100644 --- a/test/passes/vacuum_all-features.wast +++ b/test/passes/vacuum_all-features.wast @@ -805,7 +805,7 @@ (drop (i32.const 0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) ) @@ -820,13 +820,13 @@ (throw $e (i32.const 0)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.set $0 (i32.const 1)) ) ) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) ) ) ) @@ -841,7 +841,7 @@ (unreachable) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (br $label$1) ) ) diff --git a/test/reference-types.wast b/test/reference-types.wast index ad0f908ce47..ddc3550c537 100644 --- a/test/reference-types.wast +++ b/test/reference-types.wast @@ -463,7 +463,7 @@ (local.get $local_externref) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (ref.null extern) ) ) @@ -474,7 +474,7 @@ (ref.func $foo) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (ref.null func) ) ) @@ -485,7 +485,7 @@ (ref.null exn) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -497,7 +497,7 @@ (local.get $local_externref) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (ref.func $foo) ) ) @@ -508,7 +508,7 @@ (local.get $local_externref) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -518,7 +518,7 @@ (ref.func $foo) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.get $local_externref) ) ) @@ -529,7 +529,7 @@ (ref.func $foo) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -539,18 +539,18 @@ (ref.null exn) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (local.get $local_externref) ) ) ) (drop - (try (result anyref) + (try (result anyref) (do (ref.null exn) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (ref.func $foo) ) ) @@ -588,7 +588,7 @@ ;; Test subtype relationship for typed select (drop - (select (result anyref) + (select (result anyref) (local.get $local_externref) (local.get $local_funcref) (i32.const 1) diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast index 4e82da60d2f..6a4bfede63a 100644 --- a/test/reference-types.wast.from-wast +++ b/test/reference-types.wast.from-wast @@ -702,7 +702,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null extern) ) @@ -715,7 +715,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null func) ) @@ -727,7 +727,7 @@ (ref.null exn) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -738,7 +738,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $foo) ) @@ -750,7 +750,7 @@ (local.get $local_externref) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -761,7 +761,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $local_externref) ) @@ -773,7 +773,7 @@ (ref.func $foo) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -784,7 +784,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $local_externref) ) @@ -797,7 +797,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $foo) ) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index c266e725a74..00e65130580 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -702,7 +702,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null extern) ) @@ -715,7 +715,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null func) ) @@ -727,7 +727,7 @@ (ref.null exn) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -738,7 +738,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $foo) ) @@ -750,7 +750,7 @@ (local.get $1) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -761,7 +761,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $1) ) @@ -773,7 +773,7 @@ (ref.func $foo) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -784,7 +784,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $1) ) @@ -797,7 +797,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $foo) ) diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo index e1d18827ec0..f3bddff54f8 100644 --- a/test/reference-types.wast.fromBinary.noDebugInfo +++ b/test/reference-types.wast.fromBinary.noDebugInfo @@ -702,7 +702,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null extern) ) @@ -715,7 +715,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.null func) ) @@ -727,7 +727,7 @@ (ref.null exn) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -738,7 +738,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $4) ) @@ -750,7 +750,7 @@ (local.get $1) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -761,7 +761,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $1) ) @@ -773,7 +773,7 @@ (ref.func $4) ) (catch - (exnref.pop) + (pop exnref) ) ) ) @@ -784,7 +784,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (local.get $1) ) @@ -797,7 +797,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (ref.func $4) ) diff --git a/test/spec/exception-handling.wast b/test/spec/exception-handling.wast index 0188865acba..05ecb97a957 100644 --- a/test/spec/exception-handling.wast +++ b/test/spec/exception-handling.wast @@ -21,7 +21,7 @@ (i32.const 3) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 0) ) ) @@ -33,7 +33,7 @@ (throw $e-i32 (i32.const 5)) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) @@ -46,7 +46,7 @@ (unreachable) ) (catch - (drop (exnref.pop)) + (drop (pop exnref)) (i32.const 3) ) ) @@ -58,7 +58,7 @@ (throw $e-i32 (i32.const 5)) ) (catch - (rethrow (exnref.pop)) + (rethrow (pop exnref)) ) ) ) @@ -69,7 +69,7 @@ (call $throw_single_value) ) (catch - (rethrow (exnref.pop)) + (rethrow (pop exnref)) ) ) ) @@ -89,7 +89,7 @@ (throw $e-v) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (rethrow (br_on_exn $l0 $e-v (local.get $exn)) @@ -105,7 +105,7 @@ (throw $e-i32 (i32.const 5)) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (result i32) (rethrow (br_on_exn $l0 $e-i32 (local.get $exn)) @@ -122,7 +122,7 @@ (throw $e-i32-f32 (i32.const 3) (f32.const 3.5)) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (result i32 f32) (rethrow (br_on_exn $l0 $e-i32-f32 (local.get $exn)) @@ -138,7 +138,7 @@ (throw $e-i32 (i32.const 5)) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (rethrow (br_on_exn $l0 $e-v (local.get $exn)) @@ -155,7 +155,7 @@ (unreachable) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (result i32) (rethrow (br_on_exn $l0 $e-i32 (local.get $exn)) @@ -172,7 +172,7 @@ (unreachable) ) (catch - (local.set $exn (exnref.pop)) + (local.set $exn (pop exnref)) (block $l0 (result i32) (rethrow (br_on_exn $l0 $e-i32 (local.get $exn)) diff --git a/test/try-body-multiple-insts.wasm.fromBinary b/test/try-body-multiple-insts.wasm.fromBinary index 1ecbdbbc616..179bb42abde 100644 --- a/test/try-body-multiple-insts.wasm.fromBinary +++ b/test/try-body-multiple-insts.wasm.fromBinary @@ -15,7 +15,7 @@ ) (catch (drop - (exnref.pop) + (pop exnref) ) (call $0) (call $1) diff --git a/test/unit/test_poppy_validation.py b/test/unit/test_poppy_validation.py index 3dc2907d864..6f868da2a6e 100644 --- a/test/unit/test_poppy_validation.py +++ b/test/unit/test_poppy_validation.py @@ -26,7 +26,7 @@ def test_top_level_pop(self): (func $foo (result i32) (block (result i32) (i32.const 0) - (i32.pop) + (pop i32) ) ) ) @@ -52,8 +52,8 @@ def test_incompatible_type(self): (f32.const 42) (i32.const 42) (i32.add - (i32.pop) - (i32.pop) + (pop i32) + (pop i32) ) ) ) @@ -68,8 +68,8 @@ def test_incorrect_pop_type(self): (i32.const 42) (i32.const 42) (i32.add - (i32.pop) - (f32.pop) + (pop i32) + (pop f32) ) ) ) @@ -83,8 +83,8 @@ def test_incompatible_type_fixed(self): (i32.const 42) (i32.const 42) (i32.add - (i32.pop) - (i32.pop) + (pop i32) + (pop i32) ) ) ) @@ -134,7 +134,7 @@ def test_nonblock_if_true(self): (nop) (i32.const 1) (if - (i32.pop) + (pop i32) (nop) ) ) @@ -149,7 +149,7 @@ def test_nonblock_if_false(self): (nop) (i32.const 1) (if - (i32.pop) + (pop i32) (block) (nop) ) @@ -165,7 +165,7 @@ def test_nonblock_if_fixed(self): (nop) (i32.const 1) (if - (i32.pop) + (pop i32) (block) (block) ) @@ -194,7 +194,7 @@ def test_nonpop_child(self): (i32.const 42) (i32.const 5) (i32.add - (i32.pop) + (pop i32) (i32.const -1) ) )