pub struct DecodedModule {Show 18 fields
pub functions: Vec<FunctionOps>,
pub memories: Vec<WasmMemory>,
pub data_segments: Vec<(u32, Vec<u8>)>,
pub imports: Vec<ImportEntry>,
pub num_imported_funcs: u32,
pub func_arg_counts: Vec<u32>,
pub type_arg_counts: Vec<u32>,
pub func_ret_i64: Vec<bool>,
pub type_ret_i64: Vec<bool>,
pub func_params_i64: Vec<Vec<bool>>,
pub globals: Vec<WasmGlobal>,
pub elem_func_indices: Vec<u32>,
pub table_size: Option<u32>,
pub table_sizes: Vec<Option<u32>>,
pub elem_segments: Vec<ElemSegmentInfo>,
pub func_type_indices: Vec<u32>,
pub type_signatures: Vec<String>,
pub wsc_facts: Vec<WscFact>,
}Expand description
Decoded WASM module with functions and memory
Fields§
§functions: Vec<FunctionOps>Decoded functions
memories: Vec<WasmMemory>Linear memories
data_segments: Vec<(u32, Vec<u8>)>Data segments (offset, data) for memory initialization
imports: Vec<ImportEntry>Import entries (module name, field name, kind)
num_imported_funcs: u32Number of imported functions (for distinguishing import calls from local calls)
func_arg_counts: Vec<u32>AAPCS integer-argument count per function, indexed by the full WASM
function index (imported functions first, then locally-defined ones).
Used by the backend to marshal call arguments into R0–R3 (issue #195).
Counts every parameter as one slot (i64/f64 over-counted — see the
backend’s set_func_arg_counts scope note).
type_arg_counts: Vec<u32>AAPCS integer-argument count per function type, indexed by type index.
Used by call_indirect, whose callee arg count comes from the static
type index (issue #195).
func_ret_i64: Vec<bool>#311: whether each function (full index, imports first) returns i64 — the call lowering must tag the result as a register PAIR (r0:r1) or the hi half is invisible to liveness and the next constant clobbers it.
type_ret_i64: Vec<bool>#311: whether each function type returns i64 (for call_indirect).
func_params_i64: Vec<Vec<bool>>#359: declared parameter widths per function (full index, imports
first): func_params_i64[f][k] is true when param k is i64/f64. The
AAPCS stack-argument path needs the declared widths — op-stream inference
can’t see an unused i64 param that still shifts the incoming-stack layout.
globals: Vec<WasmGlobal>Defined globals with their initializers (#237). Empty if the module has
no global section. Used by the native-pointer ABI to make a global whose
initializer is a linear-memory address (e.g. $__stack_pointer)
self-contained rather than table-relative.
elem_func_indices: Vec<u32>Function indices that populate any table via an element segment (#275).
These are the possible call_indirect targets — a function reached only
through the table is invisible to direct-call reachability, so the
whole-graph closure must treat every table entry as reachable once any
reachable function performs a call_indirect. Empty for modules with no
element section (every leaf/direct-call module), keeping output identical.
table_size: Option<u32>#642: compile-time size (in entries) of table 0 — table_sizes[0],
kept as a convenience accessor. See Self::table_sizes.
table_sizes: Vec<Option<u32>>#650: compile-time size (in entries) per table, indexed by table index
(imported tables first, then the table section, in declaration order).
A DEFINED table’s size is exact: table.grow/table.set are
unsupported ops (their functions loud-skip at decode), so nothing
synth compiles can resize or retype a table. An imported table only
yields a sound bound when its limits pin the size (max == initial);
otherwise its entry is None and the call_indirect lowering
declines (for that table AND for any later table, whose base offset
within the contiguous R11 region is then unknown).
elem_segments: Vec<ElemSegmentInfo>#642: per element segment, everything the closed-world call_indirect
type check needs. offset is the const i32 placement of an ACTIVE
segment into table table_index (None = passive/declared/non-const
offset — statically unverifiable placement); funcs are the segment’s
function indices in slot order (None = an entry was not a plain
ref.func, e.g. ref.null — statically unverifiable contents).
func_type_indices: Vec<u32>#642: type index per function, indexed by the FULL function index (imports first, then locally-defined ones).
type_signatures: Vec<String>#642: canonical structural signature per type index (params/results
rendered as a string) — used for the closed-world call_indirect type
check, which must compare SIGNATURES, not raw type indices (a module
may carry structurally-identical duplicate types).
wsc_facts: Vec<WscFact>VCR-PERF-002 Phase 1 (#494): proven invariants from loom’s wsc.facts
custom section, keyed by (function index, value id) — see
docs/design/wsc-facts-encoding.md (schema v1) and
crate::wsc_facts::parse_wsc_facts. FAIL-SAFE by contract (loom#231
Q4): a missing/unparseable section or unknown version yields the empty
vec, unknown fact kinds are skipped — never a decode error. Phase 1 is
ingestion only: NO codegen path consumes these yet, so emitted bytes
are unchanged whether or not a module carries the section.
Implementations§
Source§impl DecodedModule
impl DecodedModule
Sourcepub fn call_indirect_guards(&self) -> CallIndirectGuards
pub fn call_indirect_guards(&self) -> CallIndirectGuards
#642/#650: compute the call_indirect guard inputs — per table, the
compile-time size for the runtime bounds check, the base byte offset
within the contiguous R11 region, and the per-expected-type
closed-world verdict that discharges the type check at compile time.
See CallIndirectGuards for the layout contract and soundness
argument.
Trait Implementations§
Source§impl Clone for DecodedModule
impl Clone for DecodedModule
Source§fn clone(&self) -> DecodedModule
fn clone(&self) -> DecodedModule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more