summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 16ba60d72..c1df740df 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -330,6 +330,7 @@ public:
void visitMemoryGrow(MemoryGrow* curr);
void visitRefIsNull(RefIsNull* curr);
void visitRefFunc(RefFunc* curr);
+ void visitRefEq(RefEq* curr);
void visitTry(Try* curr);
void visitThrow(Throw* curr);
void visitRethrow(Rethrow* curr);
@@ -1957,6 +1958,21 @@ void FunctionValidator::visitRefFunc(RefFunc* curr) {
shouldBeTrue(!!func, curr, "function argument of ref.func must exist");
}
+void FunctionValidator::visitRefEq(RefEq* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "ref.eq requires gc to be enabled");
+ shouldBeSubTypeOrFirstIsUnreachable(
+ curr->left->type,
+ Type::eqref,
+ curr->left,
+ "ref.eq's left argument should be a subtype of eqref");
+ shouldBeSubTypeOrFirstIsUnreachable(
+ curr->right->type,
+ Type::eqref,
+ curr->right,
+ "ref.eq's right argument should be a subtype of eqref");
+}
+
void FunctionValidator::visitTry(Try* curr) {
if (curr->type != Type::unreachable) {
shouldBeSubTypeOrFirstIsUnreachable(