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-traversal.h | |
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-traversal.h')
-rw-r--r-- | src/wasm-traversal.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wasm-traversal.h b/src/wasm-traversal.h index 94997caf1..8267f4767 100644 --- a/src/wasm-traversal.h +++ b/src/wasm-traversal.h @@ -76,6 +76,7 @@ template<typename SubType, typename ReturnType = void> struct Visitor { ReturnType visitRefNull(RefNull* curr) { return ReturnType(); } ReturnType visitRefIsNull(RefIsNull* curr) { return ReturnType(); } ReturnType visitRefFunc(RefFunc* curr) { return ReturnType(); } + ReturnType visitRefEq(RefEq* curr) { return ReturnType(); } ReturnType visitTry(Try* curr) { return ReturnType(); } ReturnType visitThrow(Throw* curr) { return ReturnType(); } ReturnType visitRethrow(Rethrow* curr) { return ReturnType(); } @@ -180,6 +181,8 @@ template<typename SubType, typename ReturnType = void> struct Visitor { DELEGATE(RefIsNull); case Expression::Id::RefFuncId: DELEGATE(RefFunc); + case Expression::Id::RefEqId: + DELEGATE(RefEq); case Expression::Id::TryId: DELEGATE(Try); case Expression::Id::ThrowId: @@ -260,6 +263,7 @@ struct OverriddenVisitor { UNIMPLEMENTED(RefNull); UNIMPLEMENTED(RefIsNull); UNIMPLEMENTED(RefFunc); + UNIMPLEMENTED(RefEq); UNIMPLEMENTED(Try); UNIMPLEMENTED(Throw); UNIMPLEMENTED(Rethrow); @@ -365,6 +369,8 @@ struct OverriddenVisitor { DELEGATE(RefIsNull); case Expression::Id::RefFuncId: DELEGATE(RefFunc); + case Expression::Id::RefEqId: + DELEGATE(RefEq); case Expression::Id::TryId: DELEGATE(Try); case Expression::Id::ThrowId: @@ -518,6 +524,9 @@ struct UnifiedExpressionVisitor : public Visitor<SubType, ReturnType> { ReturnType visitRefFunc(RefFunc* curr) { return static_cast<SubType*>(this)->visitExpression(curr); } + ReturnType visitRefEq(RefEq* curr) { + return static_cast<SubType*>(this)->visitExpression(curr); + } ReturnType visitTry(Try* curr) { return static_cast<SubType*>(this)->visitExpression(curr); } @@ -835,6 +844,9 @@ struct Walker : public VisitorType { static void doVisitRefFunc(SubType* self, Expression** currp) { self->visitRefFunc((*currp)->cast<RefFunc>()); } + static void doVisitRefEq(SubType* self, Expression** currp) { + self->visitRefEq((*currp)->cast<RefEq>()); + } static void doVisitTry(SubType* self, Expression** currp) { self->visitTry((*currp)->cast<Try>()); } @@ -1108,6 +1120,12 @@ struct PostWalker : public Walker<SubType, VisitorType> { self->pushTask(SubType::doVisitRefFunc, currp); break; } + case Expression::Id::RefEqId: { + self->pushTask(SubType::doVisitRefEq, currp); + self->pushTask(SubType::scan, &curr->cast<RefEq>()->right); + self->pushTask(SubType::scan, &curr->cast<RefEq>()->left); + break; + } case Expression::Id::TryId: { self->pushTask(SubType::doVisitTry, currp); self->pushTask(SubType::scan, &curr->cast<Try>()->catchBody); |