ModuleInstance

ModuleInstance

data class ModuleInstance

Represents an instantiated kwasm.ast.module.WasmModule.

From the docs:

A module instance is the runtime representation of a module. It is created by instantiating a module, and collects runtime representations of all entities that are imported, defined, or exported by the module.


moduleinst ::= {
types functype*,
funcaddrs funcaddr*,
tableaddrs tableaddr*,
memaddrs memaddr*,
globaladdrs globaladdr*,
exports exportinst*
}

Each component references runtime instances corresponding to respective declarations from the original module – whether imported or defined – in the order of their static indices. Function instances, table instances, memory instances, and global instances are referenced with an indirection through their respective addresses in the store.

It is an invariant of the semantics that all export instances in a given module instance have different names.

Fields

Name Description
val types: TypeIndex
val functionAddresses: AddressIndex<Function, Function>
val tableAddresses: AddressIndex<Table, Table>
val memoryAddresses: AddressIndex<Memory, Memory>
val globalAddresses: AddressIndex<Global, Global>
val exports: List<Export>

Methods

toGlobalInitInstance

fun toGlobalInitInstance(importedGlobals: List<Global>): ModuleInstance

Returns a version of this ModuleInstance which only consists of the available globals.

Parameters

Name Description
importedGlobals: List<Global>

ReturnValue

Name Description
ModuleInstance