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
2 changes: 2 additions & 0 deletions src/wasm-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ struct TypeBuilder {
InvalidFuncType,
// A shared type with shared-everything disabled.
InvalidSharedType,
// WaitQueue was used with shared-everything disabled.
InvalidWaitQueue,
// A string type with strings disabled.
InvalidStringType,
// A non-shared field of a shared heap type.
Expand Down
6 changes: 6 additions & 0 deletions src/wasm/wasm-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,8 @@ std::ostream& operator<<(std::ostream& os, TypeBuilder::ErrorReason reason) {
return os << "Continuation has invalid function type";
case TypeBuilder::ErrorReason::InvalidSharedType:
return os << "Shared types require shared-everything";
case TypeBuilder::ErrorReason::InvalidWaitQueue:
return os << "Waitqueues require shared-everything";
case TypeBuilder::ErrorReason::InvalidStringType:
return os << "String types require strings feature";
case TypeBuilder::ErrorReason::InvalidUnsharedField:
Expand Down Expand Up @@ -2455,6 +2457,10 @@ validateStruct(const Struct& struct_, FeatureSet feats, bool isShared) {
if (auto err = validateType(field.type, feats, isShared)) {
return err;
}
if (field.packedType == Field::PackedType::WaitQueue &&
!feats.hasSharedEverything()) {
return TypeBuilder::ErrorReason::InvalidWaitQueue;
}
}
return std::nullopt;
}
Expand Down
9 changes: 9 additions & 0 deletions test/lit/validation/waitqueue.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;; RUN: not wasm-opt --enable-reference-types --enable-gc %s 2>&1 | filecheck %s

(module
;; CHECK: invalid type: Waitqueues require shared-everything
(type $t (struct (field waitqueue)))

;; use $t so wasm-opt doesn't drop the definition
(global (ref null $t) (ref.null $t))
)
Loading