diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-21 09:45:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-21 09:45:58 +0200 |
commit | 51350a8d2e7a361cf658951798351fc242420328 (patch) | |
tree | 8bc71e9126b719c4d1785d0f5bbb6248a601176f /src/wasm/wasm-validator.cpp | |
parent | e35cdb97adf6eb2ade2be7734d1c6c397d440dc1 (diff) | |
download | binaryen-51350a8d2e7a361cf658951798351fc242420328.tar.gz binaryen-51350a8d2e7a361cf658951798351fc242420328.tar.bz2 binaryen-51350a8d2e7a361cf658951798351fc242420328.zip |
GC: Add ref.eq instruction (#3145)
With `eqref` now integrated, the `ref.eq` instruction can be implemented. The only valid LHS and RHS value is `(ref.null eq)` for now, but implementation and fuzzer integration is otherwise complete.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 16 |
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( |