Skip to content

Commit 8879a6b

Browse files
tlivelyradekdoulik
authored andcommitted
Remove legacy GC text syntax (WebAssembly#5929)
Remove the old forms of ref.test and ref.cast that took heap types instead of ref types and remove the old array.init_static name for array.new_fixed.
1 parent a10bdb0 commit 8879a6b

File tree

6 files changed

+6
-249
lines changed

6 files changed

+6
-249
lines changed

scripts/gen-s-parser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@
583583
("array.new_default", "makeArrayNew(s, true)"),
584584
("array.new_data", "makeArrayNewData(s)"),
585585
("array.new_elem", "makeArrayNewElem(s)"),
586-
("array.init_static", "makeArrayNewFixed(s)"), # deprecated
587586
("array.new_fixed", "makeArrayNewFixed(s)"),
588587
("array.get", "makeArrayGet(s)"),
589588
("array.get_s", "makeArrayGet(s, true)"),

src/gen-s-parser.inc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ switch (buf[0]) {
4646
case 'e':
4747
if (op == "array.init_elem"sv) { return makeArrayInitElem(s); }
4848
goto parse_error;
49-
case 's':
50-
if (op == "array.init_static"sv) { return makeArrayNewFixed(s); }
51-
goto parse_error;
5249
default: goto parse_error;
5350
}
5451
}
@@ -3650,13 +3647,6 @@ switch (buf[0]) {
36503647
return *ret;
36513648
}
36523649
goto parse_error;
3653-
case 's':
3654-
if (op == "array.init_static"sv) {
3655-
auto ret = makeArrayNewFixed(ctx, pos);
3656-
CHECK_ERR(ret);
3657-
return *ret;
3658-
}
3659-
goto parse_error;
36603650
default: goto parse_error;
36613651
}
36623652
}

src/wasm/wasm-s-parser.cpp

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,44 +2854,14 @@ Expression* SExpressionWasmBuilder::makeI31Get(Element& s, bool signed_) {
28542854
}
28552855

28562856
Expression* SExpressionWasmBuilder::makeRefTest(Element& s) {
2857-
int i = 1;
2858-
Type castType;
2859-
if (s[i]->isList() ||
2860-
!(s[i]->dollared() ||
2861-
stringToType(s[i]->str(), true /* allowError */) == Type::none)) {
2862-
castType = elementToType(*s[i++]);
2863-
} else {
2864-
// legacy syntax
2865-
auto nullability = NonNullable;
2866-
if (s[1]->str().str == "null") {
2867-
nullability = Nullable;
2868-
++i;
2869-
}
2870-
auto type = parseHeapType(*s[i++]);
2871-
castType = Type(type, nullability);
2872-
}
2873-
auto* ref = parseExpression(*s[i++]);
2857+
Type castType = elementToType(*s[1]);
2858+
auto* ref = parseExpression(*s[2]);
28742859
return Builder(wasm).makeRefTest(ref, castType);
28752860
}
28762861

28772862
Expression* SExpressionWasmBuilder::makeRefCast(Element& s) {
2878-
int i = 1;
2879-
Type castType;
2880-
if (s[i]->isList() ||
2881-
!(s[i]->dollared() ||
2882-
stringToType(s[i]->str(), true /* allowError */) == Type::none)) {
2883-
castType = elementToType(*s[i++]);
2884-
} else {
2885-
// legacy syntax
2886-
Nullability nullability = NonNullable;
2887-
if (s[i]->str().str == "null") {
2888-
nullability = Nullable;
2889-
++i;
2890-
}
2891-
auto type = parseHeapType(*s[i++]);
2892-
castType = Type(type, nullability);
2893-
}
2894-
auto* ref = parseExpression(*s[i++]);
2863+
Type castType = elementToType(*s[1]);
2864+
auto* ref = parseExpression(*s[2]);
28952865
return Builder(wasm).makeRefCast(ref, castType);
28962866
}
28972867

test/lit/array-init-static.wast

Lines changed: 0 additions & 29 deletions
This file was deleted.

test/lit/passes/remove-unused-brs-gc.wast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,10 @@
620620
(drop
621621
;; This should not crash due to the new unreachable below.
622622
(br_on_cast $outer (ref none) (ref none)
623-
(ref.cast none
623+
(ref.cast (ref none)
624624
;; This will be optimized to a drop + unreachable.
625625
(br_on_cast $outer (ref none) (ref none)
626-
(ref.cast none
626+
(ref.cast (ref none)
627627
(local.get $0)
628628
)
629629
)

test/lit/ref_cast_test.wast

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)