diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-06-19 23:06:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-19 23:06:27 -0700 |
commit | 9fc276298b36080658236f0bc93d94cdf774492c (patch) | |
tree | b60592556b9edf4bb2dcd40034cb760c504cf576 | |
parent | aae35755e1d047c1f6fba9abfd2d836feafa5f66 (diff) | |
download | binaryen-9fc276298b36080658236f0bc93d94cdf774492c.tar.gz binaryen-9fc276298b36080658236f0bc93d94cdf774492c.tar.bz2 binaryen-9fc276298b36080658236f0bc93d94cdf774492c.zip |
Remove (attr 0) from tag text format (#3946)
This attribute is always 0 and reserved for future use. In Binayren's
unofficial text format we were writing this field as `(attr 0)`, but we
have recently come to the conclusion that this is not necessary.
Relevant discussion:
https://github.com/WebAssembly/exception-handling/pull/160#discussion_r653254680
56 files changed, 142 insertions, 166 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 750bfbb38..c6bf13f42 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2685,7 +2685,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { emitImportHeader(curr); o << "(tag "; printName(curr->name, o); - o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace; + o << maybeSpace; printParamType(o, curr->sig.params, currModule); o << "))"; o << maybeNewLine; @@ -2695,7 +2695,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { o << '('; printMedium(o, "tag "); printName(curr->name, o); - o << maybeSpace << "(attr " << curr->attribute << ')' << maybeSpace; + o << maybeSpace; printParamType(o, curr->sig.params, currModule); o << ")" << maybeNewLine; } diff --git a/src/shared-constants.h b/src/shared-constants.h index a0de4b9bb..6ad3ab9ac 100644 --- a/src/shared-constants.h +++ b/src/shared-constants.h @@ -66,7 +66,6 @@ extern Name PRINT; extern Name EXIT; extern Name SHARED; extern Name TAG; -extern Name ATTR; } // namespace wasm diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index c688630c3..8bedeab9f 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -3109,14 +3109,6 @@ void SExpressionWasmBuilder::parseImport(Element& s) { } } else if (kind == ExternalKind::Tag) { auto tag = make_unique<Tag>(); - if (j >= inner.size()) { - throw ParseException("tag does not have an attribute", s.line, s.col); - } - auto& attrElem = *inner[j++]; - if (!elementStartsWith(attrElem, ATTR) || attrElem.size() != 2) { - throw ParseException("invalid attribute", attrElem.line, attrElem.col); - } - tag->attribute = atoi(attrElem[1]->c_str()); j = parseTypeUse(inner, j, tag->sig); tag->setName(name, hasExplicitName); tag->module = module; @@ -3498,20 +3490,6 @@ void SExpressionWasmBuilder::parseTag(Element& s, bool preParseImport) { ex->kind = ExternalKind::Tag; } - // Parse attribute - if (i >= s.size()) { - throw ParseException("tag does not have an attribute", s.line, s.col); - } - auto& attrElem = *s[i++]; - if (!elementStartsWith(attrElem, ATTR) || attrElem.size() != 2) { - throw ParseException("invalid attribute", attrElem.line, attrElem.col); - } - if (!attrElem[1]->isStr()) { - throw ParseException( - "invalid attribute", attrElem[1]->line, attrElem[1]->col); - } - tag->attribute = atoi(attrElem[1]->c_str()); - // Parse typeuse i = parseTypeUse(s, i, tag->sig); diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index ea82bac39..54c82159f 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -97,7 +97,6 @@ Name PRINT("print"); Name EXIT("exit"); Name SHARED("shared"); Name TAG("tag"); -Name ATTR("attr"); // Expressions diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt index e711f7bfd..823b638f5 100644 --- a/test/binaryen.js/exception-handling.js.txt +++ b/test/binaryen.js/exception-handling.js.txt @@ -1,7 +1,7 @@ (module (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (func $test (try $l0 (do diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 745df85f0..b9462e68c 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -128,14 +128,14 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (global $a-mut-global-imp (mut i32))) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (import "module" "base" (tag $a-tag-imp (attr 0) (param i32))) + (import "module" "base" (tag $a-tag-imp (param i32))) (global $a-global i32 (i32.const 1)) (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data "I am passive") (table $t0 1 funcref) (elem $e0 (i32.const 0) "$kitchen()sinker") - (tag $a-tag (attr 0) (param i32)) + (tag $a-tag (param i32)) (export "kitchen_sinker" (func "$kitchen()sinker")) (export "a-global-exp" (global $a-global)) (export "a-tag-exp" (tag $a-tag)) @@ -2220,14 +2220,14 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (global $a-mut-global-imp (mut i32))) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (import "module" "base" (tag $a-tag-imp (attr 0) (param i32))) + (import "module" "base" (tag $a-tag-imp (param i32))) (global $a-global i32 (i32.const 1)) (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data "I am passive") (table $t0 1 funcref) (elem $e0 (i32.const 0) "$kitchen()sinker") - (tag $a-tag (attr 0) (param i32)) + (tag $a-tag (param i32)) (export "kitchen_sinker" (func "$kitchen()sinker")) (export "a-global-exp" (global $a-global)) (export "a-tag-exp" (tag $a-tag)) @@ -4779,7 +4779,7 @@ module loaded from binary form: (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (global $a-global i32 (i32.const 3)) - (tag $tag$0 (attr 0) (param i32 i32)) + (tag $tag$0 (param i32 i32)) (func $adder (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) @@ -4821,7 +4821,7 @@ test_parsing text: (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (global $a-global i32 (i32.const 3)) - (tag $a-tag (attr 0) (param i32)) + (tag $a-tag (param i32)) (func $adder (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) @@ -4835,7 +4835,7 @@ module loaded from text form: (type $i32_=>_none (func (param i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (global $a-global i32 (i32.const 3)) - (tag $a-tag (attr 0) (param i32)) + (tag $a-tag (param i32)) (func $ADD_ER (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) diff --git a/test/binaryen.js/tag.js.txt b/test/binaryen.js/tag.js.txt index 51a0d33ee..311a7cdfb 100644 --- a/test/binaryen.js/tag.js.txt +++ b/test/binaryen.js/tag.js.txt @@ -3,13 +3,13 @@ getTagInfo={"name":"a-tag","module":"","base":"","attribute":0,"params":2,"resul (module (type $i32_=>_none (func (param i32))) (type $i32_f32_=>_none (func (param i32 f32))) - (import "module" "base" (tag $a-tag-imp (attr 0) (param i32 f32))) - (tag $a-tag (attr 0) (param i32)) + (import "module" "base" (tag $a-tag-imp (param i32 f32))) + (tag $a-tag (param i32)) (export "a-tag-exp" (tag $a-tag)) ) (module (type $i32_f32_=>_none (func (param i32 f32))) - (import "module" "base" (tag $a-tag-imp (attr 0) (param i32 f32))) + (import "module" "base" (tag $a-tag-imp (param i32 f32))) ) diff --git a/test/br_to_try.wasm.fromBinary b/test/br_to_try.wasm.fromBinary index e52b8dcf8..288c40e01 100644 --- a/test/br_to_try.wasm.fromBinary +++ b/test/br_to_try.wasm.fromBinary @@ -1,7 +1,7 @@ (module (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (func $0 (try $label$3 (do diff --git a/test/break-within-catch.wasm.fromBinary b/test/break-within-catch.wasm.fromBinary index ecde70f3e..276bcdd93 100644 --- a/test/break-within-catch.wasm.fromBinary +++ b/test/break-within-catch.wasm.fromBinary @@ -1,7 +1,7 @@ (module (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (func $0 (block $label$2 (try $label$3 diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 77c433472..4855f68b7 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -45,7 +45,7 @@ BinaryenFeatureAll: 16383 (table $0 1 1 funcref) (elem $0 (table $0) (i32.const 0) func "$kitchen()sinker") (elem $passive func "$kitchen()sinker") - (tag $a-tag (attr 0) (param i32)) + (tag $a-tag (param i32)) (export "kitchen_sinker" (func "$kitchen()sinker")) (export "mem" (memory $0)) (start $starter) diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp index a379717f1..bbe57a657 100644 --- a/test/example/module-splitting.cpp +++ b/test/example/module-splitting.cpp @@ -76,7 +76,7 @@ int main() { (memory $mem (shared 3 42)) (table $tab 3 42 funcref) (global $glob (mut i32) (i32.const 7)) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ))"); // Imported global stuff @@ -85,7 +85,7 @@ int main() { (import "env" "mem" (memory $mem (shared 3 42))) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) - (import "env" "e" (tag $e (attr 0) (param i32))) + (import "env" "e" (tag $e (param i32))) ))"); // Exported global stuff @@ -94,7 +94,7 @@ int main() { (memory $mem (shared 3 42)) (table $tab 3 42 funcref) (global $glob (mut i32) (i32.const 7)) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (export "mem" (memory $mem)) (export "tab" (table $tab)) (export "glob" (global $glob)) diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index 61529e9ad..6ebcb96c7 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -16,7 +16,7 @@ Before: (global $glob (mut i32) (i32.const 7)) (memory $mem (shared 3 42)) (table $tab 3 42 funcref) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ) Keeping: <none> After: @@ -25,7 +25,7 @@ After: (global $glob (mut i32) (i32.const 7)) (memory $mem (shared 3 42)) (table $tab 3 42 funcref) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (export "%memory" (memory $mem)) (export "%table" (table $tab)) (export "%global" (global $glob)) @@ -37,7 +37,7 @@ Secondary: (import "primary" "%memory" (memory $mem (shared 3 42))) (import "primary" "%table" (table $tab 3 42 funcref)) (import "primary" "%global" (global $glob (mut i32))) - (import "primary" "%tag" (tag $e (attr 0) (param i32))) + (import "primary" "%tag" (tag $e (param i32))) ) @@ -47,7 +47,7 @@ Before: (import "env" "mem" (memory $mem (shared 3 42))) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) - (import "env" "e" (tag $e (attr 0) (param i32))) + (import "env" "e" (tag $e (param i32))) ) Keeping: <none> After: @@ -56,7 +56,7 @@ After: (import "env" "mem" (memory $mem (shared 3 42))) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) - (import "env" "e" (tag $e (attr 0) (param i32))) + (import "env" "e" (tag $e (param i32))) (export "%memory" (memory $mem)) (export "%table" (table $tab)) (export "%global" (global $glob)) @@ -68,7 +68,7 @@ Secondary: (import "primary" "%memory" (memory $mem (shared 3 42))) (import "primary" "%table" (table $tab 3 42 funcref)) (import "primary" "%global" (global $glob (mut i32))) - (import "primary" "%tag" (tag $e (attr 0) (param i32))) + (import "primary" "%tag" (tag $e (param i32))) ) @@ -78,7 +78,7 @@ Before: (global $glob (mut i32) (i32.const 7)) (memory $mem (shared 3 42)) (table $tab 3 42 funcref) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (export "mem" (memory $mem)) (export "tab" (table $tab)) (export "glob" (global $glob)) @@ -91,7 +91,7 @@ After: (global $glob (mut i32) (i32.const 7)) (memory $mem (shared 3 42)) (table $tab 3 42 funcref) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (export "mem" (memory $mem)) (export "tab" (table $tab)) (export "glob" (global $glob)) @@ -103,7 +103,7 @@ Secondary: (import "primary" "mem" (memory $mem (shared 3 42))) (import "primary" "tab" (table $tab 3 42 funcref)) (import "primary" "glob" (global $glob (mut i32))) - (import "primary" "e" (tag $e (attr 0) (param i32))) + (import "primary" "e" (tag $e (param i32))) ) diff --git a/test/exception-handling.wast b/test/exception-handling.wast index 95f177b2d..c608e860a 100644 --- a/test/exception-handling.wast +++ b/test/exception-handling.wast @@ -1,8 +1,8 @@ (module - (tag $e-i32 (attr 0) (param i32)) - (tag $e-i64 (attr 0) (param i64)) - (tag $e-i32-i64 (attr 0) (param i32 i64)) - (tag $e-empty (attr 0)) + (tag $e-i32 (param i32)) + (tag $e-i64 (param i64)) + (tag $e-i32-i64 (param i32 i64)) + (tag $e-empty) (func $foo) (func $bar) diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast index 429127a6a..1ce7a84b7 100644 --- a/test/exception-handling.wast.from-wast +++ b/test/exception-handling.wast.from-wast @@ -3,10 +3,10 @@ (type $i32_=>_none (func (param i32))) (type $i64_=>_none (func (param i64))) (type $i32_i64_=>_none (func (param i32 i64))) - (tag $e-i32 (attr 0) (param i32)) - (tag $e-i64 (attr 0) (param i64)) - (tag $e-i32-i64 (attr 0) (param i32 i64)) - (tag $e-empty (attr 0) (param)) + (tag $e-i32 (param i32)) + (tag $e-i64 (param i64)) + (tag $e-i32-i64 (param i32 i64)) + (tag $e-empty (param)) (func $foo (nop) ) diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary index e50d18f3a..d37f48a23 100644 --- a/test/exception-handling.wast.fromBinary +++ b/test/exception-handling.wast.fromBinary @@ -3,10 +3,10 @@ (type $i32_=>_none (func (param i32))) (type $i64_=>_none (func (param i64))) (type $i32_i64_=>_none (func (param i32 i64))) - (tag $tag$0 (attr 0) (param i32)) - (tag $tag$1 (attr 0) (param i64)) - (tag $tag$2 (attr 0) (param i32 i64)) - (tag $tag$3 (attr 0) (param)) + (tag $tag$0 (param i32)) + (tag $tag$1 (param i64)) + (tag $tag$2 (param i32 i64)) + (tag $tag$3 (param)) (func $foo (nop) ) diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo index c748ca024..1a36aaa66 100644 --- a/test/exception-handling.wast.fromBinary.noDebugInfo +++ b/test/exception-handling.wast.fromBinary.noDebugInfo @@ -3,10 +3,10 @@ (type $i32_=>_none (func (param i32))) (type $i64_=>_none (func (param i64))) (type $i32_i64_=>_none (func (param i32 i64))) - (tag $tag$0 (attr 0) (param i32)) - (tag $tag$1 (attr 0) (param i64)) - (tag $tag$2 (attr 0) (param i32 i64)) - (tag $tag$3 (attr 0) (param)) + (tag $tag$0 (param i32)) + (tag $tag$1 (param i64)) + (tag $tag$2 (param i32 i64)) + (tag $tag$3 (param)) (func $0 (nop) ) diff --git a/test/lit/passes/coalesce-locals-eh.wast b/test/lit/passes/coalesce-locals-eh.wast index f13ba5550..d2d7136fc 100644 --- a/test/lit/passes/coalesce-locals-eh.wast +++ b/test/lit/passes/coalesce-locals-eh.wast @@ -9,7 +9,7 @@ (i32.const 1984) ) - (tag $e (attr 0)) + (tag $e) ;; CHECK: (func $bug-cfg-traversal (param $0 i32) (result i32) ;; CHECK-NEXT: (try $try ;; CHECK-NEXT: (do diff --git a/test/lit/passes/code-folding-eh.wast b/test/lit/passes/code-folding-eh.wast index e810e5c01..9ca8f1ea7 100644 --- a/test/lit/passes/code-folding-eh.wast +++ b/test/lit/passes/code-folding-eh.wast @@ -3,7 +3,7 @@ ;; RUN: | filecheck %s (module - (tag $e-i32 (attr 0) (param i32)) + (tag $e-i32 (param i32)) ;; CHECK: (func $pop-test ;; CHECK-NEXT: (block $folding-inner0 diff --git a/test/lit/passes/code-pushing-eh.wast b/test/lit/passes/code-pushing-eh.wast index 37ca0cc5a..f45ef5c3f 100644 --- a/test/lit/passes/code-pushing-eh.wast +++ b/test/lit/passes/code-pushing-eh.wast @@ -2,7 +2,7 @@ ;; RUN: wasm-opt %s --code-pushing -all -S -o - | filecheck %s (module - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ;; CHECK: (func $cant-push-past-call ;; CHECK-NEXT: (local $x i32) diff --git a/test/lit/passes/dce-eh.wast b/test/lit/passes/dce-eh.wast index d29056c41..af216765c 100644 --- a/test/lit/passes/dce-eh.wast +++ b/test/lit/passes/dce-eh.wast @@ -5,7 +5,7 @@ ;; reachable (module (func $foo) - (tag $e (attr 0)) + (tag $e) ;; CHECK: (func $try_unreachable ;; CHECK-NEXT: (try $try diff --git a/test/lit/passes/inlining-eh.wast b/test/lit/passes/inlining-eh.wast index 6b648d380..e2b512410 100644 --- a/test/lit/passes/inlining-eh.wast +++ b/test/lit/passes/inlining-eh.wast @@ -4,7 +4,7 @@ (module ;; --------------------------------------------------------------------------- (import "a" "b" (func $foo (result i32))) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (func $callee-with-label (try $label (do) diff --git a/test/lit/passes/instrument-locals-eh.wast b/test/lit/passes/instrument-locals-eh.wast index 88b4d5526..a55a05416 100644 --- a/test/lit/passes/instrument-locals-eh.wast +++ b/test/lit/passes/instrument-locals-eh.wast @@ -2,7 +2,7 @@ ;; RUN: wasm-opt %s --instrument-locals -all -S -o - | filecheck %s (module - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ;; CHECK: (func $test ;; CHECK-NEXT: (local $x i32) diff --git a/test/lit/passes/optimize-instructions-eh.wast b/test/lit/passes/optimize-instructions-eh.wast index 23c8f9fa5..2c7f83aee 100644 --- a/test/lit/passes/optimize-instructions-eh.wast +++ b/test/lit/passes/optimize-instructions-eh.wast @@ -4,7 +4,7 @@ (module (func $dummy) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ;; The following are the unit tests for Properties::getFallthrough for EH ;; instructions, which are used in one of binary optimizations in diff --git a/test/lit/passes/poppify.wast b/test/lit/passes/poppify.wast index 69e6fc17e..5becc6556 100644 --- a/test/lit/passes/poppify.wast +++ b/test/lit/passes/poppify.wast @@ -3,7 +3,7 @@ ;; RUN: wasm-opt %s --poppify --no-validation -all -S -o - | filecheck %s (module - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) ;; CHECK: (func $id (param $x i32) (result i32) ;; CHECK-NEXT: (local.get $x) diff --git a/test/lit/passes/remove-unused-module-elements-eh.wast b/test/lit/passes/remove-unused-module-elements-eh.wast index 2a6a3b6b9..da6d6ff8a 100644 --- a/test/lit/passes/remove-unused-module-elements-eh.wast +++ b/test/lit/passes/remove-unused-module-elements-eh.wast @@ -8,13 +8,13 @@ ;; CHECK: (tag $e-export ;; CHECK: (tag $e-throw ;; CHECK: (tag $e-catch - (tag $e-remove (attr 0) (type $0)) ;; can be removed - (tag $e-export (attr 0) (param i64)) ;; cannot be removed (exported) - (tag $e-throw (attr 0) (type $0)) ;; cannot be removed (used in throw) - (tag $e-catch (attr 0) (type $0)) ;; cannot be removed (used in catch) + (tag $e-remove (type $0)) ;; can be removed + (tag $e-export (param i64)) ;; cannot be removed (exported) + (tag $e-throw (type $0)) ;; cannot be removed (used in throw) + (tag $e-catch (type $0)) ;; cannot be removed (used in catch) (export "e-export" (tag $e-export)) - (import "env" "e" (tag $e-import (attr 0) (param i32))) + (import "env" "e" (tag $e-import (param i32))) (start $start) (func $start diff --git a/test/lit/passes/remove-unused-names-eh.wast b/test/lit/passes/remove-unused-names-eh.wast index 3244bd375..cf16dda0b 100644 --- a/test/lit/passes/remove-unused-names-eh.wast +++ b/test/lit/passes/remove-unused-names-eh.wast @@ -2,7 +2,7 @@ ;; RUN: wasm-opt %s --remove-unused-names -all -S -o - | filecheck %s (module - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) ;; CHECK: (func $func0 ;; CHECK-NEXT: (try $label$9 diff --git a/test/lit/passes/rse-eh.wast b/test/lit/passes/rse-eh.wast index f71c4886d..7d21ef820 100644 --- a/test/lit/passes/rse-eh.wast +++ b/test/lit/passes/rse-eh.wast @@ -2,8 +2,8 @@ ;; RUN: wasm-opt %s --rse -all -S -o - | filecheck %s (module - (tag $e (attr 0) (param i32)) - (tag $e2 (attr 0)) + (tag $e (param i32)) + (tag $e2) ;; CHECK: (func $try1 ;; CHECK-NEXT: (local $x i32) diff --git a/test/lit/passes/simplify-locals-eh.wast b/test/lit/passes/simplify-locals-eh.wast index 9a7a94cf7..74501584c 100644 --- a/test/lit/passes/simplify-locals-eh.wast +++ b/test/lit/passes/simplify-locals-eh.wast @@ -2,7 +2,7 @@ ;; RUN: wasm-opt %s --simplify-locals -all -S -o - | filecheck %s (module - (tag $e-i32 (attr 0) (param i32)) + (tag $e-i32 (param i32)) ;; CHECK: (func $foo (param $0 i32) (param $1 i32) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/stack-ir-eh.wast b/test/lit/passes/stack-ir-eh.wast index 86ada5059..228f00773 100644 --- a/test/lit/passes/stack-ir-eh.wast +++ b/test/lit/passes/stack-ir-eh.wast @@ -2,7 +2,7 @@ ;; RUN: -all -S -o - | filecheck %s (module - (tag $e0 (attr 0) (param i32)) + (tag $e0 (param i32)) ;; CHECK: (func $eh ;; CHECK-NEXT: try $l0 diff --git a/test/lit/passes/stack-ir-roundtrip-eh.wast b/test/lit/passes/stack-ir-roundtrip-eh.wast index cbc81f294..df68d3f8a 100644 --- a/test/lit/passes/stack-ir-roundtrip-eh.wast +++ b/test/lit/passes/stack-ir-roundtrip-eh.wast @@ -2,7 +2,7 @@ ;; RUN: wasm-opt %s --generate-stack-ir --roundtrip -all -S -o - | filecheck %s (module - (tag $tag (attr 0) (param i32)) + (tag $tag (param i32)) ;; CHECK: (func $delegate-child ;; CHECK-NEXT: (try $label$9 ;; CHECK-NEXT: (do diff --git a/test/lit/passes/vacuum-eh.wast b/test/lit/passes/vacuum-eh.wast index 705f423f0..a4417f0ae 100644 --- a/test/lit/passes/vacuum-eh.wast +++ b/test/lit/passes/vacuum-eh.wast @@ -2,8 +2,8 @@ ;; RUN: wasm-opt %s --vacuum -all -S -o - | filecheck %s (module - (tag $e (attr 0) (param i32)) - (tag $e2 (attr 0) (param i32)) + (tag $e (param i32)) + (tag $e2 (param i32)) ;; CHECK: (func $try-test ;; CHECK-NEXT: (nop) diff --git a/test/metadce/rooted-export.wast b/test/metadce/rooted-export.wast index 790ce802f..0a25ca4b4 100644 --- a/test/metadce/rooted-export.wast +++ b/test/metadce/rooted-export.wast @@ -12,7 +12,7 @@ (export "wasm_tag_a" (tag $a_wasm_tag)) (export "wasm_tag_b" (tag $b_wasm_tag)) - (tag $a_wasm_tag (attr 0) (param i32)) - (tag $b_wasm_tag (attr 0) (param i32)) + (tag $a_wasm_tag (param i32)) + (tag $b_wasm_tag (param i32)) ) diff --git a/test/metadce/rooted-export.wast.dced b/test/metadce/rooted-export.wast.dced index dd9913ab2..dfa486c4b 100644 --- a/test/metadce/rooted-export.wast.dced +++ b/test/metadce/rooted-export.wast.dced @@ -1,7 +1,7 @@ (module (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (tag $b_wasm_tag (attr 0) (param i32)) + (tag $b_wasm_tag (param i32)) (export "wasm_func_b" (func $b_wasm_func)) (export "wasm_tag_b" (tag $b_wasm_tag)) (func $b_wasm_func diff --git a/test/passes/dwarf_with_exceptions.bin.txt b/test/passes/dwarf_with_exceptions.bin.txt index ebd6be03d..3878ba54e 100644 --- a/test/passes/dwarf_with_exceptions.bin.txt +++ b/test/passes/dwarf_with_exceptions.bin.txt @@ -8,7 +8,7 @@ (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) (global $__stack_pointer (mut i32) (i32.const 66560)) (memory $0 2) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (export "memory" (memory $0)) (func $__wasm_call_ctors ) @@ -429,7 +429,7 @@ file_names[ 1]: (import "env" "_ZSt9terminatev" (func $std::terminate\28\29)) (global $__stack_pointer (mut i32) (i32.const 66560)) (memory $0 2) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (export "memory" (memory $0)) (func $__wasm_call_ctors ) diff --git a/test/passes/metrics_all-features.txt b/test/passes/metrics_all-features.txt index d58bd54f9..255e809c2 100644 --- a/test/passes/metrics_all-features.txt +++ b/test/passes/metrics_all-features.txt @@ -23,8 +23,8 @@ total (data (i32.const 0) "\ff\ef\0f\1f 0@P\99") (table $0 256 256 funcref) (elem (i32.const 0) $ifs $ifs $ifs) - (tag $e0 (attr 0) (param i32)) - (tag $e1 (attr 0) (param i32 i32)) + (tag $e0 (param i32)) + (tag $e1 (param i32 i32)) (func $ifs (param $x i32) (local $y f32) (block $block0 diff --git a/test/passes/metrics_all-features.wast b/test/passes/metrics_all-features.wast index c5894fd67..68c13b9c2 100644 --- a/test/passes/metrics_all-features.wast +++ b/test/passes/metrics_all-features.wast @@ -5,8 +5,8 @@ (data (i32.const 0) "\ff\ef\0f\1f\20\30\40\50\99") (type $0 (func (param i32))) (global $glob i32 (i32.const 1337)) - (tag $e0 (attr 0) (param i32)) - (tag $e1 (attr 0) (param i32 i32)) + (tag $e0 (param i32)) + (tag $e1 (param i32 i32)) (func $ifs (type $0) (param $x i32) (local $y f32) (block $block0 diff --git a/test/passes/minify-imports-and-exports_all-features.txt b/test/passes/minify-imports-and-exports_all-features.txt index 8336e47c6..8d99fbbf2 100644 --- a/test/passes/minify-imports-and-exports_all-features.txt +++ b/test/passes/minify-imports-and-exports_all-features.txt @@ -10014,8 +10014,8 @@ longname4880 => zza (import "other" "anything" (func $internalInfinity)) (import "wasi_unstable" "f" (func $internal3_wasi)) (import "wasi_unstable" "LBa" (func $internal3_wasi_only)) - (import "env" "MBa" (tag $tagname1 (attr 0) (param i32))) - (tag $tag1 (attr 0) (param i32 i32)) + (import "env" "MBa" (tag $tagname1 (param i32))) + (tag $tag1 (param i32 i32)) (export "NBa" (func $foo1)) (export "OBa" (func $foo2)) (export "PBa" (tag $tag1)) diff --git a/test/passes/minify-imports-and-exports_all-features.wast b/test/passes/minify-imports-and-exports_all-features.wast index 169bb881d..308b8bde4 100644 --- a/test/passes/minify-imports-and-exports_all-features.wast +++ b/test/passes/minify-imports-and-exports_all-features.wast @@ -5002,7 +5002,7 @@ (import "env" "__memory_base" (global i32)) (import "env" "__table_base" (global i32)) (import "other" "anything" (func $internalInfinity)) - (import "env" "tagname1" (tag $tagname1 (attr 0) (param i32))) + (import "env" "tagname1" (tag $tagname1 (param i32))) (import "wasi_unstable" "longname3" (func $internal3_wasi)) ;; overlapping base (import "wasi_unstable" "longname3-only" (func $internal3_wasi_only)) (export "exp1" (func $foo1)) @@ -5010,5 +5010,5 @@ (func $foo1) (func $foo2) (export "tag1" (tag $tag1)) - (tag $tag1 (attr 0) (param i32 i32)) + (tag $tag1 (param i32 i32)) ) diff --git a/test/passes/minify-imports_all-features.txt b/test/passes/minify-imports_all-features.txt index 529fac5be..8b5d93c81 100644 --- a/test/passes/minify-imports_all-features.txt +++ b/test/passes/minify-imports_all-features.txt @@ -10008,8 +10008,8 @@ longname4880 => zza (import "env" "JBa" (func $internal4998)) (import "env" "KBa" (func $internal4999)) (import "other" "anything" (func $internalInfinity)) - (import "env" "LBa" (tag $tagname1 (attr 0) (param i32))) - (tag $tag1 (attr 0) (param i32 i32)) + (import "env" "LBa" (tag $tagname1 (param i32))) + (tag $tag1 (param i32 i32)) (export "foo1" (func $foo1)) (export "foo2" (func $foo2)) (export "tag1" (tag $tag1)) diff --git a/test/passes/minify-imports_all-features.wast b/test/passes/minify-imports_all-features.wast index ba16241cf..1cb07de62 100644 --- a/test/passes/minify-imports_all-features.wast +++ b/test/passes/minify-imports_all-features.wast @@ -5002,11 +5002,11 @@ (import "env" "__memory_base" (global i32)) (import "env" "__table_base" (global i32)) (import "other" "anything" (func $internalInfinity)) - (import "env" "tagname1" (tag $tagname1 (attr 0) (param i32))) + (import "env" "tagname1" (tag $tagname1 (param i32))) (export "foo1" (func $foo1)) (export "foo2" (func $foo2)) (export "tag1" (tag $tag1)) (func $foo1) (func $foo2) - (tag $tag1 (attr 0) (param i32 i32)) + (tag $tag1 (param i32 i32)) ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index 206373db6..13836b3e0 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -1700,7 +1700,7 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (func $foo (nop) ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.wast b/test/passes/remove-unused-names_merge-blocks_all-features.wast index 2e9af253c..3ec2768e0 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.wast +++ b/test/passes/remove-unused-names_merge-blocks_all-features.wast @@ -1558,7 +1558,7 @@ ) (module - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (func $foo) ;; 'nop' within 'block' of `throw' can be hoisted diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index f124d5c04..a767fccb1 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -332,7 +332,7 @@ (module (type $i64_=>_none (func (param i64))) (type $0 (func (param i32))) - (tag $e1 (attr 0) (param i64)) + (tag $e1 (param i64)) (export "e1" (tag $e1)) (func $f (param $0 i32) (nop) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast index 346acf432..057088798 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast @@ -263,9 +263,9 @@ ) (module ;; non-exported tags can be removed (type $0 (func (param i32))) - (tag $e0 (attr 0) (type $0)) - (tag $e1 (attr 0) (param i64)) + (tag $e0 (type $0)) + (tag $e1 (param i64)) (export "e1" (tag $e1)) - (import "env" "e" (tag $e2 (attr 0) (param i32))) + (import "env" "e" (tag $e2 (param i32))) (func $f (; 0 ;) (type $0)) ) diff --git a/test/reference-types.wast b/test/reference-types.wast index c8081182f..afdb38c89 100644 --- a/test/reference-types.wast +++ b/test/reference-types.wast @@ -35,7 +35,7 @@ (global $global_anyref3 (mut anyref) (ref.null func)) (global $global_anyref4 (mut anyref) (ref.func $foo)) - (tag $e-i32 (attr 0) (param i32)) + (tag $e-i32 (param i32)) (func $test (local $local_externref externref) diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast index cb9c31088..d6f0ca7d0 100644 --- a/test/reference-types.wast.from-wast +++ b/test/reference-types.wast.from-wast @@ -20,7 +20,7 @@ (table $0 3 3 funcref) (elem (i32.const 0) $take_externref $take_funcref $take_anyref) (elem declare func $foo $ref-taken-but-not-in-table) - (tag $e-i32 (attr 0) (param i32)) + (tag $e-i32 (param i32)) (export "export_func" (func $import_func)) (export "export_global" (global $import_global)) (func $take_externref (param $0 externref) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index 57ef2f08b..ad2d8862f 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -20,7 +20,7 @@ (table $0 3 3 funcref) (elem (i32.const 0) $take_externref $take_funcref $take_anyref) (elem declare func $foo $ref-taken-but-not-in-table) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (export "export_func" (func $import_func)) (export "export_global" (global $import_global)) (func $take_externref (param $0 externref) diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo index 8162efa65..264539142 100644 --- a/test/reference-types.wast.fromBinary.noDebugInfo +++ b/test/reference-types.wast.fromBinary.noDebugInfo @@ -20,7 +20,7 @@ (table $0 3 3 funcref) (elem (i32.const 0) $0 $1 $2) (elem declare func $27 $3) - (tag $tag$0 (attr 0) (param i32)) + (tag $tag$0 (param i32)) (export "export_func" (func $fimport$0)) (export "export_global" (global $gimport$0)) (func $0 (param $0 externref) diff --git a/test/spec/exception-handling.wast b/test/spec/exception-handling.wast index d09c21806..1b7907474 100644 --- a/test/spec/exception-handling.wast +++ b/test/spec/exception-handling.wast @@ -1,8 +1,8 @@ (module - (tag $e-v (attr 0)) - (tag $e-i32 (attr 0) (param i32)) - (tag $e-f32 (attr 0) (param f32)) - (tag $e-i32-f32 (attr 0) (param i32 f32)) + (tag $e-v) + (tag $e-i32 (param i32)) + (tag $e-f32 (param f32)) + (tag $e-i32-f32 (param i32 f32)) (func $throw_single_value (export "throw_single_value") (throw $e-i32 (i32.const 5)) @@ -246,7 +246,7 @@ (assert_invalid (module - (tag $e-i32 (attr 0) (param i32)) + (tag $e-i32 (param i32)) (func $f0 (throw $e-i32 (f32.const 0)) ) @@ -256,7 +256,7 @@ (assert_invalid (module - (tag $e-i32 (attr 0) (param i32 f32)) + (tag $e-i32 (param i32 f32)) (func $f0 (throw $e-i32 (f32.const 0)) ) diff --git a/test/spec/tags.wast b/test/spec/tags.wast index 33e24e093..78b45f26a 100644 --- a/test/spec/tags.wast +++ b/test/spec/tags.wast @@ -1,21 +1,21 @@ ;; Test tags (module - (tag (attr 0) (param i32)) - (tag $e (attr 0) (param i32 f32)) + (tag (param i32)) + (tag $e (param i32 f32)) - (tag $e-params0 (attr 0) (param i32 f32)) - (tag $e-params1 (attr 0) (param i32) (param f32)) + (tag $e-params0 (param i32 f32)) + (tag $e-params1 (param i32) (param f32)) - (tag $e-export (export "ex0") (attr 0) (param i32)) - (tag $e-import (import "env" "im0") (attr 0) (param i32)) + (tag $e-export (export "ex0") (param i32)) + (tag $e-import (import "env" "im0") (param i32)) - (import "env" "im1" (tag (attr 0) (param i32 f32))) + (import "env" "im1" (tag (param i32 f32))) (export "ex1" (tag $e)) ) (assert_invalid - (module (tag $e (attr 0) (param i32) (result i32))) + (module (tag $e (param i32) (result i32))) "Tag type's result type should be none" ) @@ -27,7 +27,7 @@ (assert_invalid (module (type $t (param i32)) - (tag $e (attr 0) (type $t) (param i32 f32)) + (tag $e (type $t) (param i32 f32)) ) "type and param don't match" ) diff --git a/test/tags.wast b/test/tags.wast index 08867f876..6dc383a86 100644 --- a/test/tags.wast +++ b/test/tags.wast @@ -1,16 +1,16 @@ ;; Test tags (module - (tag (attr 0) (param i32)) - (tag $e (attr 0) (param i32 f32)) - (tag $empty (attr 0)) + (tag (param i32)) + (tag $e (param i32 f32)) + (tag $empty) - (tag $e-params0 (attr 0) (param i32 f32)) - (tag $e-params1 (attr 0) (param i32) (param f32)) + (tag $e-params0 (param i32 f32)) + (tag $e-params1 (param i32) (param f32)) - (tag $e-export (export "ex0") (attr 0) (param i32)) - (tag $e-import (import "env" "im0") (attr 0) (param i32)) + (tag $e-export (export "ex0") (param i32)) + (tag $e-import (import "env" "im0") (param i32)) - (import "env" "im1" (tag (attr 0) (param i32 f32))) + (import "env" "im1" (tag (param i32 f32))) (export "ex1" (tag $e)) ) diff --git a/test/tags.wast.from-wast b/test/tags.wast.from-wast index c81c1bc2c..669afcc82 100644 --- a/test/tags.wast.from-wast +++ b/test/tags.wast.from-wast @@ -2,13 +2,13 @@ (type $i32_f32_=>_none (func (param i32 f32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (import "env" "im0" (tag $e-import (attr 0) (param i32))) - (import "env" "im1" (tag $eimport$1 (attr 0) (param i32 f32))) - (tag $2 (attr 0) (param i32)) - (tag $e (attr 0) (param i32 f32)) - (tag $empty (attr 0) (param)) - (tag $e-params0 (attr 0) (param i32 f32)) - (tag $e-params1 (attr 0) (param i32 f32)) - (tag $e-export (attr 0) (param i32)) + (import "env" "im0" (tag $e-import (param i32))) + (import "env" "im1" (tag $eimport$1 (param i32 f32))) + (tag $2 (param i32)) + (tag $e (param i32 f32)) + (tag $empty (param)) + (tag $e-params0 (param i32 f32)) + (tag $e-params1 (param i32 f32)) + (tag $e-export (param i32)) (export "ex1" (tag $e)) ) diff --git a/test/tags.wast.fromBinary b/test/tags.wast.fromBinary index e313e6291..98862618b 100644 --- a/test/tags.wast.fromBinary +++ b/test/tags.wast.fromBinary @@ -2,14 +2,14 @@ (type $i32_f32_=>_none (func (param i32 f32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (import "env" "im0" (tag $eimport$0 (attr 0) (param i32))) - (import "env" "im1" (tag $eimport$1 (attr 0) (param i32 f32))) - (tag $tag$0 (attr 0) (param i32)) - (tag $tag$1 (attr 0) (param i32 f32)) - (tag $tag$2 (attr 0) (param)) - (tag $tag$3 (attr 0) (param i32 f32)) - (tag $tag$4 (attr 0) (param i32 f32)) - (tag $tag$5 (attr 0) (param i32)) + (import "env" "im0" (tag $eimport$0 (param i32))) + (import "env" "im1" (tag $eimport$1 (param i32 f32))) + (tag $tag$0 (param i32)) + (tag $tag$1 (param i32 f32)) + (tag $tag$2 (param)) + (tag $tag$3 (param i32 f32)) + (tag $tag$4 (param i32 f32)) + (tag $tag$5 (param i32)) (export "ex1" (tag $tag$1)) ) diff --git a/test/tags.wast.fromBinary.noDebugInfo b/test/tags.wast.fromBinary.noDebugInfo index e313e6291..98862618b 100644 --- a/test/tags.wast.fromBinary.noDebugInfo +++ b/test/tags.wast.fromBinary.noDebugInfo @@ -2,14 +2,14 @@ (type $i32_f32_=>_none (func (param i32 f32))) (type $i32_=>_none (func (param i32))) (type $none_=>_none (func)) - (import "env" "im0" (tag $eimport$0 (attr 0) (param i32))) - (import "env" "im1" (tag $eimport$1 (attr 0) (param i32 f32))) - (tag $tag$0 (attr 0) (param i32)) - (tag $tag$1 (attr 0) (param i32 f32)) - (tag $tag$2 (attr 0) (param)) - (tag $tag$3 (attr 0) (param i32 f32)) - (tag $tag$4 (attr 0) (param i32 f32)) - (tag $tag$5 (attr 0) (param i32)) + (import "env" "im0" (tag $eimport$0 (param i32))) + (import "env" "im1" (tag $eimport$1 (param i32 f32))) + (tag $tag$0 (param i32)) + (tag $tag$1 (param i32 f32)) + (tag $tag$2 (param)) + (tag $tag$3 (param i32 f32)) + (tag $tag$4 (param i32 f32)) + (tag $tag$5 (param i32)) (export "ex1" (tag $tag$1)) ) diff --git a/test/try-delegate.wasm.fromBinary b/test/try-delegate.wasm.fromBinary index 1ff60fee9..7aa74ec54 100644 --- a/test/try-delegate.wasm.fromBinary +++ b/test/try-delegate.wasm.fromBinary @@ -1,6 +1,6 @@ (module (type $none_=>_none (func)) - (tag $tag$0 (attr 0) (param)) + (tag $tag$0 (param)) (func $0 (try $label$6 (do diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 06e2661d1..a05d4c9b8 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -187,7 +187,7 @@ class FeatureValidationTest(utils.BinaryenTestCase): def test_tag(self): module = ''' (module - (tag $e (attr 0) (param i32)) + (tag $e (param i32)) (func $foo (throw $e (i32.const 0)) ) @@ -221,7 +221,7 @@ class FeatureValidationTest(utils.BinaryenTestCase): def test_multivalue_tag(self): module = ''' (module - (tag $foo (attr 0) (param i32 i64)) + (tag $foo (param i32 i64)) ) ''' self.check_multivalue_exception_handling(module, 'Multivalue tag type ' + |