gwr/execution/machine

Types

A configuration consists of the current store and an executing thread.

https://webassembly.github.io/spec/core/exec/runtime.html#configurations

pub type Configuration {
  Configuration(store: runtime.Store, thread: Thread)
}

Constructors

  • Configuration(store: runtime.Store, thread: Thread)
pub type Machine {
  Machine(
    module_instance: runtime.ModuleInstance,
    state: MachineState,
  )
}

Constructors

  • Machine(
      module_instance: runtime.ModuleInstance,
      state: MachineState,
    )
pub type MachineState {
  MachineState(configuration: Configuration, stack: stack.Stack)
}

Constructors

  • MachineState(configuration: Configuration, stack: stack.Stack)

A thread is a computation over instructions that operates relative to the state of a current frame referring to the module instance in which the computation runs, i.e., where the current function originates from.

NOTE: The current version of WebAssembly is single-threaded, but configurations with multiple threads may be supported in the future.

https://webassembly.github.io/spec/core/exec/runtime.html#configurations

pub type Thread {
  Thread(
    framestate: stack.FrameState,
    instructions: List(instruction.Instruction),
  )
}

Constructors

  • Thread(
      framestate: stack.FrameState,
      instructions: List(instruction.Instruction),
    )

Functions

pub fn address_to_int(address: Address) -> Int
pub fn address_to_string(address: Address) -> String
pub fn allocate_web_assembly_function(
  function: Function,
  store: Store,
  addresses: List(Address),
  types_list: List(FunctionType),
) -> Result(#(Store, List(Address)), String)
pub fn call(
  state: MachineState,
  index: Int,
  arguments: List(Value),
) -> Result(#(MachineState, List(Value)), String)
pub fn execute(
  current_state: MachineState,
) -> Result(MachineState, String)
pub fn i32_add(
  state: MachineState,
) -> Result(MachineState, String)
pub fn i32_const(
  state: MachineState,
  value: Int,
) -> Result(MachineState, a)
pub fn initialize(from module: Module) -> Result(Machine, String)
pub fn local_get(
  state: MachineState,
  index: Int,
) -> Result(MachineState, String)
Search Document