Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4213,6 +4213,9 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
VISIT(timeout, curr->timeout)
auto bytes = curr->expectedType.getByteSize();
auto info = getMemoryInstanceInfo(curr->memory);
if (!info.instance->wasm.getMemory(info.name)->shared) {
trap("cannot atomic.wait a non-shared memory");
}
auto memorySizeBytes = info.instance->getMemorySizeBytes(info.name);
auto addr = info.instance->getFinalAddress(
curr, ptr.getSingleValue(), bytes, memorySizeBytes);
Expand Down
18 changes: 16 additions & 2 deletions test/lit/exec/atomic.wast
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,31 @@
(module
(import "fuzzing-support" "log-i32" (func $log (param i32)))

(memory $0 23 256 shared)
(memory $shared 23 256 shared)
(memory $unshared 10 20)

;; CHECK: [fuzz-exec] export wait_and_log
;; CHECK-NEXT: [LoggingExternalInterface logging 2]
(func $wait_and_log (export "wait_and_log")
(call $log
(memory.atomic.wait64
(memory.atomic.wait64 $shared
(i32.const 0)
(i64.const 0)
(i64.const 0)
)
)
)

;; CHECK: [fuzz-exec] export wait_unshared
;; CHECK-NEXT: [trap cannot atomic.wait a non-shared memory]
(func $wait_unshared (export "wait_unshared")
;; Waiting on an unshared memory traps.
(drop
(memory.atomic.wait32 $unshared
(i32.const 0)
(i32.const 0)
(i64.const 0)
)
)
)
)
Loading