Expand description
Standalone environment for WebAssembly using Cranelift. Provides functions to translate
get_global
, set_global
, memory.size
, memory.grow
, call_indirect
that hardcode in
the translation the base addresses of regions of memory that will hold the globals, tables and
linear memories.
Re-exports§
pub use object;
pub use wasmparser;
Modules§
- __core
- The Rust Core Library
- component
- Support for the component model in Wasmtime.
- drc
- Layout of Wasm GC objects in the deferred reference-counting collector.
- fact
- Wasmtime’s Fused Adapter Compiler of Trampolines (FACT)
- null
- Layout of Wasm GC objects in the null garbage collector.
- obj
- Utilities for working with object files that operate as Wasmtime’s serialization and intermediate format for compiled modules.
- packed_
option - Compact representation of
Option<T>
for types with a reserved value. - prelude
- Rust module prelude for Wasmtime crates.
Macros§
- entity_
impl - Macro which provides the common implementation of a 32-bit entity reference.
- foreach_
builtin_ component_ function - Helper macro, like
foreach_transcoder
, to iterate over builtins for components unrelated to transcoding. - foreach_
builtin_ function - Helper macro to iterate over all builtin functions and their signatures.
- wasm_
unsupported - Return an
Err(WasmError::Unsupported(msg))
wheremsg
the string built by callingformat!
on the arguments to this macro.
Structs§
- Address
MapSection - Builder for the address map section of a wasmtime compilation image.
- Boxed
Slice - A slice mapping
K -> V
allocating dense entity references. - Builtin
Function Index - An index type for builtin functions.
- Compiled
Function Info - Secondary in-memory results of function compilation.
- Compiled
Module Info - Secondary in-memory results of module compilation.
- Config
Tunables - Optional tunable configuration options used in
wasmtime::Config
- Const
Expr - A constant expression.
- Data
Index - Index type of a passive data segment inside the WebAssembly module.
- Debug
Info Data - Defined
Func Index - Index type of a defined function inside the WebAssembly module.
- Defined
Global Index - Index type of a defined global inside the WebAssembly module.
- Defined
Memory Index - Index type of a defined memory inside the WebAssembly module.
- Defined
Table Index - Index type of a defined table inside the WebAssembly module.
- Elem
Index - Index type of a passive element segment inside the WebAssembly module.
- Engine
Interned RecGroup Index - Index type of a canonicalized recursive type group inside the whole engine (as opposed to canonicalized within just a single Wasm module).
- Entity
List - A small list of entity references allocated from a pool.
- Entity
Set - A set of
K
for densely indexed entity references. - FilePos
- A position within an original source file,
- Func
Index - Index type of a function (imported or defined) inside the WebAssembly module.
- Func
RefIndex - Index into the funcref table within a VMContext for a function.
- Function
Body Data - Contains function data: byte code and its offset in the module.
- Function
Loc - Description of where a function is located in the text section of a compiled image.
- Function
Metadata - Function
Name - The name of a function stored in the
ELF_NAME_DATA
section. - Function
Type - Type information about functions in a wasm module.
- GcArray
Layout - The layout of a GC-managed array.
- GcStruct
Layout - The layout for a GC-managed struct type.
- Global
- A WebAssembly global.
- Global
Index - Index type of a global variable (imported or defined) inside the WebAssembly module.
- HostPtr
- Type representing the size of a pointer for the current compilation host
- Instruction
Address Map - Single source location to generated address mapping.
- Iter
- Iterate over all keys in order.
- Iter
Entity Range - Iterator type returned by
iter_entity_range
. - IterMut
- Iterate over all keys in order.
- Keys
- Iterate over all keys in order.
- Limits
- The size range of resizeable storage associated with Memory types and Table types.
- List
Pool - A memory pool for storing lists of
T
. - Memory
- WebAssembly linear memory.
- Memory
Index - Index type of a linear memory (imported or defined) inside the WebAssembly module.
- Memory
Initializer - A WebAssembly linear memory initializer.
- Metadata
- Metadata associated with a compiled ELF artifact.
- Module
- A translated WebAssembly module, excluding the function bodies and memory initializers.
- Module
Environment - Object containing the standalone environment information.
- Module
Interned RecGroup Index - Index type of a canonicalized recursive type group inside a WebAssembly module (as opposed to canonicalized within the whole engine).
- Module
Interned Type Index - A canonicalized type index for a type within a single WebAssembly module.
- Module
Translation - The result of translating via
ModuleEnvironment
. Function bodies are not yet translated, and data initializers have not yet been copied out of the original buffer. - Module
Types - All types used in a core wasm module.
- Module
Types Builder - A builder for
ModuleTypes
. - Name
Section - Object
Builder - Helper structure to create an ELF file as a compilation artifact.
- Owned
Memory Index - Index type of a defined memory inside the WebAssembly module.
- Primary
Map - A primary mapping
K -> V
allocating dense entity references. - RecGroup
Relative Type Index - A canonicalized type index referencing a type within a single recursion group from another type within that same recursion group.
- Scope
Vec - Small data structure to help extend the lifetime of a slice to a higher scope.
- Secondary
Map - A mapping
K -> V
for densely indexed entity references. - Setting
- Description of compiler settings returned by
CompilerBuilder::settings
. - Size
Overflow - Sparse
Map - A sparse mapping of entity references.
- Stack
Map - A map for determining where live GC references live in a stack frame.
- Stack
MapInformation - The offset within a function of a GC safepoint, and its associated stack map.
- Static
Memory Initializer - Similar to the above
MemoryInitializer
but only used when memory initializers are statically known to be valid. - Static
Module Index - Index into the global list of modules found within an entire component.
- Table
- WebAssembly table.
- Table
Index - Index type of a table (imported or defined) inside the WebAssembly module.
- Table
Initialization - Table initialization data for all tables in the module.
- Table
Segment - A WebAssembly table initializer segment.
- Tag
- WebAssembly event.
- TagIndex
- Index type of an event inside the WebAssembly module.
- Trap
Encoding Builder - A helper structure to build the custom-encoded section of a wasmtime compilation image which encodes trap information.
- Trap
Information - Information about trap.
- Tunables
- Tunable parameters for WebAssembly compilation.
- Type
Index - Index type of a type (imported or defined) inside the WebAssembly module.
- VMOffsets
- This class computes offsets to fields within
VMContext
and other related structs that JIT code accesses directly. - VMOffsets
Fields - Used to construct a
VMOffsets
- VMShared
Type Index - A canonicalized type index into an engine’s shared type registry.
- Wasm
Array Type - A concrete array type.
- Wasm
Composite Type - Wasm
Field Type - The type of a struct field or array element.
- Wasm
File Info - Wasm
Func Type - WebAssembly function type – equivalent of
wasmparser
’s FuncType. - Wasm
Function Info - Information about a function, such as trap information, address map, and stack maps.
- Wasm
RecGroup - A recursive type group.
- Wasm
RefType - WebAssembly reference type – equivalent of
wasmparser
’s RefType - Wasm
Struct Type - A concrete struct type.
- Wasm
SubType - A concrete, user-defined (or host-defined) Wasm type.
- Wasmparser
Type Converter - A convert from
wasmparser
types to Wasmtime types.
Enums§
- Collector
- The garbage collector implementation to use.
- Compile
Error - An error while compiling WebAssembly to machine code.
- ConstOp
- The subset of Wasm opcodes that are constant.
- Engine
OrModule Type Index - An interned type index, either at the module or engine level.
- Entity
Index - An index of an entity.
- Entity
Type - A type of an item in a wasm module where an item is typically something that can be exported.
- Flag
Value - Value of a configured setting for a
Compiler
- GcLayout
- The layout of a GC-managed object.
- Host
Call - Enumeration of all possible ways that wasm may execute code in the host.
- Index
Type - The type that can be used to index into Memory and Table.
- Initializer
- Initialization routines for creating an instance, encompassing imports, modules, instances, aliases, etc.
- Memory
Initialization - The type of WebAssembly linear memory initialization to use for a module.
- Object
Kind - Types of objects that can be created by
Compiler::object
- Relocation
Target - What relocations can be applied against.
- Setting
Kind - Different kinds of
Setting
values that can be configured in aCompilerBuilder
- Table
Initial Value - Initial value for all elements in a table.
- Table
Segment Elements - Elements of a table segment, either a list of functions or list of arbitrary expressions.
- Trap
- Trap
Sentinel - Return value of
BuiltinFunctionIndex::trap_sentinel
. - VMGc
Kind - The kind of an object in a GC heap.
- Wasm
Composite Inner Type - A function, array, or struct type.
- Wasm
Error - A WebAssembly translation error.
- Wasm
Heap Bottom Type - A bottom heap type.
- Wasm
Heap TopType - A top heap type.
- Wasm
Heap Type - WebAssembly heap type – equivalent of
wasmparser
’s HeapType - Wasm
Storage Type - Represents storage types introduced in the GC spec for array and struct fields.
- Wasm
ValType - WebAssembly value type – equivalent of
wasmparser::ValType
.
Constants§
- FUNCREF_
INIT_ BIT - An “initialized bit” in a funcref table.
- FUNCREF_
MASK - The mask we apply to all refs loaded from funcref tables.
- I31_
DISCRIMINANT - Discriminant to check whether GC reference is an
i31ref
or not. - NON_
NULL_ NON_ I31_ MASK - A mask that can be used to check for non-null and non-i31ref GC references with a single bitwise-and operation.
- VERSION
- Version number of this crate.
- VMCONTEXT_
MAGIC - Magic value for core Wasm VM contexts.
- VM_
ARRAY_ CALL_ HOST_ FUNC_ MAGIC - Equivalent of
VMCONTEXT_MAGIC
except for array-call host functions. - VM_
GC_ HEADER_ ALIGN - The minimum alignment of the
VMGcHeader
in bytes. - VM_
GC_ HEADER_ KIND_ OFFSET - The offset of the
VMGcKind
field in theVMGcHeader
. - VM_
GC_ HEADER_ SIZE - The size of the
VMGcHeader
in bytes. - VM_
GC_ HEADER_ TYPE_ INDEX_ OFFSET - The offset of the
VMSharedTypeIndex
field in theVMGcHeader
. - WASM32_
MAX_ SIZE - Maximum size, in bytes, of 32-bit memories (4G)
Traits§
- Cache
Store - Implementation of an incremental compilation’s key/value cache store.
- Compiler
- An implementation of a compiler which can compile WebAssembly functions to machine code and perform other miscellaneous tasks needed by the JIT runtime.
- Compiler
Builder - Abstract trait representing the ability to create a
Compiler
below. - Entity
Ref - A type wrapping a small integer index should implement
EntityRef
so it can be used as the key of anSecondaryMap
orSparseMap
. - Finished
Object - A type which can be the result of serializing an object.
- GcType
Layouts - A trait for getting the layout of a Wasm GC struct or array inside a particular collector.
- Init
Memory - The various callbacks provided here are used to drive the smaller bits of memory initialization.
- PtrSize
- Trait used for the
ptr
representation of the field ofVMOffsets
- Signed
- Helper trait used to add
signed()
methods to primitive unsigned integer types. - Sparse
MapValue - Trait for extracting keys from values stored in a
SparseMap
. - Triple
Ext - Extension methods for
target_lexicon::Triple
. - Type
Convert - Helpers used to convert a
wasmparser
type to a type in this crate. - Type
Trace - A trait for things that can trace all type-to-type edges, aka all type indices within this thing.
- Unsigned
- Helper trait used to add
unsigned()
methods to primitive signed integer types.
Functions§
- byte_
size_ of_ wasm_ ty_ in_ gc_ heap - Get the byte size of the given Wasm type when it is stored inside the GC heap.
- demangle_
function_ name - Demangles a single function name into a user-readable form.
- demangle_
function_ name_ or_ index - Demangles a function name if it’s provided, or returns a unified representation based on the function index otherwise.
- iter_
entity_ range - Iterate over a
Range<E: EntityRef>
, yielding a sequence ofE
items. - iterate_
address_ map - Iterate over the address map contained in the given address map section.
- lookup_
file_ pos - Lookup an
offset
within an encoded address map section, returning the originalFilePos
that corresponds to the offset, if found. - lookup_
trap_ code - Decodes the provided trap information section and attempts to find the trap
code corresponding to the
offset
specified.
Type Aliases§
- Dwarf
- Sparse
Set - A sparse set of entity references.
- Wasm
Result - A convenient alias for a
Result
that usesWasmError
as the error type.