Wasm Operator Definitions
The /lib/wasm/runner/op-def library implements WebAssembly instruction definitions as functions that transform the $local-state of the UrWasm interpreter. This library serves as the operational semantics for WebAssembly instructions, defining how each instruction modifies the interpreter's execution state.
+op-def
++ op-def
=, engine-sur
|%
:: ...
--Core instruction definitions namespace. Implements WebAssembly instructions as gates that transform $local-state to $local-state. Uses round-to-nearest ties-to-even semantics for floating-point operations except where otherwise specified.
+mayb
++ mayb
|* gat=$-(* *)
|: a=+6.gat
^- (unit _$:gat)
`(gat a)Wrap output of a gate in a unit.
+sure
Unwrap output of gate, crashing if unit is empty.
+torn
Map a list with a gate, collapsing units. Returns ~ if any application produces ~.
+lane-size
Extract the bit size from a $lane-type.
+fuse
Zip two lists together, stopping when either list is exhausted.
+chap
Check branching signal and conditionally apply instruction. If there's a branch signal in the local state, return unchanged; otherwise apply the instruction.
+page-size
WebAssembly memory page size (65,536 bytes).
+place
Place list .b into list .a starting at offset .off, overwriting contents of .a.
+lim-min
Extract minimum value from $limits.
+lim-max
Extract maximum value from $limits. Returns ~ if no maximum is specified.
+lte-lim
Test if value .a is within the specified $limits.
+change
Convert stack values to a list of $coin-wasm for type checking.
+to-si
Convert unsigned integer to signed integer with specified bit width.
+en-si
Convert signed integer to unsigned integer with specified bit width.
+sat
Saturating conversion from signed integer with specified size and mode (%u for unsigned, %s for signed).
+coin-to-val
Convert $coin-wasm to interpreter $val.
+val-to-coin
Convert interpreter $val to $coin-wasm using expected type.
+snug
Unitized list indexing. Returns element at index .a or ~ if index is out of bounds.
+shot
Replace existing item in a list at index .b with value .c.
+buy
Resolve import. If no values are available in the .shop, creates a request and blocks execution. Otherwise, validates types and pushes values onto the stack.
+grab
Import resolution utilities. Each arm returns either a local instance of an object or its external reference.
+func: Resolve function by index.+table: Resolve table by index. Returns either a local table with its contents or an external reference.+memo: Resolve memory by index. Returns either local memory instance or an external reference.+glob: Resolve global variable by index. Returns either local global value or an external reference.
+mem-store
Store data in linear memory at the specified index. Returns updated memory or ~ if out of bounds.
+mem-load
Load data from linear memory at the specified index. Returns data or ~ if out of bounds.
+kind
Instruction category types for organizing instruction implementations.
+fetch-gate
Convert $instruction to a gate that transforms local state. Handles different instruction categories appropriately.
+fetch
Core with instruction implementation definitions. Each arm contains implementations for specific categories of WebAssembly instructions.
+dbug:fetch
Debug instruction implementations. Currently supports %print-tee which prints the top stack value with a label.
+select:fetch
Select instruction. Pops condition and two values, pushes the chosen value based on the condition.
+null:fetch
Control instructions with no operands:
unreachable: Unconditionally trap.nop: No operation.return: Return from function.drop: Drop top value from stack.
+ref:fetch
Reference instruction implementations:
ref-null: Push null reference of specified type.ref-is-null: Test if reference is null.ref-func: Push function reference.
+simd
SIMD vector instruction implementations for 128-bit vectors. Handles vector load/store operations, lane manipulation, and parallel arithmetic operations on packed data.
+rope
Helper for dissembling atoms with leading zeros. Similar to +rip but takes a specific number of blocks to extract.
+fetch-vec
Vector instruction dispatcher that routes $instr-vec to specific vector operation implementations.
+load
Load vector from memory with optional operations like splat (broadcast), zero-extend, or sign-extend.
+load-lane
Load single value from memory into a specific lane of an existing vector.
+store
Store 128-bit vector to memory at the specified address.
+store-lane
Store single lane from vector to memory at the specified address.
+const
Push vector constant value onto the stack.
+shuffle
Shuffle lanes between two vectors according to the lane indices specified in the instruction.
+extract
Extract value from a specific lane of a vector, with optional sign extension.
+replace
Replace a specific lane in a vector with a new value.
+plain
Plain vector operations dispatcher that handles different categories of SIMD instructions.
+kind:plain
SIMD instruction type categories for organizing vector operations.
+vec-unar:plain
Unary vector operations including splat, bitwise not, truth testing, type conversions, and lane extensions.
+vec-bina:plain
Binary vector operations including logical operations, lane narrowing, shifts, and multiplication.
+get-op-unar:plain
Resolve unary operation implementations for lane-wise vector operations.
+get-op-bina:plain
Resolve binary operation implementations for lane-wise vector operations.
+get-size:plain
Extract size information from lane-wise SIMD instruction types.
Last updated