diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index 7af69988c73..94e5c204df6 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -2894,7 +2894,8 @@ Expression* TranslateToFuzzReader::_makeConcrete(Type type) { &Self::makeStringEq, &Self::makeStringMeasure, &Self::makeStringGet); - options.add(FeatureSet::ReferenceTypes | FeatureSet::SharedEverything, + options.add(FeatureSet::ReferenceTypes | FeatureSet::GC | + FeatureSet::SharedEverything, &Self::makeWaitqueueNotify); if (!structWaitFields.empty()) { options.add(FeatureSet::ReferenceTypes | FeatureSet::GC | diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index 553cfc2ba3b..45cc3899382 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -1294,7 +1294,8 @@ FeatureSet HeapType::getFeatures() const { return; case HeapType::waitqueue: case HeapType::nowaitqueue: - feats |= FeatureSet::ReferenceTypes | FeatureSet::SharedEverything; + feats |= FeatureSet::ReferenceTypes | FeatureSet::GC | + FeatureSet::SharedEverything; return; case HeapType::noext: case HeapType::nofunc: diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 9df283ad399..34b205abc4e 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -3696,10 +3696,13 @@ void FunctionValidator::visitStructCmpxchg(StructCmpxchg* curr) { } void FunctionValidator::visitStructWait(StructWait* curr) { - shouldBeTrue( - !getModule() || getModule()->features.hasSharedEverything(), - curr, - "struct.wait requires shared-everything [--enable-shared-everything]"); + FeatureSet expected = + FeatureSet::GC | FeatureSet::SharedEverything | FeatureSet::ReferenceTypes; + if (!shouldBeTrue(expected.isSubsetOf(getModule()->features), + curr, + "struct.wait requires additional features")) { + getStream() << getMissingFeaturesList(*getModule(), expected) << '\n'; + } shouldBeSubType(curr->waitqueue->type, Type(HeapTypes::sharedWaitqueue, Nullable), @@ -3747,17 +3750,23 @@ void FunctionValidator::visitStructWait(StructWait* curr) { } void FunctionValidator::visitWaitqueueNew(WaitqueueNew* curr) { - shouldBeTrue( - !getModule() || getModule()->features.hasSharedEverything(), - curr, - "waitqueue.new requires shared-everything [--enable-shared-everything]"); + FeatureSet expected = + FeatureSet::GC | FeatureSet::SharedEverything | FeatureSet::ReferenceTypes; + if (!shouldBeTrue(expected.isSubsetOf(getModule()->features), + curr, + "waitqueue.new requires additional features")) { + getStream() << getMissingFeaturesList(*getModule(), expected) << '\n'; + } } void FunctionValidator::visitWaitqueueNotify(WaitqueueNotify* curr) { - shouldBeTrue( - !getModule() || getModule()->features.hasSharedEverything(), - curr, - "waitqueue.notify requires shared-everything [--enable-shared-everything]"); + FeatureSet expected = + FeatureSet::GC | FeatureSet::SharedEverything | FeatureSet::ReferenceTypes; + if (!shouldBeTrue(expected.isSubsetOf(getModule()->features), + curr, + "waitqueue.notify requires additional features")) { + getStream() << getMissingFeaturesList(*getModule(), expected) << '\n'; + } shouldBeSubType( curr->waitqueue->type, diff --git a/test/lit/validation/waitqueue.wast b/test/lit/validation/waitqueue.wast index bdfb3245116..10035785bba 100644 --- a/test/lit/validation/waitqueue.wast +++ b/test/lit/validation/waitqueue.wast @@ -1,14 +1,21 @@ -;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s +;; RUN: not wasm-opt %s 2>&1 | filecheck %s ;; Tests feature-related validations. ;; Other validations are in the spec test spec/waitqueue.wast. (module (type $struct (struct (field i32))) - ;; CHECK: waitqueue.new requires shared-everything [--enable-shared-everything] + ;; CHECK: waitqueue.new requires additional features + ;; CHECK: [--enable-reference-types --enable-gc --enable-shared-everything] (func $new (drop (waitqueue.new)) ) - ;; CHECK: struct.wait requires shared-everything [--enable-shared-everything] + ;; CHECK: waitqueue.notify requires additional features + ;; CHECK: [--enable-reference-types --enable-gc --enable-shared-everything] + (func $notify (param $wq (ref null (shared waitqueue))) + (drop (waitqueue.notify (local.get $wq) (i32.const 1))) + ) + ;; CHECK: struct.wait requires additional features + ;; CHECK: [--enable-reference-types --enable-gc --enable-shared-everything] (func $wait-no-feature (param $ref (ref $struct)) (param $wq (ref null (shared waitqueue))) (drop (struct.wait $struct 0 (local.get $ref) (local.get $wq) (i32.const 0) (i64.const 0))) )