summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-02-28 18:18:38 -0600
committerGitHub <noreply@github.com>2023-02-28 16:18:38 -0800
commit356767e259cde364b0968bedf4ffd012d48737b5 (patch)
tree82daae9ece7114141b31c26a8fcccd94e0ea2ba7
parentaa4bc77bc967fd8911c30d7e69e44a9a0aef553a (diff)
downloadbinaryen-356767e259cde364b0968bedf4ffd012d48737b5.tar.gz
binaryen-356767e259cde364b0968bedf4ffd012d48737b5.tar.bz2
binaryen-356767e259cde364b0968bedf4ffd012d48737b5.zip
Parse and print `array.new_fixed` (#5527)
This is a (more) standard name for `array.init_static`. (The full upstream name in the spec repo is `array.new_canon_fixed`, but I'm still hoping we can drop `canon` from all the instruction names and it doesn't appear elsewhere in Binaryen). Update all the existing tests to use the new name and add a test specifically to ensure the old name continues parsing.
-rwxr-xr-xscripts/gen-s-parser.py3
-rw-r--r--src/gen-s-parser.inc14
-rw-r--r--src/passes/Print.cpp2
-rw-r--r--src/wasm-binary.h2
-rw-r--r--src/wasm-s-parser.h2
-rw-r--r--src/wasm/wasm-binary.cpp2
-rw-r--r--src/wasm/wasm-s-parser.cpp2
-rw-r--r--src/wasm/wasm-stack.cpp2
-rw-r--r--src/wasm/wat-parser.cpp4
-rw-r--r--test/ctor-eval/gc-array.wast4
-rw-r--r--test/ctor-eval/gc-array.wast.out4
-rw-r--r--test/example/c-api-kitchen-sink.txt2
-rw-r--r--test/heap-types.wast4
-rw-r--r--test/heap-types.wast.from-wast4
-rw-r--r--test/heap-types.wast.fromBinary4
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo4
-rw-r--r--test/lit/array-init-static.wast29
-rw-r--r--test/lit/exec/strings.wast2
-rw-r--r--test/lit/heap-types.wast6
-rw-r--r--test/lit/passes/cfp.wast4
-rw-r--r--test/lit/passes/gufa-refs.wast24
-rw-r--r--test/lit/passes/gufa-vs-cfp.wast4
-rw-r--r--test/lit/passes/merge-similar-functions_all-features.wast8
-rw-r--r--test/lit/passes/precompute-gc-immutable.wast8
-rw-r--r--test/lit/passes/type-merging.wast4
-rw-r--r--test/lit/passes/type-ssa.wast30
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt16
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast8
28 files changed, 121 insertions, 81 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index 53853b7f3..d9c01f53f 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -593,7 +593,8 @@ instructions = [
("array.new_default", "makeArrayNew(s, true)"),
("array.new_data", "makeArrayNewSeg(s, NewData)"),
("array.new_elem", "makeArrayNewSeg(s, NewElem)"),
- ("array.init_static", "makeArrayNewFixedStatic(s)"),
+ ("array.init_static", "makeArrayNewFixed(s)"), # deprecated
+ ("array.new_fixed", "makeArrayNewFixed(s)"),
("array.get", "makeArrayGet(s)"),
("array.get_s", "makeArrayGet(s, true)"),
("array.get_u", "makeArrayGet(s, false)"),
diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc
index 0022296a4..cbd2c027c 100644
--- a/src/gen-s-parser.inc
+++ b/src/gen-s-parser.inc
@@ -36,7 +36,7 @@ switch (buf[0]) {
}
}
case 'i':
- if (op == "array.init_static"sv) { return makeArrayNewFixedStatic(s); }
+ if (op == "array.init_static"sv) { return makeArrayNewFixed(s); }
goto parse_error;
case 'l':
if (op == "array.len"sv) { return makeArrayLen(s); }
@@ -62,6 +62,9 @@ switch (buf[0]) {
case 'e':
if (op == "array.new_elem"sv) { return makeArrayNewSeg(s, NewElem); }
goto parse_error;
+ case 'f':
+ if (op == "array.new_fixed"sv) { return makeArrayNewFixed(s); }
+ goto parse_error;
default: goto parse_error;
}
}
@@ -3637,7 +3640,7 @@ switch (buf[0]) {
}
case 'i':
if (op == "array.init_static"sv) {
- auto ret = makeArrayNewFixedStatic(ctx, pos);
+ auto ret = makeArrayNewFixed(ctx, pos);
CHECK_ERR(ret);
return *ret;
}
@@ -3686,6 +3689,13 @@ switch (buf[0]) {
return *ret;
}
goto parse_error;
+ case 'f':
+ if (op == "array.new_fixed"sv) {
+ auto ret = makeArrayNewFixed(ctx, pos);
+ CHECK_ERR(ret);
+ return *ret;
+ }
+ goto parse_error;
default: goto parse_error;
}
}
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 85fd2c21a..4a4fe60c7 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -2289,7 +2289,7 @@ struct PrintExpressionContents
if (printUnreachableReplacement(curr)) {
return;
}
- printMedium(o, "array.init_static");
+ printMedium(o, "array.new_fixed");
o << ' ';
TypeNamePrinter(o, wasm).print(curr->type.getHeapType());
}
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 1e86252a1..f09094c9d 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1110,7 +1110,7 @@ enum ASTNodes {
ArrayLenAnnotated = 0x17,
ArrayCopy = 0x18,
ArrayLen = 0x19,
- ArrayNewFixedStatic = 0x1a,
+ ArrayNewFixed = 0x1a,
ArrayNew = 0x1b,
ArrayNewDefault = 0x1c,
ArrayNewData = 0x1d,
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index a52915441..5692df03d 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -297,7 +297,7 @@ private:
Expression* makeStructSet(Element& s);
Expression* makeArrayNew(Element& s, bool default_);
Expression* makeArrayNewSeg(Element& s, ArrayNewSegOp op);
- Expression* makeArrayNewFixedStatic(Element& s);
+ Expression* makeArrayNewFixed(Element& s);
Expression* makeArrayGet(Element& s, bool signed_ = false);
Expression* makeArraySet(Element& s);
Expression* makeArrayLen(Element& s);
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index e5e05bacc..72f99c033 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -7111,7 +7111,7 @@ bool WasmBinaryBuilder::maybeVisitArrayNewSeg(Expression*& out, uint32_t code) {
bool WasmBinaryBuilder::maybeVisitArrayNewFixed(Expression*& out,
uint32_t code) {
- if (code == BinaryConsts::ArrayNewFixedStatic) {
+ if (code == BinaryConsts::ArrayNewFixed) {
auto heapType = getIndexedHeapType();
auto size = getU32LEB();
std::vector<Expression*> values(size);
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 4f4b28754..522c3f3c6 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -2925,7 +2925,7 @@ Expression* SExpressionWasmBuilder::makeArrayNewSeg(Element& s,
return Builder(wasm).makeArrayNewSeg(op, heapType, seg, offset, size);
}
-Expression* SExpressionWasmBuilder::makeArrayNewFixedStatic(Element& s) {
+Expression* SExpressionWasmBuilder::makeArrayNewFixed(Element& s) {
auto heapType = parseHeapType(*s[1]);
size_t i = 2;
std::vector<Expression*> values;
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index 3f53e3dde..b0e78c22e 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -2195,7 +2195,7 @@ void BinaryInstWriter::visitArrayNewSeg(ArrayNewSeg* curr) {
void BinaryInstWriter::visitArrayNewFixed(ArrayNewFixed* curr) {
o << int8_t(BinaryConsts::GCPrefix);
- o << U32LEB(BinaryConsts::ArrayNewFixedStatic);
+ o << U32LEB(BinaryConsts::ArrayNewFixed);
parent.writeIndexedHeapType(curr->type.getHeapType());
o << U32LEB(curr->values.size());
}
diff --git a/src/wasm/wat-parser.cpp b/src/wasm/wat-parser.cpp
index ee48d7262..89e913ab5 100644
--- a/src/wasm/wat-parser.cpp
+++ b/src/wasm/wat-parser.cpp
@@ -2365,7 +2365,7 @@ Result<typename Ctx::InstrT> makeArrayNew(Ctx&, Index, bool default_);
template<typename Ctx>
Result<typename Ctx::InstrT> makeArrayNewSeg(Ctx&, Index, ArrayNewSegOp op);
template<typename Ctx>
-Result<typename Ctx::InstrT> makeArrayNewFixedStatic(Ctx&, Index);
+Result<typename Ctx::InstrT> makeArrayNewFixed(Ctx&, Index);
template<typename Ctx>
Result<typename Ctx::InstrT> makeArrayGet(Ctx&, Index, bool signed_ = false);
template<typename Ctx> Result<typename Ctx::InstrT> makeArraySet(Ctx&, Index);
@@ -3525,7 +3525,7 @@ makeArrayNewSeg(Ctx& ctx, Index pos, ArrayNewSegOp op) {
}
template<typename Ctx>
-Result<typename Ctx::InstrT> makeArrayNewFixedStatic(Ctx& ctx, Index pos) {
+Result<typename Ctx::InstrT> makeArrayNewFixed(Ctx& ctx, Index pos) {
return ctx.in.err("unimplemented instruction");
}
diff --git a/test/ctor-eval/gc-array.wast b/test/ctor-eval/gc-array.wast
index 8f6731821..316230e13 100644
--- a/test/ctor-eval/gc-array.wast
+++ b/test/ctor-eval/gc-array.wast
@@ -5,7 +5,7 @@
;; This global will remain as it is.
(global $global1 (ref $array)
- (array.init_static $array
+ (array.new_fixed $array
(i32.const 10)
(i32.const 20)
(i32.const 30)
@@ -14,7 +14,7 @@
)
(global $global2 (ref $array)
- (array.init_static $array
+ (array.new_fixed $array
(i32.const 42)
;; This location will be written with a new value, 1337
(i32.const 0)
diff --git a/test/ctor-eval/gc-array.wast.out b/test/ctor-eval/gc-array.wast.out
index 8da67f758..27be809ba 100644
--- a/test/ctor-eval/gc-array.wast.out
+++ b/test/ctor-eval/gc-array.wast.out
@@ -1,13 +1,13 @@
(module
(type $array (array (mut i32)))
(type $none_=>_i32 (func (result i32)))
- (global $global1 (ref $array) (array.init_static $array
+ (global $global1 (ref $array) (array.new_fixed $array
(i32.const 10)
(i32.const 20)
(i32.const 30)
(i32.const 40)
))
- (global $global2 (ref $array) (array.init_static $array
+ (global $global2 (ref $array) (array.new_fixed $array
(i32.const 42)
(i32.const 1337)
))
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index ecfdfc081..f35b947f4 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -2298,7 +2298,7 @@ BinaryenFeatureAll: 126975
)
)
(drop
- (array.init_static $[mut:i8]
+ (array.new_fixed $[mut:i8]
(i32.const 1)
(i32.const 2)
(i32.const 3)
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 243863946..afdb9128e 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -287,7 +287,7 @@
)
)
(func $array-init (result (ref $vector))
- (array.init_static $vector
+ (array.new_fixed $vector
(f64.const 1)
(f64.const 2)
(f64.const 4)
@@ -295,7 +295,7 @@
)
)
(func $array-init-packed (result (ref $bytes))
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const 4)
(i32.const 2)
(i32.const 1)
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 213a45b5a..7d7fd62de 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -348,7 +348,7 @@
)
)
(func $array-init (type $none_=>_ref|$vector|) (result (ref $vector))
- (array.init_static $vector
+ (array.new_fixed $vector
(f64.const 1)
(f64.const 2)
(f64.const 4)
@@ -356,7 +356,7 @@
)
)
(func $array-init-packed (type $none_=>_ref|$bytes|) (result (ref $bytes))
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const 4)
(i32.const 2)
(i32.const 1)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 80981535c..e69cf99b1 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -301,7 +301,7 @@
)
)
(func $array-init (type $none_=>_ref|$vector|) (result (ref $vector))
- (array.init_static $vector
+ (array.new_fixed $vector
(f64.const 1)
(f64.const 2)
(f64.const 4)
@@ -309,7 +309,7 @@
)
)
(func $array-init-packed (type $none_=>_ref|$bytes|) (result (ref $bytes))
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const 4)
(i32.const 2)
(i32.const 1)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 6c37eba77..6596733ff 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -301,7 +301,7 @@
)
)
(func $16 (type $none_=>_ref|[mut:f64]|) (result (ref $[mut:f64]))
- (array.init_static $[mut:f64]
+ (array.new_fixed $[mut:f64]
(f64.const 1)
(f64.const 2)
(f64.const 4)
@@ -309,7 +309,7 @@
)
)
(func $17 (type $none_=>_ref|[mut:i8]|) (result (ref $[mut:i8]))
- (array.init_static $[mut:i8]
+ (array.new_fixed $[mut:i8]
(i32.const 4)
(i32.const 2)
(i32.const 1)
diff --git a/test/lit/array-init-static.wast b/test/lit/array-init-static.wast
new file mode 100644
index 000000000..266a874a6
--- /dev/null
+++ b/test/lit/array-init-static.wast
@@ -0,0 +1,29 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-opt -all %s -S -o - | filecheck %s
+
+;; Check that the deprecated `array.init_static` alias for `array.new_fixed` is
+;; parsed correctly.
+
+(module
+ ;; CHECK: (type $none_=>_none (func))
+
+ ;; CHECK: (type $array (array i32))
+ (type $array (array i32))
+ ;; CHECK: (func $test (type $none_=>_none)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (array.new_fixed $array
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $test
+ (drop
+ (array.init_static $array
+ (i32.const 0)
+ (i32.const 1)
+ )
+ )
+ )
+)
diff --git a/test/lit/exec/strings.wast b/test/lit/exec/strings.wast
index 6aa9d7b8a..6d07ae6a8 100644
--- a/test/lit/exec/strings.wast
+++ b/test/lit/exec/strings.wast
@@ -9,7 +9,7 @@
;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello")
(func "new_wtf16_array" (result stringref)
(string.new_wtf16_array
- (array.init_static $array16
+ (array.new_fixed $array16
(i32.const 104) ;; h
(i32.const 101) ;; e
(i32.const 108) ;; l
diff --git a/test/lit/heap-types.wast b/test/lit/heap-types.wast
index 83926e573..ce7c7814e 100644
--- a/test/lit/heap-types.wast
+++ b/test/lit/heap-types.wast
@@ -117,7 +117,7 @@
(type $vector (array (mut f64)))
;; CHECK: (func $test (type $none_=>_none)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.init_static $vector
+ ;; CHECK-NEXT: (array.new_fixed $vector
;; CHECK-NEXT: (f64.const 1)
;; CHECK-NEXT: (f64.const 2)
;; CHECK-NEXT: (f64.const 4)
@@ -127,7 +127,7 @@
;; CHECK-NEXT: )
;; NOMNL: (func $test (type $none_=>_none)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (array.init_static $vector
+ ;; NOMNL-NEXT: (array.new_fixed $vector
;; NOMNL-NEXT: (f64.const 1)
;; NOMNL-NEXT: (f64.const 2)
;; NOMNL-NEXT: (f64.const 4)
@@ -137,7 +137,7 @@
;; NOMNL-NEXT: )
(func $test
(drop
- (array.init_static $vector
+ (array.new_fixed $vector
(f64.const 1)
(f64.const 2)
(f64.const 4)
diff --git a/test/lit/passes/cfp.wast b/test/lit/passes/cfp.wast
index e7ca52e6f..0aeb1f41b 100644
--- a/test/lit/passes/cfp.wast
+++ b/test/lit/passes/cfp.wast
@@ -2076,7 +2076,7 @@
;; CHECK: (type $ref?|$object|_=>_funcref (func (param (ref null $object)) (result funcref)))
- ;; CHECK: (global $global (ref $itable) (array.init_static $itable
+ ;; CHECK: (global $global (ref $itable) (array.new_fixed $itable
;; CHECK-NEXT: (struct.new $vtable
;; CHECK-NEXT: (ref.null nofunc)
;; CHECK-NEXT: )
@@ -2084,7 +2084,7 @@
;; CHECK-NEXT: (ref.func $test)
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
- (global $global (ref $itable) (array.init_static $itable
+ (global $global (ref $itable) (array.new_fixed $itable
(struct.new $vtable
(ref.null func)
)
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index f1ea265d7..995a14fd1 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -877,7 +877,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (array.init_static $vector
+ ;; CHECK-NEXT: (array.new_fixed $vector
;; CHECK-NEXT: (f64.const 1.1)
;; CHECK-NEXT: (f64.const 2.2)
;; CHECK-NEXT: )
@@ -905,7 +905,7 @@
)
(drop
(ref.as_non_null
- (array.init_static $vector
+ (array.new_fixed $vector
(f64.const 1.1)
(f64.const 2.2)
)
@@ -3680,14 +3680,14 @@
;; CHECK-NEXT: (local $bytes (ref null $bytes))
;; CHECK-NEXT: (local $chars (ref null $chars))
;; CHECK-NEXT: (local.set $bytes
- ;; CHECK-NEXT: (array.init_static $bytes
+ ;; CHECK-NEXT: (array.new_fixed $bytes
;; CHECK-NEXT: (i31.new
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $chars
- ;; CHECK-NEXT: (array.init_static $chars
+ ;; CHECK-NEXT: (array.new_fixed $chars
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -3719,12 +3719,12 @@
;; which means two things are possible in $chars, and we can't optimize
;; there.
(local.set $bytes
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i31.new (i32.const 0))
)
)
(local.set $chars
- (array.init_static $chars
+ (array.new_fixed $chars
(ref.null any)
)
)
@@ -3765,14 +3765,14 @@
;; CHECK-NEXT: (local $bytes (ref null $bytes))
;; CHECK-NEXT: (local $chars (ref null $chars))
;; CHECK-NEXT: (local.set $bytes
- ;; CHECK-NEXT: (array.init_static $bytes
+ ;; CHECK-NEXT: (array.new_fixed $bytes
;; CHECK-NEXT: (i31.new
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $chars
- ;; CHECK-NEXT: (array.init_static $chars
+ ;; CHECK-NEXT: (array.new_fixed $chars
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
@@ -3805,12 +3805,12 @@
(local $bytes (ref null $bytes))
(local $chars (ref null $chars))
(local.set $bytes
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i31.new (i32.const 0))
)
)
(local.set $chars
- (array.init_static $chars
+ (array.new_fixed $chars
(ref.null any)
)
)
@@ -4147,7 +4147,7 @@
;; CHECK: (func $arrays (type $ref|$B|_=>_none) (param $B (ref $B))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (array.len
- ;; CHECK-NEXT: (array.init_static $B
+ ;; CHECK-NEXT: (array.new_fixed $B
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
@@ -4157,7 +4157,7 @@
(func $arrays (param $B (ref $B))
(drop
(array.len $B
- (array.init_static $B
+ (array.new_fixed $B
(ref.null none)
(ref.null none)
)
diff --git a/test/lit/passes/gufa-vs-cfp.wast b/test/lit/passes/gufa-vs-cfp.wast
index 3d192bc1f..0a678af4f 100644
--- a/test/lit/passes/gufa-vs-cfp.wast
+++ b/test/lit/passes/gufa-vs-cfp.wast
@@ -2620,7 +2620,7 @@
;; CHECK: (type $none_=>_funcref (func (result funcref)))
- ;; CHECK: (global $global (ref $itable) (array.init_static $itable
+ ;; CHECK: (global $global (ref $itable) (array.new_fixed $itable
;; CHECK-NEXT: (struct.new $vtable
;; CHECK-NEXT: (ref.null nofunc)
;; CHECK-NEXT: )
@@ -2628,7 +2628,7 @@
;; CHECK-NEXT: (ref.func $test)
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
- (global $global (ref $itable) (array.init_static $itable
+ (global $global (ref $itable) (array.new_fixed $itable
(struct.new $vtable
(ref.null func)
)
diff --git a/test/lit/passes/merge-similar-functions_all-features.wast b/test/lit/passes/merge-similar-functions_all-features.wast
index 9d3361e7f..873b6453a 100644
--- a/test/lit/passes/merge-similar-functions_all-features.wast
+++ b/test/lit/passes/merge-similar-functions_all-features.wast
@@ -44,7 +44,7 @@
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (call $take-ref-null-array
- ;; CHECK-NEXT: (array.init_static $[i8])
+ ;; CHECK-NEXT: (array.new_fixed $[i8])
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $no-call-subtyping-same-operand-0
@@ -52,7 +52,7 @@
(nop) (nop) (nop) (nop) (nop) (nop)
(nop) (nop) (nop) (nop) (nop) (nop)
(call $take-ref-null-array
- (array.init_static $[i8])
+ (array.new_fixed $[i8])
)
)
;; CHECK: (func $no-call-subtyping-same-operand-1 (type $none_=>_none)
@@ -75,7 +75,7 @@
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (call $take-ref-eq
- ;; CHECK-NEXT: (array.init_static $[i8])
+ ;; CHECK-NEXT: (array.new_fixed $[i8])
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $no-call-subtyping-same-operand-1
@@ -83,7 +83,7 @@
(nop) (nop) (nop) (nop) (nop) (nop)
(nop) (nop) (nop) (nop) (nop) (nop)
(call $take-ref-eq
- (array.init_static $[i8])
+ (array.new_fixed $[i8])
)
)
diff --git a/test/lit/passes/precompute-gc-immutable.wast b/test/lit/passes/precompute-gc-immutable.wast
index 2c03bfa7a..980276ebb 100644
--- a/test/lit/passes/precompute-gc-immutable.wast
+++ b/test/lit/passes/precompute-gc-immutable.wast
@@ -673,11 +673,11 @@
;; CHECK: (type $object (struct (field (ref $vtable))))
(type $object (struct (ref $vtable)))
- ;; CHECK: (global $vtable (ref $vtable) (array.init_static $vtable
+ ;; CHECK: (global $vtable (ref $vtable) (array.new_fixed $vtable
;; CHECK-NEXT: (ref.func $nested-creations)
;; CHECK-NEXT: ))
(global $vtable (ref $vtable)
- (array.init_static $vtable
+ (array.new_fixed $vtable
(ref.func $nested-creations)
)
)
@@ -751,7 +751,7 @@
;; CHECK: (type $vtable-1 (struct (field funcref)))
(type $vtable-1 (struct funcref))
- ;; CHECK: (global $itable (ref $itable) (array.init_static $itable
+ ;; CHECK: (global $itable (ref $itable) (array.new_fixed $itable
;; CHECK-NEXT: (struct.new $vtable-0
;; CHECK-NEXT: (ref.func $nested-creations)
;; CHECK-NEXT: )
@@ -760,7 +760,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: ))
(global $itable (ref $itable)
- (array.init_static $itable
+ (array.new_fixed $itable
(struct.new $vtable-0
(ref.func $nested-creations)
)
diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast
index ecdc6f961..ef62c669c 100644
--- a/test/lit/passes/type-merging.wast
+++ b/test/lit/passes/type-merging.wast
@@ -604,7 +604,7 @@
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: (global.get $global$0)
;; CHECK-NEXT: (i64.const 0)
- ;; CHECK-NEXT: (array.init_static $I)
+ ;; CHECK-NEXT: (array.new_fixed $I)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $0 (type $G) (param $0 (ref $C)) (result (ref $D))
@@ -613,7 +613,7 @@
(i32.const 0)
(global.get $global$0)
(i64.const 0)
- (array.init_static $I)
+ (array.new_fixed $I)
)
)
)
diff --git a/test/lit/passes/type-ssa.wast b/test/lit/passes/type-ssa.wast
index abc47901f..ddfe8c089 100644
--- a/test/lit/passes/type-ssa.wast
+++ b/test/lit/passes/type-ssa.wast
@@ -374,75 +374,75 @@
)
)
- ;; CHECK: (func $array.init_static (type $ref|i31|_anyref_=>_none) (param $refined (ref i31)) (param $null-any anyref)
+ ;; CHECK: (func $array.new_fixed (type $ref|i31|_anyref_=>_none) (param $refined (ref i31)) (param $null-any anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.init_static $array$5
+ ;; CHECK-NEXT: (array.new_fixed $array$5
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.init_static $array$6
+ ;; CHECK-NEXT: (array.new_fixed $array$6
;; CHECK-NEXT: (local.get $refined)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.init_static $array
+ ;; CHECK-NEXT: (array.new_fixed $array
;; CHECK-NEXT: (local.get $null-any)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (array.init_static $array
+ ;; CHECK-NEXT: (array.new_fixed $array
;; CHECK-NEXT: (local.get $refined)
;; CHECK-NEXT: (local.get $null-any)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; NOMNL: (func $array.init_static (type $ref|i31|_anyref_=>_none) (param $refined (ref i31)) (param $null-any anyref)
+ ;; NOMNL: (func $array.new_fixed (type $ref|i31|_anyref_=>_none) (param $refined (ref i31)) (param $null-any anyref)
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (array.init_static $array$5
+ ;; NOMNL-NEXT: (array.new_fixed $array$5
;; NOMNL-NEXT: (ref.null none)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (array.init_static $array$6
+ ;; NOMNL-NEXT: (array.new_fixed $array$6
;; NOMNL-NEXT: (local.get $refined)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (array.init_static $array
+ ;; NOMNL-NEXT: (array.new_fixed $array
;; NOMNL-NEXT: (local.get $null-any)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (array.init_static $array
+ ;; NOMNL-NEXT: (array.new_fixed $array
;; NOMNL-NEXT: (local.get $refined)
;; NOMNL-NEXT: (local.get $null-any)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
- (func $array.init_static (param $refined (ref i31)) (param $null-any (ref null any))
+ (func $array.new_fixed (param $refined (ref i31)) (param $null-any (ref null any))
;; Null, interesting, so we get a new type.
(drop
- (array.init_static $array
+ (array.new_fixed $array
(ref.null none)
)
)
;; More refined type, interesting.
(drop
- (array.init_static $array
+ (array.new_fixed $array
(local.get $refined)
)
)
;; Same type as declared - boring, no new type.
(drop
- (array.init_static $array
+ (array.new_fixed $array
(local.get $null-any)
)
)
;; Mixture of boring and interesting => boring (since we infer a single type
;; for the entire array).
(drop
- (array.init_static $array
+ (array.new_fixed $array
(local.get $refined)
(local.get $null-any)
)
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index 2ff239257..6b5041340 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -38,11 +38,11 @@
[LoggingExternalInterface logging 99]
[LoggingExternalInterface logging 0]
[LoggingExternalInterface logging 10]
-[fuzz-exec] calling array.init_static
+[fuzz-exec] calling array.new_fixed
[LoggingExternalInterface logging 2]
[LoggingExternalInterface logging 42]
[LoggingExternalInterface logging 50]
-[fuzz-exec] calling array.init_static-packed
+[fuzz-exec] calling array.new_fixed-packed
[LoggingExternalInterface logging 8]
[fuzz-exec] calling static-casts
[LoggingExternalInterface logging 1]
@@ -76,8 +76,8 @@
(export "array-alloc-failure" (func $7))
(export "init-array-packed" (func $13))
(export "array-copy" (func $15))
- (export "array.init_static" (func $16))
- (export "array.init_static-packed" (func $17))
+ (export "array.new_fixed" (func $16))
+ (export "array.new_fixed-packed" (func $17))
(export "static-casts" (func $18))
(export "static-br_on_cast" (func $2))
(export "static-br_on_cast_fail" (func $20))
@@ -274,7 +274,7 @@
(call $log
(array.len
(local.tee $0
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const 42)
(i32.const 50)
)
@@ -297,7 +297,7 @@
(func $17 (type $void_func) (; has Stack IR ;)
(call $log
(array.get_u $bytes
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const -11512)
)
(i32.const 0)
@@ -369,11 +369,11 @@
[LoggingExternalInterface logging 99]
[LoggingExternalInterface logging 0]
[LoggingExternalInterface logging 10]
-[fuzz-exec] calling array.init_static
+[fuzz-exec] calling array.new_fixed
[LoggingExternalInterface logging 2]
[LoggingExternalInterface logging 42]
[LoggingExternalInterface logging 50]
-[fuzz-exec] calling array.init_static-packed
+[fuzz-exec] calling array.new_fixed-packed
[LoggingExternalInterface logging 8]
[fuzz-exec] calling static-casts
[LoggingExternalInterface logging 1]
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index 9828d7022..d7097ee1e 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -271,10 +271,10 @@
(array.get_u $bytes (local.get $x) (i32.const 12))
)
)
- (func "array.init_static"
+ (func "array.new_fixed"
(local $x (ref null $bytes))
(local.set $x
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const 42) ;; first value
(i32.const 50) ;; second value
)
@@ -292,10 +292,10 @@
(array.get_u $bytes (local.get $x) (i32.const 1))
)
)
- (func "array.init_static-packed"
+ (func "array.new_fixed-packed"
(local $x (ref null $bytes))
(local.set $x
- (array.init_static $bytes
+ (array.new_fixed $bytes
(i32.const -11512)
)
)