API Functions

Function

WasmModule WasmVM::module_parse(std::istream &stream)
std::ostream &WasmVM::module_dump(const WasmModule &module, std::ostream &stream)
std::ostream &WasmVM::module_encode(const WasmModule &module, std::ostream &stream)
WasmModule WasmVM::module_decode(std::istream &stream)
std::optional<Exception::Exception> WasmVM::module_validate(const WasmModule &module)
ModuleInst &WasmVM::module_instanciate(ModuleInst &moduleInst, Store &store, const WasmModule &module, std::vector<ExternVal> externval)

Exception

struct WasmVM::Exception::Exception : public std::runtime_error
Exception(std::string msg)
struct WasmVM::Exception::Parse : public Exception
Parse(std::string msg, std::pair<size_t, size_t> location)
std::pair<size_t, size_t> location
struct WasmVM::Exception::Decode : public Exception
Decode(std::string msg, size_t location)
size_t location
struct WasmVM::Exception::unexpected_eof : public Exception
unexpected_eof()
struct WasmVM::Exception::interrupted : public Exception

Thrown by Stack::run() when the embedder’s interrupt flag reads true. Not a wasm-level exception: the guest’s try_table/catch_all cannot swallow it.

interrupted()
struct WasmVM::Exception::Trap : public Exception

Base of every WebAssembly trap escaping Stack::run(): the guest hit a condition the spec defines as trapping (unreachable, integer divide by zero, out-of-bounds memory or table access, indirect call type mismatch, null reference, failed cast, …). The concrete trap types are private to WasmVM; catch this base.

Trap(std::string msg)
struct WasmVM::Exception::Uncaught : public Exception

A wasm throw no try_table in the guest caught, escaping Stack::run(). Not a Trap.

Uncaught(std::shared_ptr<WasmException> exn)
std::shared_ptr<WasmException> exn

The thrown exception: its tag address and payload values.

struct WasmVM::Exception::Warning
Warning(std::string msg)
Warning(const char *msg)
static void regist(std::function<void(std::string)> handler)