Skip to main content

Module wasm_decoder

Module wasm_decoder 

Source
Expand description

WASM Binary Decoder - Converts wasmparser operators to WasmOp sequences

This module bridges the gap between parsed WASM binaries and any backend. It extracts function bodies and converts wasmparser operators to our internal WasmOp format.

Structs§

CallIndirectGuards
#642/#650: everything the call_indirect lowering needs to emit its guards — computed once per module by DecodedModule::call_indirect_guards and threaded to the instruction selector via CompileConfig.
DecodedModule
Decoded WASM module with functions and memory
ElemSegmentInfo
#642: one element segment’s statically-decoded shape — see DecodedModule::elem_segments.
FunctionOps
Decoded function with its WasmOp sequence
ImportEntry
A WASM import entry with full metadata
TableGuards
#642/#650: one table’s call_indirect guard inputs — see CallIndirectGuards for the layout contract and soundness argument.
WasmGlobal
A WASM global’s declaration — its initial value and mutability (#237). Needed so the native-pointer ABI can recognize a global whose initializer is a linear-memory address (e.g. $__stack_pointer = 65536) and make it __synth_wasm_data-relative, rather than reading it from an R9 globals table the self-contained drop-in object can’t rely on.
WasmMemory
WASM linear memory specification

Enums§

GlobalInit
A captured constant global initializer (#649). Only INTEGER t.const init exprs are captured: f32.const/f64.const inits deliberately decode to None — float-typed global ACCESS is the GI-FPU-001 (#369) loud-skip lane, and fabricating a bit-pattern here must not quietly unskip it. Non-const init exprs (e.g. global.get of an import) are not statically known and also decode to None.
ImportKind
Kind of a WASM import

Functions§

decode_wasm_functions
Decode a WASM binary and extract all function bodies as WasmOp sequences
decode_wasm_module
Decode a WASM binary and extract functions, memory, and data segments