diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-04-17 20:29:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 20:29:32 -0700 |
commit | 13dd8771d57161618acec8907f739bcdbdcf66cb (patch) | |
tree | 19e1199454c75568d2d04aff417577ed570d541f /src/wasm-interpreter.h | |
parent | 2d6e3e108d0f4a484a7dde47c98081537754350e (diff) | |
download | binaryen-13dd8771d57161618acec8907f739bcdbdcf66cb.tar.gz binaryen-13dd8771d57161618acec8907f739bcdbdcf66cb.tar.bz2 binaryen-13dd8771d57161618acec8907f739bcdbdcf66cb.zip |
Use OverriddenVisitor in ExpressionRunner (#2024)
Should prevent surprises in the future.
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index ae9494d1c..bd6765770 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -116,10 +116,10 @@ public: // Execute an expression template<typename SubType> -class ExpressionRunner : public Visitor<SubType, Flow> { +class ExpressionRunner : public OverriddenVisitor<SubType, Flow> { public: Flow visit(Expression *curr) { - auto ret = Visitor<SubType, Flow>::visit(curr); + auto ret = OverriddenVisitor<SubType, Flow>::visit(curr); if (!ret.breaking() && (isConcreteType(curr->type) || isConcreteType(ret.value.type))) { #if 1 // def WASM_INTERPRETER_DEBUG if (ret.value.type != curr->type) { @@ -703,34 +703,38 @@ public: } } + Flow visitCall(Call*) { WASM_UNREACHABLE(); } + Flow visitCallIndirect(CallIndirect*) { WASM_UNREACHABLE(); } + Flow visitGetLocal(GetLocal*) { WASM_UNREACHABLE(); } + Flow visitSetLocal(SetLocal*) { WASM_UNREACHABLE(); } + Flow visitSetGlobal(SetGlobal*) { WASM_UNREACHABLE(); } + Flow visitLoad(Load *curr) { WASM_UNREACHABLE(); } + Flow visitStore(Store *curr) { WASM_UNREACHABLE(); } + Flow visitHost(Host *curr) { WASM_UNREACHABLE(); } + Flow visitMemoryInit(MemoryInit *curr) { WASM_UNREACHABLE(); } + Flow visitDataDrop(DataDrop *curr) { WASM_UNREACHABLE(); } + Flow visitMemoryCopy(MemoryCopy *curr) { WASM_UNREACHABLE(); } + Flow visitMemoryFill(MemoryFill *curr) { WASM_UNREACHABLE(); } + Flow visitAtomicRMW(AtomicRMW*) { WASM_UNREACHABLE(); } + Flow visitAtomicCmpxchg(AtomicCmpxchg*) { WASM_UNREACHABLE(); } + Flow visitAtomicWait(AtomicWait*) { WASM_UNREACHABLE(); } + Flow visitAtomicNotify(AtomicNotify*) { WASM_UNREACHABLE(); } + virtual void trap(const char* why) { WASM_UNREACHABLE(); } }; -// Execute an constant expression in a global init or memory offset +// Execute an constant expression in a global init or memory offset. template<typename GlobalManager> class ConstantExpressionRunner : public ExpressionRunner<ConstantExpressionRunner<GlobalManager>> { GlobalManager& globals; public: ConstantExpressionRunner(GlobalManager& globals) : globals(globals) {} - Flow visitLoop(Loop* curr) { WASM_UNREACHABLE(); } - Flow visitCall(Call* curr) { WASM_UNREACHABLE(); } - Flow visitCallIndirect(CallIndirect* curr) { WASM_UNREACHABLE(); } - Flow visitGetLocal(GetLocal *curr) { WASM_UNREACHABLE(); } - Flow visitSetLocal(SetLocal *curr) { WASM_UNREACHABLE(); } Flow visitGetGlobal(GetGlobal *curr) { return Flow(globals[curr->name]); } - Flow visitSetGlobal(SetGlobal *curr) { WASM_UNREACHABLE(); } - Flow visitLoad(Load *curr) { WASM_UNREACHABLE(); } - Flow visitStore(Store *curr) { WASM_UNREACHABLE(); } - Flow visitHost(Host *curr) { WASM_UNREACHABLE(); } - Flow visitMemoryInit(MemoryInit *curr) { WASM_UNREACHABLE(); } - Flow visitDataDrop(DataDrop *curr) { WASM_UNREACHABLE(); } - Flow visitMemoryCopy(MemoryCopy *curr) { WASM_UNREACHABLE(); } - Flow visitMemoryFill(MemoryFill *curr) { WASM_UNREACHABLE(); } }; // |