diff options
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r-- | src/wasm-interpreter.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index d76f3fabf..37bebdf6b 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -197,7 +197,7 @@ public: Flow visit(Expression* curr) { depth++; if (maxDepth != NO_LIMIT && depth > maxDepth) { - trap("interpreter recursion limit"); + hostLimit("interpreter recursion limit"); } auto ret = OverriddenVisitor<SubType, Flow>::visit(curr); if (!ret.breaking()) { @@ -1622,7 +1622,7 @@ public: // limits on 32-bit machines, and in particular on wasm32 VMs that do not // have 4GB support, so give up there. if (num >= (1 << 30) / sizeof(Literal)) { - trap("allocation failure"); + hostLimit("allocation failure"); } Literals data(num); if (curr->isWithDefault()) { @@ -1739,6 +1739,8 @@ public: virtual void trap(const char* why) { WASM_UNREACHABLE("unimp"); } + virtual void hostLimit(const char* why) { WASM_UNREACHABLE("unimp"); } + virtual void throwException(const WasmException& exn) { WASM_UNREACHABLE("unimp"); } @@ -2024,6 +2026,8 @@ public: void trap(const char* why) override { throw NonconstantException(); } + void hostLimit(const char* why) override { throw NonconstantException(); } + virtual void throwException(const WasmException& exn) override { throw NonconstantException(); } @@ -2076,6 +2080,7 @@ public: SubType& instance) = 0; virtual bool growMemory(Address oldSize, Address newSize) = 0; virtual void trap(const char* why) = 0; + virtual void hostLimit(const char* why) = 0; virtual void throwException(const WasmException& exn) = 0; // the default impls for load and store switch on the sizes. you can either @@ -3095,6 +3100,10 @@ private: instance.externalInterface->trap(why); } + void hostLimit(const char* why) override { + instance.externalInterface->hostLimit(why); + } + void throwException(const WasmException& exn) override { instance.externalInterface->throwException(exn); } |