Expand description
This module primarily provides the Vm type and the necessary name-lookup and runtime-dispatch mechanisms needed to allow WASM modules to call into the Env interface implemented by Host.
It also contains helper methods to look up and call into contract functions in terms of [ScVal] and Val arguments.
The implementation of WASM types and the WASM bytecode interpreter come from the wasmi project.
Structs§
- A ModuleCache is a cache of a set of Wasm modules that have been parsed but not yet instantiated, along with a shared and reusable Engine storing their code. The cache must be populated eagerly with all the contracts in a single Host’s lifecycle (at least) added all at once, since each wasmi Engine is locked during execution and no new modules can be added to it.
- A ParsedModule contains the parsed wasmi::Module for a given Wasm blob, as well as a protocol number and set of [ContractCodeCostInputs] extracted from the module when it was parsed.
- A Vm is a thin wrapper around an instance of wasmi::Module. Multiple Vms may be held in a single Host, and each contains a single WASM module instantiation.