diff options
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 560051917..890e1a844 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -1046,6 +1046,8 @@ public: Flow visitAtomicCmpxchg(AtomicCmpxchg*) { WASM_UNREACHABLE(); } Flow visitAtomicWait(AtomicWait*) { WASM_UNREACHABLE(); } Flow visitAtomicNotify(AtomicNotify*) { WASM_UNREACHABLE(); } + Flow visitPush(Push*) { WASM_UNREACHABLE(); } + Flow visitPop(Pop*) { WASM_UNREACHABLE(); } virtual void trap(const char* why) { WASM_UNREACHABLE(); } }; @@ -1227,6 +1229,9 @@ public: // Values of globals GlobalManager globals; + // Multivalue ABI support (see push/pop). + std::vector<Literal> multiValues; + ModuleInstanceBase(Module& wasm, ExternalInterface* externalInterface) : wasm(wasm), externalInterface(externalInterface) { // import globals from the outside @@ -1776,6 +1781,22 @@ private: } return {}; } + Flow visitPush(Push* curr) { + NOTE_ENTER("Push"); + Flow value = this->visit(curr->value); + if (value.breaking()) { + return value; + } + instance.multiValues.push_back(value.value); + return Flow(); + } + Flow visitPop(Pop* curr) { + NOTE_ENTER("Pop"); + assert(!instance.multiValues.empty()); + auto ret = instance.multiValues.back(); + instance.multiValues.pop_back(); + return ret; + } void trap(const char* why) override { instance.externalInterface->trap(why); |