Crate wasmer_clif_fork_wasm

Source
Expand description

Performs translation from a wasm module in binary format to the in-memory form of Cranelift IR. More particularly, it translates the code of all the functions bodies and interacts with an environment implementing the ModuleEnvironment trait to deal with tables, globals and linear memory.

The crate provides a DummyEnvironment struct that will allow to translate the code of the functions but will fail at execution.

The main function of this module is translate_module.

Macros§

  • Return an Err(WasmError::Unsupported(msg)) where msg the string built by calling format! on the arguments to this macro.

Structs§

  • Index type of a defined function inside the WebAssembly module.
  • Index type of a defined global inside the WebAssembly module.
  • Index type of a defined memory inside the WebAssembly module.
  • Index type of a defined table inside the WebAssembly module.
  • This ModuleEnvironment implementation is a “naïve” one, doing essentially nothing and emitting placeholders when forced to. Don’t try to execute code translated for this environment, essentially here for translation debug purposes.
  • Index type of a function (imported or defined) inside the WebAssembly module.
  • Contains information passed along during a function’s translation and that records:
  • WebAssembly to Cranelift IR function translator.
  • WebAssembly global.
  • Index type of a global variable (imported or defined) inside the WebAssembly module.
  • WebAssembly linear memory.
  • Index type of a linear memory (imported or defined) inside the WebAssembly module.
  • Contains information decoded from the Wasm module that must be referenced during each Wasm function’s translation.
  • Index type of a passive data segment inside the WebAssembly module.
  • Index type of a passive element segment inside the WebAssembly module.
  • Index type of a signature (imported or defined) inside the WebAssembly module.
  • WebAssembly table.
  • Index type of a table (imported or defined) inside the WebAssembly module.

Enums§

  • Globals are initialized via the const operators or by referring to another import.
  • The value of a WebAssembly global variable.
  • How to return from functions.
  • WebAssembly table element. Can be a function or a scalar type.
  • A WebAssembly translation error.

Constants§

  • Version number of this crate.

Traits§

  • Environment affecting the translation of a single WebAssembly function.
  • An object satisfying the ModuleEnvironment trait can be passed as argument to the translate_module function. These methods should not be called by the user, they are only for cranelift-wasm internal use.
  • Environment affecting the translation of a WebAssembly.

Functions§

  • Declare count local variables of the same type, starting from next_local.
  • Special VMContext value label. It is tracked as 0xffff_fffe label.
  • Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cranelift IR Function.
  • Translates wasm operators into Cranelift IR instructions. Returns true if it inserted a return.

Type Aliases§

  • A convenient alias for a Result that uses WasmError as the error type.