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;
Modules§
- __core
- The Rust Core Library
- 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. - wasmparser
- A simple event-driven library for parsing WebAssembly binary files (or streams).
Macros§
- entity_
impl - Macro which provides the common implementation of a 32-bit entity reference.
- foreach_
builtin_ function - Helper macro to iterate over all builtin functions and their signatures.
- wasm_
unsupported - Return an
Err(WasmError::Unsupported(msg))wheremsgthe string built by callingformat!on the arguments to this macro.
Structs§
- Boxed
Slice - A slice mapping
K -> Vallocating 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.
- Data
Index - Index type of a passive data segment inside the WebAssembly module.
- 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.
- Entity
List - A small list of entity references allocated from a pool.
- Entity
Set - A set of
Kfor 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
Loc - Description of where a function is located in the text section of a compiled image.
- Function
Name - The name of a function stored in the
ELF_NAME_DATAsection. - Function
Type - Type information about functions in a wasm module.
- 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.
- IterMut
- Iterate over all keys in order.
- Keys
- Iterate over all keys in order.
- 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.
- Memory
Plan - A WebAssembly linear memory description along with our chosen style for implementing it.
- Metadata
- Metadata associated with a compiled ELF artifact.
- Module
- A translated WebAssembly module, excluding the function bodies and memory initializers.
- Module
Interned Type Index - Index type of a deduplicated type (imported or defined) inside a WebAssembly module.
- Module
Types - All types used in a core wasm module.
- Module
Types Builder - A builder for
ModuleTypes. - Operator
Cost - The fuel cost of each operator.
- Owned
Memory Index - Index type of a defined memory inside the WebAssembly module.
- Primary
Map - A primary mapping
K -> Vallocating dense entity references. - Scope
Vec - Small data structure to help extend the lifetime of a slice to a higher scope.
- Secondary
Map - A mapping
K -> Vfor densely indexed entity references. - 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
MemoryInitializerbut 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
Plan - A WebAssembly table description along with our chosen style for implementing it.
- Table
Segment - A WebAssembly table initializer segment.
- Tag
- WebAssembly event.
- TagIndex
- Index type of an event inside the WebAssembly module.
- 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
VMContextand other related structs that JIT code accesses directly. - VMOffsets
Fields - Used to construct a
VMOffsets - 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
RefType - WebAssembly reference type – equivalent of
wasmparser’s RefType - Wasmparser
Type Converter
Enums§
- 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 - Global
Init - Globals are initialized via the
constoperators or by referring to another import. - Init
Memory - Argument to
MemoryInitialization::init_memoryindicating the current status of the instance. - 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.
- Memory
Style - Implementation styles for WebAssembly linear memory.
- Module
Type - Different types that can appear in a module.
- Object
Kind - Types of objects that can be created by
Compiler::object - Table
Element Expression - Different kinds of expression that can initialize table elements.
- 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.
- Table
Style - Implementation styles for WebAssembly tables.
- Trap
- VMGc
Kind - The kind of an object in a GC heap.
- Wasm
Error - A WebAssembly translation error.
- Wasm
Heap Type - WebAssembly heap type – equivalent of
wasmparser’s HeapType - 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
i31refor 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_MAGICexcept for array-call host functions. - VM_
NATIVE_ CALL_ HOST_ FUNC_ MAGIC - Equivalent of
VMCONTEXT_MAGICexcept for native-call host functions. - WASM32_
MAX_ PAGES - The number of pages (for 32-bit modules) we can have before we run out of byte index space.
- WASM64_
MAX_ PAGES - The number of pages (for 64-bit modules) we can have before we run out of byte index space.
- WASM_
PAGE_ SIZE - WebAssembly page sizes are defined to be 64KiB.
Traits§
- Entity
Ref - A type wrapping a small integer index should implement
EntityRefso it can be used as the key of anSecondaryMaporSparseMap. - PtrSize
- Trait used for the
ptrrepresentation of the field ofVMOffsets - Sparse
MapValue - Trait for extracting keys from values stored in a
SparseMap. - Type
Convert - Helpers used to convert a
wasmparsertype 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§
- 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.
- iterate_
address_ map - Iterate over the address map contained in the given address map section.
- lookup_
file_ pos - Lookup an
offsetwithin an encoded address map section, returning the originalFilePosthat 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
offsetspecified.
Type Aliases§
- Sparse
Set - A sparse set of entity references.
- Wasm
Result - A convenient alias for a
Resultthat usesWasmErroras the error type.