Crate rwasm

Crate rwasm 

Source

Re-exports§

pub use wasmtime::compile_wasmtime_module;
pub use wasmtime::WasmtimeCaller;
pub use wasmtime::WasmtimeLinker;
pub use wasmtime::WasmtimeModule;
pub use wasmtime::WasmtimeStore;

Modules§

intrinsic
wasmtime

Macros§

instruction_set
instruction_set_internal

Structs§

BranchOffset
A signed offset for branch instructions.
Bytes
An amount of bytes of a linear memory.
CallStack
A lightweight call stack used by the interpreter to track return addresses. It stores instruction pointers for active calls and allows fast push/pop without heap churn. The capacity grows on demand but is typically small due to Wasm’s structured control flow.
CompilationConfig
Controls how a Wasm module is lowered into rwasm bytecode. Options affect entry routing, import linking, fuel metering, and validation relaxations for tests.
ConstructorParams
Optional binary blob passed to the module constructor via a custom section. When present, it is extracted from the “input” custom section and delivered to the host.
ElemIter
Iterator over u32 elements of the elem section
ExecutionEngine
Represents the core execution engine for managing the execution of a program, including the handling of values and function calls.
F32
A NaN preserving f32 type.
F64
A NaN preserving f64 type.
FuelConfig
FuelCosts
Type storing all kinds of fuel costs of instructions.
FuncRef
Opaque reference to a function within the module’s function index space. A zero value is reserved for the null reference, mirroring Wasm’s funcref null semantics.
FuncType
Represents a type of a function in a WebAssembly module.
GlobalMemory
Shared linear memory backing store for a running module. Tracks current size in Wasm pages and provides bounds-checked read/write helpers. The buffer is pre-reserved and grown in page-sized steps.
GlobalVariable
Describes a module’s global (type and initial value) as seen at compile time. The value can be materialized into a runtime Value when the type permits.
ImportLinker
ImportLinkerEntity
ImportName
The name or namespace of an imported item.
InstructionPtr
The instruction pointer to the instruction of a function on the call stack.
InstructionSet
Compact, linear sequence of rwasm opcodes produced by the compiler. Acts as the executable bytecode for the interpreter and supports simple editing during lowering. The layout is stable and indexable to allow cheap jumps and metadata lookups.
InstructionSetView
Zero-copy view for the encoded InstructionSet (Vec)
ModuleParser
Single-pass Wasm front-end that validates, translates, and assembles rwasm bytecode. It streams the Wasm module with wasmparser, builds the instruction set and sections, and applies configuration (entry routing, snippets) before finalizing the module.
OpcodeIter
Iterator over opcodes of the instruction set
OpcodeMeta
Pages
An amount of linear memory pages.
ReusableContext
RwasmCaller
RwasmCompilationResult
RwasmExecutor
The RwasmExecutor struct is a foundational component for executing WebAssembly modules in the rwasm runtime environment. It acts as the primary execution object, coordinating the state and execution flow of a WebAssembly module.
RwasmModule
Represents a compiled rWasm module.
RwasmModuleInner
RwasmModuleView
Zero-copy view over a compiled rWasm module binary.
RwasmStore
Host-side store that holds memory, tables, globals and host context for an rwasm instance. It also tracks fuel for metering and provides access to imported functions and syscalls. The store is passed to host callbacks and persists across invocations of the same module.
SimpleCallContext
StateRouterConfig
Configuration for dispatching to different entry functions based on a runtime state value. The router maps state tags to function indices and optionally provides an opcode to compute the tag.
TableEntity
A Wasm table entity.
UntypedValue
An untyped value.
ValueStack
The value stack used to execute Wasm bytecode.
ValueStackPtr
A pointer on the ValueStack.
WasmiCaller
WasmiStore

Enums§

CompilationError
HintType
Type of the hint
Opcode
RwasmError
Strategy
StrategyError
TrapCode
TypedCaller
TypedStore
ValType
Represents the types of values in a WebAssembly module.
Value
Runtime representation of a value.

Constants§

BASE_FUEL_COST
CALL_FUEL_COST
DEFAULT_MEMORY_INDEX
A default memory index in a Wasm binary. According to Wasm validation rules, this value is always 0, since Wasm doesn’t support multiple memory segments yet
DROP_KEEP_PER_FUEL
DROP_KEEP_PER_FUEL_LOG2
ENTITY_FUEL_COST
LOAD_FUEL_COST
LOCALS_PER_FUEL
LOCALS_PER_FUEL_LOG2
MEMORY_BYTES_PER_FUEL
MEMORY_BYTES_PER_FUEL_LOG2
NULL_FUNC_IDX
For null RefFunc/ExternRef types we use 0. We can do this because 0 offset is reserved under an entrypoint that can’t be re-called
N_BYTES_PER_MEMORY_PAGE
This constant is driven by WebAssembly standard, default memory page size is 64kB
N_DEFAULT_STACK_SIZE
A default stack size we use for stack allocation.
N_MAX_DATA_SEGMENTS
N_MAX_DATA_SEGMENTS_BITS
N_MAX_ELEM_SEGMENTS
N_MAX_ELEM_SEGMENTS_BITS
N_MAX_MEMORY_PAGES
We have a hard limit for max possible memory used that is equal to 1024 pages (64mB)
N_MAX_RECURSION_DEPTH
N_MAX_STACK_SIZE
N_MAX_TABLES
That maximum possible number of tables allowed, the limited is driven from Wasm standards
N_MAX_TABLE_SIZE
The maximum limit of elements in total can be fit into one table. It means in total you can have 100*1024=102_400 elements.
RWASM_MAGIC_BYTE_0
Rwasm magic bytes 0xef52 (0x52 stands for ‘R’ in ASCII)
RWASM_MAGIC_BYTE_1
RWASM_VERSION_V1
Rwasm binary version
SNIPPET_FUNC_IDX_UNRESOLVED
Placeholder for the function index of a snippet. The actual index is resolved in later compilation stages once the snippet’s final location is known.
STORE_FUEL_COST
TABLE_ELEMS_PER_FUEL
TABLE_ELEMS_PER_FUEL_LOG2

Traits§

ArithmeticOps
Arithmetic operations.
Caller
ExtendInto
Convert one type to another by extending with leading zeroes.
Float
Float-point value.
HostError
Trait that allows the host to return a custom error.
I64ValueSplit
Integer
Integer value.
LittleEndianConvert
Types that can be converted from and to little endian bytes.
LoadInto
Allows to efficiently load bytes from memory into a buffer.
SignExtendFrom
Sign-extends Self integer type from T integer type.
Store
StoreFrom
Allows to efficiently write bytes from a buffer into memory.
TransmuteInto
Reinterprets the bits of a value of one type as another type.
TruncateSaturateInto
Convert one type to another by rounding to the nearest integer towards zero.
TryTruncateInto
Convert one type to another by rounding to the nearest integer towards zero.
WithType
Untyped instances that allow to be typed.
WrapInto
Convert one type to another by wrapping.

Functions§

always_failing_syscall_handler
compile_evm_to_rwasm
compile_wasm_to_rwasm
compile_wasmi_module
for_each_strategy

Type Aliases§

AddressOffset
BlockFuel
BranchTableTargets
CompiledFunc
DataSegmentIdx
ElementSegmentIdx
ExternRef
FuncIdx
FuncTypeIdx
GlobalIdx
InstrLoc
LabelRef
LocalDepth
MaxStackHeight
MemoryIdx
SignatureIdx
SysFuncIdx
SyscallHandler
TableIdx
Max table size can’t exceed 100 elements, so it easily fits into u16
WasmiModule