diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index b0fcc1ef60b..b56a7f50b9f 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -627,15 +627,12 @@ ("i31.get_u", "makeI31Get(false)"), ("ref.test", "makeRefTest()"), ("ref.cast", "makeRefCast(false)"), - ("ref.cast_desc", "makeRefCast(true)"), # Deprecated ("ref.cast_desc_eq", "makeRefCast(true)"), ("ref.get_desc", "makeRefGetDesc()"), ("br_on_null", "makeBrOnNull()"), ("br_on_non_null", "makeBrOnNull(true)"), ("br_on_cast", "makeBrOnCast(BrOnCast)"), ("br_on_cast_fail", "makeBrOnCast(BrOnCastFail)"), - ("br_on_cast_desc", "makeBrOnCast(BrOnCastDescEq)"), # Deprecated - ("br_on_cast_desc_fail", "makeBrOnCast(BrOnCastDescEqFail)"), # Deprecated ("br_on_cast_desc_eq", "makeBrOnCast(BrOnCastDescEq)"), ("br_on_cast_desc_eq_fail", "makeBrOnCast(BrOnCastDescEqFail)"), ("struct.new", "makeStructNew(false, false)"), @@ -683,8 +680,6 @@ ("array.atomic.rmw.xchg", "makeArrayRMW(RMWXchg)"), ("array.atomic.rmw.cmpxchg", "makeArrayCmpxchg()"), ("ref.as_non_null", "makeRefAs(RefAsNonNull)"), - ("extern.internalize", "makeRefAs(AnyConvertExtern)"), # Deprecated - ("extern.externalize", "makeRefAs(ExternConvertAny)"), # Deprecated ("any.convert_extern", "makeRefAs(AnyConvertExtern)"), ("extern.convert_any", "makeRefAs(ExternConvertAny)"), ("string.new_lossy_utf8_array", "makeStringNew(StringNewLossyUTF8Array)"), diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index 161512db05c..6288b5b2734 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -273,41 +273,19 @@ switch (buf[0]) { case '_': { switch (buf[11]) { case 'd': { - switch (buf[15]) { + switch (buf[18]) { case '\0': - if (op == "br_on_cast_desc"sv) { + if (op == "br_on_cast_desc_eq"sv) { CHECK_ERR(makeBrOnCast(ctx, pos, annotations, BrOnCastDescEq)); return Ok{}; } goto parse_error; - case '_': { - switch (buf[16]) { - case 'e': { - switch (buf[18]) { - case '\0': - if (op == "br_on_cast_desc_eq"sv) { - CHECK_ERR(makeBrOnCast(ctx, pos, annotations, BrOnCastDescEq)); - return Ok{}; - } - goto parse_error; - case '_': - if (op == "br_on_cast_desc_eq_fail"sv) { - CHECK_ERR(makeBrOnCast(ctx, pos, annotations, BrOnCastDescEqFail)); - return Ok{}; - } - goto parse_error; - default: goto parse_error; - } - } - case 'f': - if (op == "br_on_cast_desc_fail"sv) { - CHECK_ERR(makeBrOnCast(ctx, pos, annotations, BrOnCastDescEqFail)); - return Ok{}; - } - goto parse_error; - default: goto parse_error; + case '_': + if (op == "br_on_cast_desc_eq_fail"sv) { + CHECK_ERR(makeBrOnCast(ctx, pos, annotations, BrOnCastDescEqFail)); + return Ok{}; } - } + goto parse_error; default: goto parse_error; } } @@ -430,29 +408,12 @@ switch (buf[0]) { return Ok{}; } goto parse_error; - case 'x': { - switch (buf[7]) { - case 'c': - if (op == "extern.convert_any"sv) { - CHECK_ERR(makeRefAs(ctx, pos, annotations, ExternConvertAny)); - return Ok{}; - } - goto parse_error; - case 'e': - if (op == "extern.externalize"sv) { - CHECK_ERR(makeRefAs(ctx, pos, annotations, ExternConvertAny)); - return Ok{}; - } - goto parse_error; - case 'i': - if (op == "extern.internalize"sv) { - CHECK_ERR(makeRefAs(ctx, pos, annotations, AnyConvertExtern)); - return Ok{}; - } - goto parse_error; - default: goto parse_error; + case 'x': + if (op == "extern.convert_any"sv) { + CHECK_ERR(makeRefAs(ctx, pos, annotations, ExternConvertAny)); + return Ok{}; } - } + goto parse_error; default: goto parse_error; } } @@ -5008,23 +4969,12 @@ switch (buf[0]) { return Ok{}; } goto parse_error; - case '_': { - switch (buf[13]) { - case '\0': - if (op == "ref.cast_desc"sv) { - CHECK_ERR(makeRefCast(ctx, pos, annotations, true)); - return Ok{}; - } - goto parse_error; - case '_': - if (op == "ref.cast_desc_eq"sv) { - CHECK_ERR(makeRefCast(ctx, pos, annotations, true)); - return Ok{}; - } - goto parse_error; - default: goto parse_error; + case '_': + if (op == "ref.cast_desc_eq"sv) { + CHECK_ERR(makeRefCast(ctx, pos, annotations, true)); + return Ok{}; } - } + goto parse_error; default: goto parse_error; } } diff --git a/test/lit/extern-conversions.wast b/test/lit/extern-conversions.wast index 6702ba17da9..e9542075968 100644 --- a/test/lit/extern-conversions.wast +++ b/test/lit/extern-conversions.wast @@ -5,23 +5,16 @@ ;; RUN: wasm-opt %s -all -O1 --roundtrip -S -o - | filecheck %s - (module - ;; CHECK: (type $0 (func (param externref) (result anyref))) - - ;; CHECK: (type $1 (func (param (ref any)) (result (ref extern)))) + ;; CHECK: (type $0 (func (param (ref any)) (result (ref extern)))) - ;; CHECK: (type $2 (func (param anyref) (result externref))) + ;; CHECK: (type $1 (func (param externref) (result anyref))) ;; CHECK: (export "ext" (func $extern.convert_any)) ;; CHECK: (export "int" (func $any.convert_extern)) - ;; CHECK: (export "legacy.1" (func $legacy_notation.1)) - - ;; CHECK: (export "legacy.2" (func $legacy_notation.2)) - - ;; CHECK: (func $extern.convert_any (type $1) (param $0 (ref any)) (result (ref extern)) + ;; CHECK: (func $extern.convert_any (type $0) (param $0 (ref any)) (result (ref extern)) ;; CHECK-NEXT: (extern.convert_any ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -32,7 +25,7 @@ ) ) - ;; CHECK: (func $any.convert_extern (type $0) (param $0 externref) (result anyref) + ;; CHECK: (func $any.convert_extern (type $1) (param $0 externref) (result anyref) ;; CHECK-NEXT: (any.convert_extern ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -42,31 +35,4 @@ (local.get $x) ) ) - - ;; CHECK: (func $legacy_notation.1 (type $0) (param $0 externref) (result anyref) - ;; CHECK-NEXT: (ref.as_non_null - ;; CHECK-NEXT: (any.convert_extern - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $legacy_notation.1 (export "legacy.1") (param $x (ref null extern)) (result (ref null any)) - (extern.internalize - (ref.as_non_null ;; Add this to avoid the entire function being merged with - ;; another. - (local.get $x) - ) - ) - ) - - ;; CHECK: (func $legacy_notation.2 (type $2) (param $0 anyref) (result externref) - ;; CHECK-NEXT: (extern.convert_any - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $legacy_notation.2 (export "legacy.2") (param $x (ref null any)) (result (ref null extern)) - (extern.externalize - (local.get $x) - ) - ) ) diff --git a/test/lit/ref-cast-desc.wast b/test/lit/ref-cast-desc.wast deleted file mode 100644 index 490ada02bda..00000000000 --- a/test/lit/ref-cast-desc.wast +++ /dev/null @@ -1,62 +0,0 @@ -;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. -;; RUN: wasm-opt -all %s -S -o - | filecheck %s - -;; Check that we still parse the deprecated instruction mnemonics for descriptor -;; casts - -(module - (rec - ;; CHECK: (rec - ;; CHECK-NEXT: (type $struct (descriptor $desc) (struct)) - (type $struct (descriptor $desc) (struct)) - ;; CHECK: (type $desc (describes $struct) (struct)) - (type $desc (describes $struct) (struct)) - ) - - ;; CHECK: (func $ref-cast-desc (type $3) (param $0 anyref) (param $1 (ref $desc)) (result (ref $struct)) - ;; CHECK-NEXT: (ref.cast_desc_eq (ref $struct) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $ref-cast-desc (param anyref) (param (ref $desc)) (result (ref $struct)) - (ref.cast_desc (ref $struct) - (local.get 0) - (local.get 1) - ) - ) - - ;; CHECK: (func $br-on-cast-desc (type $2) (param $0 anyref) (param $1 (ref $desc)) (result anyref) - ;; CHECK-NEXT: (block $l (result anyref) - ;; CHECK-NEXT: (br_on_cast_desc_eq $l anyref (ref $struct) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $br-on-cast-desc (param anyref) (param (ref $desc)) (result anyref) - (block $l (result anyref) - (br_on_cast_desc $l anyref (ref $struct) - (local.get 0) - (local.get 1) - ) - ) - ) - - ;; CHECK: (func $br-on-cast-desc_fail (type $2) (param $0 anyref) (param $1 (ref $desc)) (result anyref) - ;; CHECK-NEXT: (block $l (result anyref) - ;; CHECK-NEXT: (br_on_cast_desc_eq_fail $l anyref (ref $struct) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $br-on-cast-desc_fail (param anyref) (param (ref $desc)) (result anyref) - (block $l (result anyref) - (br_on_cast_desc_fail $l anyref (ref $struct) - (local.get 0) - (local.get 1) - ) - ) - ) -)