diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2019-07-19 23:56:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-19 23:56:11 -0700 |
commit | aed3d6ce85ce5eb3d53f2c1eb948b7ae916cc4b7 (patch) | |
tree | 13488bb2eda5657d7cb440cacacab4369b7fda1e /src/wasm/wasm-validator.cpp | |
parent | 72c52ea7d4eb61b95cf8a5164947cb760fe42e9c (diff) | |
download | binaryen-aed3d6ce85ce5eb3d53f2c1eb948b7ae916cc4b7.tar.gz binaryen-aed3d6ce85ce5eb3d53f2c1eb948b7ae916cc4b7.tar.bz2 binaryen-aed3d6ce85ce5eb3d53f2c1eb948b7ae916cc4b7.zip |
Revert "Remove bulk memory instructions refering to active segments (#2235)" (#2244)
This reverts commit 72c52ea7d4eb61b95cf8a5164947cb760fe42e9c, which was causing test failures after it merged.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 8098116be..24f301110 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -970,6 +970,8 @@ void FunctionValidator::visitSIMDShift(SIMDShift* curr) { } void FunctionValidator::visitMemoryInit(MemoryInit* curr) { + shouldBeTrue( + getModule()->memory.exists, curr, "Memory operations require a memory"); shouldBeTrue(getModule()->features.hasBulkMemory(), curr, "Bulk memory operation (bulk memory is disabled)"); @@ -981,33 +983,27 @@ void FunctionValidator::visitMemoryInit(MemoryInit* curr) { curr->offset->type, i32, curr, "memory.init offset must be an i32"); shouldBeEqualOrFirstIsUnreachable( curr->size->type, i32, curr, "memory.init size must be an i32"); - if (!shouldBeTrue(getModule()->memory.exists, - curr, - "Memory operations require a memory")) { - return; - } shouldBeTrue(curr->segment < getModule()->memory.segments.size(), curr, "memory.init segment index out of bounds"); } void FunctionValidator::visitDataDrop(DataDrop* curr) { + shouldBeTrue( + getModule()->memory.exists, curr, "Memory operations require a memory"); shouldBeTrue(getModule()->features.hasBulkMemory(), curr, "Bulk memory operation (bulk memory is disabled)"); shouldBeEqualOrFirstIsUnreachable( curr->type, none, curr, "data.drop must have type none"); - if (!shouldBeTrue(getModule()->memory.exists, - curr, - "Memory operations require a memory")) { - return; - } shouldBeTrue(curr->segment < getModule()->memory.segments.size(), curr, "data.drop segment index out of bounds"); } void FunctionValidator::visitMemoryCopy(MemoryCopy* curr) { + shouldBeTrue( + getModule()->memory.exists, curr, "Memory operations require a memory"); shouldBeTrue(getModule()->features.hasBulkMemory(), curr, "Bulk memory operation (bulk memory is disabled)"); @@ -1019,11 +1015,11 @@ void FunctionValidator::visitMemoryCopy(MemoryCopy* curr) { curr->source->type, i32, curr, "memory.copy source must be an i32"); shouldBeEqualOrFirstIsUnreachable( curr->size->type, i32, curr, "memory.copy size must be an i32"); - shouldBeTrue( - getModule()->memory.exists, curr, "Memory operations require a memory"); } void FunctionValidator::visitMemoryFill(MemoryFill* curr) { + shouldBeTrue( + getModule()->memory.exists, curr, "Memory operations require a memory"); shouldBeTrue(getModule()->features.hasBulkMemory(), curr, "Bulk memory operation (bulk memory is disabled)"); @@ -1035,8 +1031,6 @@ void FunctionValidator::visitMemoryFill(MemoryFill* curr) { curr->value->type, i32, curr, "memory.fill value must be an i32"); shouldBeEqualOrFirstIsUnreachable( curr->size->type, i32, curr, "memory.fill size must be an i32"); - shouldBeTrue( - getModule()->memory.exists, curr, "Memory operations require a memory"); } void FunctionValidator::validateMemBytes(uint8_t bytes, |