Skip to main content

FunctionOps

Struct FunctionOps 

Source
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: u32

Function 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_operatorNone), 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.growmemory.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

Source§

fn clone(&self) -> FunctionOps

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FunctionOps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.