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§
- prelude
- Rust module prelude for Wasmtime crates.
- wasmparser
- A simple event-driven library for parsing WebAssembly binary files (or streams).
Macros§
- __format 
- Creates a Stringusing interpolation of runtime expressions.
- wasm_unsupported 
- Return an Err(WasmError::Unsupported(msg))wheremsgthe string built by callingformat!on the arguments to this macro.
Structs§
- ConstExpr 
- A constant expression.
- DataIndex 
- Index type of a passive data segment inside the WebAssembly module.
- DefinedFunc Index 
- Index type of a defined function inside the WebAssembly module.
- DefinedGlobal Index 
- Index type of a defined global inside the WebAssembly module.
- DefinedMemory Index 
- Index type of a defined memory inside the WebAssembly module.
- DefinedTable Index 
- Index type of a defined table inside the WebAssembly module.
- ElemIndex 
- Index type of a passive element segment inside the WebAssembly module.
- EngineInterned RecGroup Index 
- Index type of a canonicalized recursive type group inside the whole engine (as opposed to canonicalized within just a single Wasm module).
- FuncIndex 
- Index type of a function (imported or defined) inside the WebAssembly module.
- FuncTranslation State 
- Contains information passed along during a function’s translation and that records:
- FuncTranslator 
- WebAssembly to Cranelift IR function translator.
- FunctionBuilder 
- Temporary object used to build a single Cranelift IR Function.
- Global
- A WebAssembly global.
- GlobalIndex 
- Index type of a global variable (imported or defined) inside the WebAssembly module.
- Heap
- An opaque reference to a HeapData.
- HeapData 
- A heap implementing a WebAssembly linear memory.
- Memory
- WebAssembly linear memory.
- MemoryIndex 
- Index type of a linear memory (imported or defined) inside the WebAssembly module.
- ModuleInterned RecGroup Index 
- Index type of a canonicalized recursive type group inside a WebAssembly module (as opposed to canonicalized within the whole engine).
- ModuleInterned Type Index 
- A canonicalized type index for a type within a single WebAssembly module.
- OwnedMemory Index 
- Index type of a defined memory inside the WebAssembly module.
- RecGroupRelative Type Index 
- A canonicalized type index referencing a type within a single recursion group from another type within that same recursion group.
- SizeOverflow 
- StaticModule Index 
- Index into the global list of modules found within an entire component.
- Table
- WebAssembly table.
- TableData 
- An implementation of a WebAssembly table.
- TableIndex 
- Index type of a table (imported or defined) inside the WebAssembly module.
- Tag
- WebAssembly event.
- TagIndex
- Index type of an event inside the WebAssembly module.
- TypeIndex 
- Index type of a type (imported or defined) inside the WebAssembly module.
- VMSharedType Index 
- A canonicalized type index into an engine’s shared type registry.
- WasmArray Type 
- A concrete array type.
- WasmField Type 
- The type of a struct field or array element.
- WasmFunc Type 
- WebAssembly function type – equivalent of wasmparser’s FuncType.
- WasmRecGroup 
- A recursive type group.
- WasmRefType 
- WebAssembly reference type – equivalent of wasmparser’s RefType
- WasmStruct Type 
- A concrete struct type.
- WasmSubType 
- A concrete, user-defined (or host-defined) Wasm type.
Enums§
- ConstOp
- The subset of Wasm opcodes that are constant.
- EngineOrModule Type Index 
- An interned type index, either at the module or engine level.
- EntityIndex 
- An index of an entity.
- EntityType 
- A type of an item in a wasm module where an item is typically something that can be exported.
- GlobalVariable 
- The value of a WebAssembly global variable.
- HeapStyle 
- Style of heap including style-specific information.
- TableSize 
- Size of a WebAssembly table, in elements.
- WasmComposite Type 
- A function, array, or struct type.
- WasmError 
- A WebAssembly translation error.
- WasmHeap TopType 
- A top heap type.
- WasmHeap Type 
- WebAssembly heap type – equivalent of wasmparser’s HeapType
- WasmStorage Type 
- Represents storage types introduced in the GC spec for array and struct fields.
- WasmValType 
- WebAssembly value type – equivalent of wasmparser::ValType.
Constants§
- VERSION
- Version number of this crate.
- WASM32_MAX_ SIZE 
- Maximum size, in bytes, of 32-bit memories (4G)
Traits§
- FuncEnvironment 
- Environment affecting the translation of a single WebAssembly function.
- ModuleEnvironment 
- An object satisfying the ModuleEnvironmenttrait can be passed as argument to thetranslate_modulefunction. These methods should not be called by the user, they are only forcranelift-wasminternal use.
- TargetEnvironment 
- Environment affecting the translation of a WebAssembly.
- TypeConvert 
- Helpers used to convert a wasmparsertype to a type in this crate.
- TypeTrace 
- A trait for things that can trace all type-to-type edges, aka all type indices within this thing.
Functions§
- block_with_ params 
- Create a Blockwith the given Wasm parameters.
- blocktype_params_ results 
- Get the parameter and result types for the given Wasm blocktype.
- f32_translation 
- Turns a wasmparserf32into aCraneliftone.
- f64_translation 
- Turns a wasmparserf64into aCraneliftone.
- get_vmctx_ value_ label 
- Special VMContext value label. It is tracked as 0xffff_fffe label.
- translate_module 
- Translate a sequence of bytes forming a valid Wasm binary into a list of valid Cranelift IR
Function.
Type Aliases§
- WasmResult 
- A convenient alias for a Resultthat usesWasmErroras the error type.