summaryrefslogtreecommitdiff
path: root/src/shell-interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell-interface.h')
-rw-r--r--src/shell-interface.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/shell-interface.h b/src/shell-interface.h
index eb0e9f91c..15f600592 100644
--- a/src/shell-interface.h
+++ b/src/shell-interface.h
@@ -31,9 +31,17 @@
namespace wasm {
+// An exception emitted when exit() is called.
struct ExitException {};
+
+// An exception emitted when a wasm trap occurs.
struct TrapException {};
+// An exception emitted when a host limitation is hit. (These are not wasm traps
+// as they are not in the spec; for example, the spec has no limit on how much
+// GC memory may be allocated, but hosts have limits.)
+struct HostLimitException {};
+
struct ShellExternalInterface : ModuleInstance::ExternalInterface {
// The underlying memory can be accessed through unaligned pointers which
// isn't well-behaved in C++. WebAssembly nonetheless expects it to behave
@@ -265,6 +273,11 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface {
throw TrapException();
}
+ void hostLimit(const char* why) override {
+ std::cout << "[host limit " << why << "]\n";
+ throw HostLimitException();
+ }
+
void throwException(const WasmException& exn) override { throw exn; }
};