summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-02-21 15:33:13 -0800
committerGitHub <noreply@github.com>2024-02-21 15:33:13 -0800
commite4d2e7c08e758c513eb2a8b193a5bf4df589c947 (patch)
tree2c9cde5d01ff42324ba874543cdc9cf5602ebf29 /src
parent93b497068746283a786b045046afd1f4608ccfa3 (diff)
downloadbinaryen-e4d2e7c08e758c513eb2a8b193a5bf4df589c947.tar.gz
binaryen-e4d2e7c08e758c513eb2a8b193a5bf4df589c947.tar.bz2
binaryen-e4d2e7c08e758c513eb2a8b193a5bf4df589c947.zip
Validator: ArrayNew|InitData require Bulk Memory (#6331)
Those instructions refer to a data segment, which mean the DataCount section must be emitted before them (so that, per the spec, they can be validated by looking only at previous sections), which implies bulk-memory is needed.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-validator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 3688587be..3fbcb0bfb 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2909,6 +2909,10 @@ void FunctionValidator::visitArrayNew(ArrayNew* curr) {
void FunctionValidator::visitArrayNewData(ArrayNewData* curr) {
visitArrayNew(curr);
+ shouldBeTrue(
+ getModule()->features.hasBulkMemory(),
+ curr,
+ "Data segment operations require bulk memory [--enable-bulk-memory]");
if (!shouldBeTrue(getModule()->getDataSegment(curr->segment),
curr,
"array.new_data segment should exist")) {
@@ -3175,6 +3179,10 @@ void FunctionValidator::visitArrayInit(ArrayInit* curr) {
void FunctionValidator::visitArrayInitData(ArrayInitData* curr) {
visitArrayInit(curr);
+ shouldBeTrue(
+ getModule()->features.hasBulkMemory(),
+ curr,
+ "Data segment operations require bulk memory [--enable-bulk-memory]");
shouldBeTrue(getModule()->getDataSegmentOrNull(curr->segment),
curr,
"array.init_data segment must exist");