pub struct FunctionOps {
pub index: u32,
pub export_name: Option<String>,
pub debug_name: Option<String>,
pub ops: Vec<WasmOp>,
pub op_offsets: Vec<u32>,
pub unsupported: Option<String>,
pub block_arity: Vec<(u8, u8)>,
}Expand description
Decoded function with its WasmOp sequence
Fields§
§index: u32Function index in the module (includes imported functions)
export_name: Option<String>Export name if this function is exported
debug_name: Option<String>#394 Tier-1.x: the function’s developer-facing name from the wasm name
custom section (function-names subsection), e.g.
core::panicking::panic_fmt::h6651313c3e2c6c2f — present for INTERNAL
(non-exported) functions too, unlike export_name. DEBUG METADATA only:
consumed by the --debug-line DW_TAG_subprogram emit (name priority:
name-section > export name > func_N); no codegen or symbol-table path
reads it, so emitted .text/.symtab are unchanged (frozen-safe).
None when the module has no name section or no entry for this index.
ops: Vec<WasmOp>The WASM operations in this function body
op_offsets: Vec<u32>VCR-DBG-001 step 1 (#394): module-relative wasm byte offset of each op in
ops (same index → same op). This is the address space DWARF-for-wasm
.debug_line keys on, so it is the bridge from synth’s op-index
source_line to the input wasm’s DWARF (wasm-offset → source). PURELY
ADDITIVE metadata: no codegen path reads it, so emitted .text is
unchanged and the frozen fixtures stay bit-identical. Empty until consumed
by the DWARF emitter (Tier 1).
unsupported: Option<String>Some(reason) when the body contained a value-affecting operator the
decoder cannot lower (e.g. scalar f32/f64 — #369, bulk-memory
memory.copy/fill). Such an op would otherwise be silently dropped
(convert_operator → None), leaving the operand stack wrong and the
function a silent miscompile. The compile path LOUD-SKIPS a flagged
function (diagnostic + symbol absent → link error names it) instead —
the #180/#185 “unsupported op must Err, never silently continue”
contract. None once every op decoded or was intentionally ignorable
(Nop/Unreachable).
block_arity: Vec<(u8, u8)>#509: blocktype arity side-table — (param_count, result_count) of the
k-th Block/Loop/If op in ops, in order of appearance.
ORDINAL-keyed, not op-index-keyed, on purpose: the backend may rewrite
the op stream before selection (e.g. the #539 i32.const 0; memory.grow
→ memory.size fold), which shifts op indices but never adds/removes
control ops, so the ordinal stays aligned. BlockType::Empty → (0,0),
ValType → (0,1), FuncType(i) → counts from the type section
(saturated to u8; an unresolvable type index records (u8::MAX, u8::MAX) so the selector declines loudly instead of miscompiling).
This is what lets the direct selector land a value carried by
br/br_if/br_table in the target block’s designated result
register instead of dropping it — WasmOp::Block/Loop/If stay bare
unit variants (zero ripple through the backends’ match sites), and an
empty table (hand-built op streams in unit tests) keeps the legacy
void-block lowering.
Trait Implementations§
Source§impl Clone for FunctionOps
impl Clone for FunctionOps
Source§fn clone(&self) -> FunctionOps
fn clone(&self) -> FunctionOps
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more