summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm/wasm-validator.cpp21
-rw-r--r--test/atomics-unshared.wast10
-rw-r--r--test/atomics-unshared.wast.from-wast13
-rw-r--r--test/atomics-unshared.wast.fromBinary14
-rw-r--r--test/atomics-unshared.wast.fromBinary.noDebugInfo14
5 files changed, 51 insertions, 21 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 2a4c19732..ff2ed7e39 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -931,9 +931,6 @@ void FunctionValidator::visitLoad(Load* curr) {
curr,
"SIMD operation (SIMD is disabled)");
}
- shouldBeFalse(curr->isAtomic && !getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
validateMemBytes(curr->bytes, curr->type, curr);
validateAlignment(curr->align, curr->type, curr->bytes, curr->isAtomic, curr);
shouldBeEqualOrFirstIsUnreachable(
@@ -965,9 +962,6 @@ void FunctionValidator::visitStore(Store* curr) {
curr,
"SIMD operation (SIMD is disabled)");
}
- shouldBeFalse(curr->isAtomic && !getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
validateMemBytes(curr->bytes, curr->valueType, curr);
validateAlignment(
curr->align, curr->valueType, curr->bytes, curr->isAtomic, curr);
@@ -994,9 +988,6 @@ void FunctionValidator::visitAtomicRMW(AtomicRMW* curr) {
shouldBeTrue(getModule()->features.hasAtomics(),
curr,
"Atomic operation (atomics are disabled)");
- shouldBeFalse(!getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
validateMemBytes(curr->bytes, curr->type, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
@@ -1017,9 +1008,6 @@ void FunctionValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) {
shouldBeTrue(getModule()->features.hasAtomics(),
curr,
"Atomic operation (atomics are disabled)");
- shouldBeFalse(!getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
validateMemBytes(curr->bytes, curr->type, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
@@ -1053,9 +1041,6 @@ void FunctionValidator::visitAtomicWait(AtomicWait* curr) {
shouldBeTrue(getModule()->features.hasAtomics(),
curr,
"Atomic operation (atomics are disabled)");
- shouldBeFalse(!getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
shouldBeEqualOrFirstIsUnreachable(
curr->type, Type(Type::i32), curr, "AtomicWait must have type i32");
shouldBeEqualOrFirstIsUnreachable(
@@ -1082,9 +1067,6 @@ void FunctionValidator::visitAtomicNotify(AtomicNotify* curr) {
shouldBeTrue(getModule()->features.hasAtomics(),
curr,
"Atomic operation (atomics are disabled)");
- shouldBeFalse(!getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
shouldBeEqualOrFirstIsUnreachable(
curr->type, Type(Type::i32), curr, "AtomicNotify must have type i32");
shouldBeEqualOrFirstIsUnreachable(
@@ -1105,9 +1087,6 @@ void FunctionValidator::visitAtomicFence(AtomicFence* curr) {
shouldBeTrue(getModule()->features.hasAtomics(),
curr,
"Atomic operation (atomics are disabled)");
- shouldBeFalse(!getModule()->memory.shared,
- curr,
- "Atomic operation with non-shared memory");
shouldBeTrue(curr->order == 0,
curr,
"Currently only sequentially consistent atomics are supported, "
diff --git a/test/atomics-unshared.wast b/test/atomics-unshared.wast
new file mode 100644
index 000000000..7b6d7bc3b
--- /dev/null
+++ b/test/atomics-unshared.wast
@@ -0,0 +1,10 @@
+(module
+ (memory $0 1 1)
+ (func $foo
+ (drop (i32.atomic.rmw.cmpxchg
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ ))
+ )
+)
diff --git a/test/atomics-unshared.wast.from-wast b/test/atomics-unshared.wast.from-wast
new file mode 100644
index 000000000..a29819c9b
--- /dev/null
+++ b/test/atomics-unshared.wast.from-wast
@@ -0,0 +1,13 @@
+(module
+ (type $none_=>_none (func))
+ (memory $0 1 1)
+ (func $foo
+ (drop
+ (i32.atomic.rmw.cmpxchg
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+)
diff --git a/test/atomics-unshared.wast.fromBinary b/test/atomics-unshared.wast.fromBinary
new file mode 100644
index 000000000..df4096757
--- /dev/null
+++ b/test/atomics-unshared.wast.fromBinary
@@ -0,0 +1,14 @@
+(module
+ (type $none_=>_none (func))
+ (memory $0 1 1)
+ (func $foo
+ (drop
+ (i32.atomic.rmw.cmpxchg
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+)
+
diff --git a/test/atomics-unshared.wast.fromBinary.noDebugInfo b/test/atomics-unshared.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..d9bb19b8e
--- /dev/null
+++ b/test/atomics-unshared.wast.fromBinary.noDebugInfo
@@ -0,0 +1,14 @@
+(module
+ (type $none_=>_none (func))
+ (memory $0 1 1)
+ (func $0
+ (drop
+ (i32.atomic.rmw.cmpxchg
+ (i32.const 0)
+ (i32.const 0)
+ (i32.const 0)
+ )
+ )
+ )
+)
+