Skip to content

Commit 70fca92

Browse files
authored
Pause requires shared-everything (#7754)
Validate that shared-everything is enabled when the module contains a pause instruction. This will keep the fuzzer from trying to execute pauses on V8 and failing because we don't yet enable shared-everything on V8.
1 parent f04073d commit 70fca92

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/wasm/wasm-validator.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ struct FunctionValidator : public WalkerPass<PostWalker<FunctionValidator>> {
451451
void visitAtomicWait(AtomicWait* curr);
452452
void visitAtomicNotify(AtomicNotify* curr);
453453
void visitAtomicFence(AtomicFence* curr);
454+
void visitPause(Pause* curr);
454455
void visitSIMDExtract(SIMDExtract* curr);
455456
void visitSIMDReplace(SIMDReplace* curr);
456457
void visitSIMDShuffle(SIMDShuffle* curr);
@@ -1269,6 +1270,12 @@ void FunctionValidator::visitAtomicFence(AtomicFence* curr) {
12691270
"so AtomicFence's order should be 0");
12701271
}
12711272

1273+
void FunctionValidator::visitPause(Pause* curr) {
1274+
shouldBeTrue(getModule()->features.hasSharedEverything(),
1275+
curr,
1276+
"pause requires shared-everything [--enable-shared-everything]");
1277+
}
1278+
12721279
void FunctionValidator::visitSIMDExtract(SIMDExtract* curr) {
12731280
shouldBeTrue(getModule()->features.hasSIMD(),
12741281
curr,

test/lit/validation/pause.wast

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
;; Test that shared pause requires shared-everything threads
2+
3+
;; RUN: not wasm-opt %s 2>&1 | filecheck %s --check-prefix NO-SHARED
4+
;; RUN: wasm-opt %s --enable-reference-types --enable-gc --enable-shared-everything -o - -S | filecheck %s --check-prefix SHARED
5+
6+
;; NO-SHARED: pause requires shared-everything [--enable-shared-everything]
7+
;; SHARED: (pause)
8+
9+
(module
10+
(func (pause))
11+
)

0 commit comments

Comments
 (0)