summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-09-10 09:39:10 -0700
committerGitHub <noreply@github.com>2021-09-10 09:39:10 -0700
commit3ed93d00b8f7c0d1f4ab2086b386836f2914dc0e (patch)
tree0511118fad9439fe6995ff0fe1e67b3231b67c14 /src/wasm-builder.h
parent23e452a5c89cc520a1d08bb465785bcb79a43baa (diff)
downloadbinaryen-3ed93d00b8f7c0d1f4ab2086b386836f2914dc0e.tar.gz
binaryen-3ed93d00b8f7c0d1f4ab2086b386836f2914dc0e.tar.bz2
binaryen-3ed93d00b8f7c0d1f4ab2086b386836f2914dc0e.zip
[Wasm GC] ArrayInit support (#4138)
array.init is like array.new_with_rtt except that it takes as arguments the values to initialize the array with (as opposed to a size and an optional initial value). Spec: https://docs.google.com/document/d/1afthjsL_B9UaMqCA5ekgVmOm75BVFu6duHNsN9-gnXw/edit#
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 3eb263580..018b0bf8b 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -840,6 +840,14 @@ public:
ret->finalize();
return ret;
}
+ ArrayInit* makeArrayInit(Expression* rtt,
+ const std::vector<Expression*>& values) {
+ auto* ret = wasm.allocator.alloc<ArrayInit>();
+ ret->rtt = rtt;
+ ret->values.set(values);
+ ret->finalize();
+ return ret;
+ }
ArrayGet*
makeArrayGet(Expression* ref, Expression* index, bool signed_ = false) {
auto* ret = wasm.allocator.alloc<ArrayGet>();