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 main function of this module is translate_module
.
Re-exports§
pub use wasmparser;
Modules§
- Rust module prelude for Wasmtime crates.
- A simple event-driven library for parsing WebAssembly binary files (or streams).
Macros§
- Creates a
String
using interpolation of runtime expressions. - Return an
Err(WasmError::Unsupported(msg))
wheremsg
the string built by callingformat!
on the arguments to this macro.
Structs§
- A constant expression.
- Index type of a passive data segment inside the WebAssembly module.
- 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.
- Index type of a passive element segment inside the WebAssembly module.
- Index type of a canonicalized recursive type group inside the whole engine (as opposed to canonicalized within just a single Wasm module).
- 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.
- Temporary object used to build a single Cranelift IR
Function
. - A WebAssembly global.
- Index type of a global variable (imported or defined) inside the WebAssembly module.
- An opaque reference to a
HeapData
. - A heap implementing a WebAssembly linear memory.
- WebAssembly linear memory.
- Index type of a linear memory (imported or defined) inside the WebAssembly module.
- Index type of a canonicalized recursive type group inside a WebAssembly module (as opposed to canonicalized within the whole engine).
- A canonicalized type index for a type within a single WebAssembly module.
- Index type of a defined memory inside the WebAssembly module.
- A canonicalized type index referencing a type within a single recursion group from another type within that same recursion group.
- Index into the global list of modules found within an entire component.
- WebAssembly table.
- An implementation of a WebAssembly table.
- Index type of a table (imported or defined) inside the WebAssembly module.
- WebAssembly event.
- Index type of an event inside the WebAssembly module.
- Index type of a type (imported or defined) inside the WebAssembly module.
- A canonicalized type index into an engine’s shared type registry.
- A concrete array type.
- The type of a struct field or array element.
- WebAssembly function type – equivalent of
wasmparser
’s FuncType. - A recursive type group.
- WebAssembly reference type – equivalent of
wasmparser
’s RefType - A concrete struct type.
- A concrete, user-defined (or host-defined) Wasm type.
Enums§
- The subset of Wasm opcodes that are constant.
- An interned type index, either at the module or engine level.
- An index of an entity.
- A type of an item in a wasm module where an item is typically something that can be exported.
- The value of a WebAssembly global variable.
- Style of heap including style-specific information.
- Size of a WebAssembly table, in elements.
- A function, array, or struct type.
- A WebAssembly translation error.
- A top heap type.
- WebAssembly heap type – equivalent of
wasmparser
’s HeapType - Represents storage types introduced in the GC spec for array and struct fields.
- WebAssembly value type – equivalent of
wasmparser::ValType
.
Constants§
- Version number of this crate.
- Maximum size, in bytes, of 32-bit memories (4G)
Traits§
- Environment affecting the translation of a single WebAssembly function.
- An object satisfying the
ModuleEnvironment
trait can be passed as argument to thetranslate_module
function. These methods should not be called by the user, they are only forcranelift-wasm
internal use. - Environment affecting the translation of a WebAssembly.
- Helpers used to convert a
wasmparser
type to a type in this crate. - A trait for things that can trace all type-to-type edges, aka all type indices within this thing.
Functions§
- Create a
Block
with the given Wasm parameters. - Get the parameter and result types for the given Wasm blocktype.
- Turns a
wasmparser
f32
into aCranelift
one. - Turns a
wasmparser
f64
into aCranelift
one. - 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
.
Type Aliases§
- A convenient alias for a
Result
that usesWasmError
as the error type.