marianoguerra/wax/wasm/bin does not have a README file

    FieldType

    A struct field or array element type: a storage type plus mutability.

    GlobalType

    A global's type: a value type plus mutability.

    HeapType

    What a reference can point at.

    Limits

    The size bounds of a memory or table.

    Upstream split this into a bare {min, max} plus is_memory64, page_size_log2 and is_table64 fields hung off the memory and table types. The shared spine already carries all of them, and carries shared besides, which upstream cannot express at all -- so a shared memory was silently unrepresentable there.

    RefType

    A reference type: nullability plus what it points at.

    StorageType

    What a struct field or array element stores.

    ValType

    A value type, at the binary form's index instantiation.

    EncodeError

    pub suberror EncodeError {
    UnresolvedBlockType
    } derive(Eq,
    Debug
    )

    A module that cannot be encoded as it stands.

    Upstream had no such error. It emitted 0x00 -- unreachable -- for any instruction its match did not cover, and an empty block type for any block whose signature had not been resolved to a type index. Both produce a wasm file that loads, validates and runs, and silently does the wrong thing; against a differential harness that is the worst possible failure mode, because the diff says "these bytes differ" rather than "this is unhandled".

    Only one case is left. The opcode table is now total over Instruction -- the compiler says so, which is why there is no "unsupported instruction" variant here.
    impl Show for EncodeError

    BlockType

    What a block, loop or if consumes and produces.

    CatchHandler

    pub(all) enum CatchHandler {
    Catch(Int, Int)
    CatchRef(Int, Int)
    CatchAll(Int)
    CatchAllRef(Int)
    } derive(Eq,
    Debug
    )

    One arm of a try_table.

    CompositeType

    pub(all) enum CompositeType {
    Func(FuncType)
    Struct(StructType)
    Array(ArrayType)
    Cont(Int)
    } derive(Eq,
    Debug
    )

    What a defined type actually defines.

    CondGroup

    One #[if(..)] group: the condition as the TEXT format writes it, and where each branch stood in the source.

    Data

    pub(all) struct Data {
    mode : DataMode
    init : Bytes
    offset_spans : Array[Span]
    spelling : Array[DataPiece]
    } derive(Eq,
    Debug
    )

    DataMode

    pub(all) enum DataMode {
    Active(Int, Array[Instruction])
    Passive
    } derive(Eq,
    Debug
    )

    How a data segment reaches its memory.

    Upstream had no such type: it hung a bare memory_idx off the segment and signalled "passive" with a NEGATIVE index. That makes an unrepresentable state representable -- an active segment with an empty offset expression -- and it decided the encoding from offset.is_empty(), so such a segment was silently written as active-at-an-explicit-memory instead.

    DataPiece

    pub(all) enum DataPiece {
    PieceStr(Bytes)
    PieceRun(String, Array[String])
    } derive(Eq,
    Debug
    )

    One piece of a data segment, as the source wrote it.

    ElemMode

    pub(all) enum ElemMode {
    Active(Int, Array[Instruction])
    Passive
    Declarative
    } derive(Eq,
    Debug
    )

    How an element segment reaches its table.

    Element

    pub(all) struct Element {
    mode : ElemMode
    type_ :
    RefType
    [Int]
    init : Array[Array[Instruction]]
    init_spans : Array[Array[Span]]
    offset_spans : Array[Span]
    } derive(Eq,
    Debug
    )

    Export

    pub(all) struct Export {
    name : Bytes
    desc : ExportDesc
    } derive(Eq,
    Debug
    )

    ExportDesc

    pub(all) enum ExportDesc {
    Func(Int)
    Table(Int)
    Memory(Int)
    Global(Int)
    Tag(Int)
    } derive(Eq,
    Debug
    )

    What an export names, as an index into the matching space.

    FieldRef

    pub(all) enum FieldRef {
    FTypes(Array[Int])
    FFeature(Bytes)
    FImport(Int)
    FFunc(Int)
    FStart(Int)
    FExport(Int)
    FTable(Int)
    FMemory(Int)
    FGlobal(Int)
    FTag(Int)
    FElem(Int)
    FData(Int)
    } derive(Eq,
    Debug
    )

    One field of a module, named by where its item landed.

    FuncType

    A function type.

    FunctionCode

    pub(all) struct FunctionCode {
    locals : Array[
    ValType
    [Int]]
    body : Array[Instruction]
    spans : Array[Span]
    nested_spans : Array[Array[Span]]
    conditionals : Array[CondGroup]
    priority : Priority?
    } derive(Eq,
    Debug
    )

    Import

    pub(all) struct Import {
    mod_name : Bytes
    name : Bytes
    desc : ImportDesc
    group : ImportGroup?
    } derive(Eq,
    Debug
    )

    ImportDesc

    pub(all) enum ImportDesc {
    Func(Int, Bool)
    Table(TableType)
    Memory(MemoryType)
    Global(
    MutType
    [
    ValType
    [Int]])
    Tag(Int)
    } derive(Eq,
    Debug
    )

    What an import brings in.

    ImportGroup

    pub(all) enum ImportGroup {
    Heterogeneous(Array[(Bytes, ImportDesc)])
    Homogeneous(Array[Bytes])
    } derive(Eq,
    Debug
    )

    The two compact forms: per-item descriptors, or one shared descriptor and a list of names.

    InstrHints

    pub(all) struct InstrHints {
    branch : Bool?
    freq : Int?
    targets : Array[(Int, Int)]?
    } derive(Eq,
    Debug
    )

    The compilation hints attached to a single instruction.

    These do not change what the instruction does; they are advice, carried out of line in the metadata.code.* sections, keyed by the instruction's byte offset within its function body. Which is why they hang off the instruction here: the offset is only knowable while encoding, and only the encoder knows it.

    InstrHints::is_empty

    fn InstrHints::is_empty(self : InstrHints) -> Bool

    InstrHints::none

    fn InstrHints::none() -> InstrHints

    No hints.

    Instruction

    pub(all) enum Instruction {
    Unreachable
    Nop
    Block(BlockType, Array[Instruction])
    Loop(BlockType, Array[Instruction])
    If(BlockType, Array[Instruction], Array[Instruction])
    Br(Int)
    BrIf(Int)
    BrTable(Array[Int], Int)
    Return
    Call(Int)
    CallIndirect(Int, Int)
    CallRef(Int)
    ReturnCall(Int)
    ReturnCallIndirect(Int, Int)
    ReturnCallRef(Int)
    Throw(Int)
    ThrowRef
    TryTable(BlockType, Array[CatchHandler], Array[Instruction])
    LegacyTry(BlockType, Array[Instruction], Array[(Int, Array[Instruction])], Array[Instruction]?)
    Drop
    Select
    SelectTyped(Array[
    ValType
    [Int]])
    LocalGet(Int)
    LocalSet(Int)
    LocalTee(Int)
    GlobalGet(Int)
    GlobalSet(Int)
    TableGet(Int)
    TableSet(Int)
    TableSize(Int)
    TableGrow(Int)
    TableFill(Int)
    TableCopy(Int, Int)
    TableInit(Int, Int)
    I32Load(Int, Int, Int64)
    I64Load(Int, Int, Int64)
    F32Load(Int, Int, Int64)
    F64Load(Int, Int, Int64)
    I32Load8S(Int, Int, Int64)
    I32Load8U(Int, Int, Int64)
    I32Load16S(Int, Int, Int64)
    I32Load16U(Int, Int, Int64)
    I64Load8S(Int, Int, Int64)
    I64Load8U(Int, Int, Int64)
    I64Load16S(Int, Int, Int64)
    I64Load16U(Int, Int, Int64)
    I64Load32S(Int, Int, Int64)
    I64Load32U(Int, Int, Int64)
    I32Store(Int, Int, Int64)
    I64Store(Int, Int, Int64)
    F32Store(Int, Int, Int64)
    F64Store(Int, Int, Int64)
    I32Store8(Int, Int, Int64)
    I32Store16(Int, Int, Int64)
    I64Store8(Int, Int, Int64)
    I64Store16(Int, Int, Int64)
    I64Store32(Int, Int, Int64)
    MemorySize(Int)
    MemoryGrow(Int)
    MemoryInit(Int, Int)
    DataDrop(Int)
    MemoryCopy(Int, Int)
    MemoryFill(Int)
    ElemDrop(Int)
    Atomic(Int, Int, Int, Int64)
    AtomicFence
    ContNew(Int)
    ContBind(Int, Int)
    Suspend(Int)
    Resume(Int, Array[OnClause])
    ResumeThrow(Int, Int, Array[OnClause])
    ResumeThrowRef(Int, Array[OnClause])
    Switch(Int, Int)
    Hinted(InstrHints, Instruction)
    Spelled(String, Instruction)
    FromString(Bytes, Instruction)
    FromChar(Bytes, Instruction)
    RefNull(
    HeapType
    [Int])
    RefIsNull
    RefFunc(Int)
    RefAsNonNull
    RefEqInstr
    BrOnNull(Int)
    BrOnNonNull(Int)
    I32Const(Int)
    I64Const(Int64)
    F32Const(Float)
    F64Const(Double)
    I32Eqz
    I32Eq
    I32Ne
    I32LtS
    I32LtU
    I32GtS
    I32GtU
    I32LeS
    I32LeU
    I32GeS
    I32GeU
    I32Clz
    I32Ctz
    I32Popcnt
    I32Add
    I32Sub
    I32Mul
    I32DivS
    I32DivU
    I32RemS
    I32RemU
    I32And
    I32Or
    I32Xor
    I32Shl
    I32ShrS
    I32ShrU
    I32Rotl
    I32Rotr
    I32Extend8S
    I32Extend16S
    I64Eqz
    I64Eq
    I64Ne
    I64LtS
    I64LtU
    I64GtS
    I64GtU
    I64LeS
    I64LeU
    I64GeS
    I64GeU
    I64Clz
    I64Ctz
    I64Popcnt
    I64Add
    I64Sub
    I64Mul
    I64MulWideS
    I64MulWideU
    I64Add128
    I64Sub128
    I64DivS
    I64DivU
    I64RemS
    I64RemU
    I64And
    I64Or
    I64Xor
    I64Shl
    I64ShrS
    I64ShrU
    I64Rotl
    I64Rotr
    I64Extend8S
    I64Extend16S
    I64Extend32S
    F32Eq
    F32Ne
    F32Lt
    F32Gt
    F32Le
    F32Ge
    F32Abs
    F32Neg
    F32Ceil
    F32Floor
    F32Trunc
    F32Nearest
    F32Sqrt
    F32Add
    F32Sub
    F32Mul
    F32Div
    F32Min
    F32Max
    F32Copysign
    F64Eq
    F64Ne
    F64Lt
    F64Gt
    F64Le
    F64Ge
    F64Abs
    F64Neg
    F64Ceil
    F64Floor
    F64Trunc
    F64Nearest
    F64Sqrt
    F64Add
    F64Sub
    F64Mul
    F64Div
    F64Min
    F64Max
    F64Copysign
    I32WrapI64
    I32TruncF32S
    I32TruncF32U
    I32TruncF64S
    I32TruncF64U
    I64ExtendI32S
    I64ExtendI32U
    I64TruncF32S
    I64TruncF32U
    I64TruncF64S
    I64TruncF64U
    F32ConvertI32S
    F32ConvertI32U
    F32ConvertI64S
    F32ConvertI64U
    F32DemoteF64
    F64ConvertI32S
    F64ConvertI32U
    F64ConvertI64S
    F64ConvertI64U
    F64PromoteF32
    I32ReinterpretF32
    I64ReinterpretF64
    F32ReinterpretI32
    F64ReinterpretI64
    I32TruncSatF32S
    I32TruncSatF32U
    I32TruncSatF64S
    I32TruncSatF64U
    I64TruncSatF32S
    I64TruncSatF32U
    I64TruncSatF64S
    I64TruncSatF64U
    StructNewDesc(Int)
    StructNewDefaultDesc(Int)
    RefGetDesc(Int)
    RefCastDescEq(
    RefType
    [Int])
    BrOnCastDescEq(Int,
    RefType
    [Int],
    RefType
    [Int])
    BrOnCastDescEqFail(Int,
    RefType
    [Int],
    RefType
    [Int])
    StructNew(Int)
    StructNewDefault(Int)
    StructGet(Int, Int)
    StructGetS(Int, Int)
    StructGetU(Int, Int)
    StructSet(Int, Int)
    ArrayNew(Int)
    ArrayNewDefault(Int)
    ArrayNewFixed(Int, Int)
    ArrayNewData(Int, Int)
    ArrayNewElem(Int, Int)
    ArrayGet(Int)
    ArrayGetS(Int)
    ArrayGetU(Int)
    ArraySet(Int)
    ArrayLen
    ArrayFill(Int)
    ArrayCopy(Int, Int)
    ArrayInitData(Int, Int)
    ArrayInitElem(Int, Int)
    RefTest(
    RefType
    [Int])
    RefCast(
    RefType
    [Int])
    BrOnCast(Int,
    RefType
    [Int],
    RefType
    [Int])
    BrOnCastFail(Int,
    RefType
    [Int],
    RefType
    [Int])
    RefI31
    I31GetS
    I31GetU
    AnyConvertExtern
    ExternConvertAny
    V128Const(Bytes)
    V128Load(Int, Int, Int64)
    V128Load8x8S(Int, Int, Int64)
    V128Load8x8U(Int, Int, Int64)
    V128Load16x4S(Int, Int, Int64)
    V128Load16x4U(Int, Int, Int64)
    V128Load32x2S(Int, Int, Int64)
    V128Load32x2U(Int, Int, Int64)
    V128Load8Splat(Int, Int, Int64)
    V128Load16Splat(Int, Int, Int64)
    V128Load32Splat(Int, Int, Int64)
    V128Load64Splat(Int, Int, Int64)
    V128Load32Zero(Int, Int, Int64)
    V128Load64Zero(Int, Int, Int64)
    V128Store(Int, Int, Int64)
    V128Load8Lane(Int, Int, Int64, Int)
    V128Load16Lane(Int, Int, Int64, Int)
    V128Load32Lane(Int, Int, Int64, Int)
    V128Load64Lane(Int, Int, Int64, Int)
    V128Store8Lane(Int, Int, Int64, Int)
    V128Store16Lane(Int, Int, Int64, Int)
    V128Store32Lane(Int, Int, Int64, Int)
    V128Store64Lane(Int, Int, Int64, Int)
    I8x16Shuffle(FixedArray[Int])
    I8x16Swizzle
    I8x16Splat
    I16x8Splat
    I32x4Splat
    I64x2Splat
    F32x4Splat
    F64x2Splat
    I8x16ExtractLaneS(Int)
    I8x16ExtractLaneU(Int)
    I16x8ExtractLaneS(Int)
    I16x8ExtractLaneU(Int)
    I32x4ExtractLane(Int)
    I64x2ExtractLane(Int)
    F32x4ExtractLane(Int)
    F64x2ExtractLane(Int)
    I8x16ReplaceLane(Int)
    I16x8ReplaceLane(Int)
    I32x4ReplaceLane(Int)
    I64x2ReplaceLane(Int)
    F32x4ReplaceLane(Int)
    F64x2ReplaceLane(Int)
    I8x16Eq
    I8x16Ne
    I8x16LtS
    I8x16LtU
    I8x16GtS
    I8x16GtU
    I8x16LeS
    I8x16LeU
    I8x16GeS
    I8x16GeU
    I16x8Eq
    I16x8Ne
    I16x8LtS
    I16x8LtU
    I16x8GtS
    I16x8GtU
    I16x8LeS
    I16x8LeU
    I16x8GeS
    I16x8GeU
    I32x4Eq
    I32x4Ne
    I32x4LtS
    I32x4LtU
    I32x4GtS
    I32x4GtU
    I32x4LeS
    I32x4LeU
    I32x4GeS
    I32x4GeU
    I64x2Eq
    I64x2Ne
    I64x2LtS
    I64x2GtS
    I64x2LeS
    I64x2GeS
    F32x4Eq
    F32x4Ne
    F32x4Lt
    F32x4Gt
    F32x4Le
    F32x4Ge
    F64x2Eq
    F64x2Ne
    F64x2Lt
    F64x2Gt
    F64x2Le
    F64x2Ge
    V128Not
    V128And
    V128AndNot
    V128Or
    V128Xor
    V128Bitselect
    V128AnyTrue
    I8x16Abs
    I8x16Neg
    I8x16Popcnt
    I8x16AllTrue
    I8x16Bitmask
    I8x16NarrowI16x8S
    I8x16NarrowI16x8U
    I8x16Shl
    I8x16ShrS
    I8x16ShrU
    I8x16Add
    I8x16AddSatS
    I8x16AddSatU
    I8x16Sub
    I8x16SubSatS
    I8x16SubSatU
    I8x16MinS
    I8x16MinU
    I8x16MaxS
    I8x16MaxU
    I8x16AvgrU
    I16x8ExtAddPairwiseI8x16S
    I16x8ExtAddPairwiseI8x16U
    I16x8Abs
    I16x8Neg
    I16x8Q15MulrSatS
    I16x8AllTrue
    I16x8Bitmask
    I16x8NarrowI32x4S
    I16x8NarrowI32x4U
    I16x8ExtendLowI8x16S
    I16x8ExtendHighI8x16S
    I16x8ExtendLowI8x16U
    I16x8ExtendHighI8x16U
    I16x8Shl
    I16x8ShrS
    I16x8ShrU
    I16x8Add
    I16x8AddSatS
    I16x8AddSatU
    I16x8Sub
    I16x8SubSatS
    I16x8SubSatU
    I16x8Mul
    I16x8MinS
    I16x8MinU
    I16x8MaxS
    I16x8MaxU
    I16x8AvgrU
    I16x8ExtMulLowI8x16S
    I16x8ExtMulHighI8x16S
    I16x8ExtMulLowI8x16U
    I16x8ExtMulHighI8x16U
    I32x4ExtAddPairwiseI16x8S
    I32x4ExtAddPairwiseI16x8U
    I32x4Abs
    I32x4Neg
    I32x4AllTrue
    I32x4Bitmask
    I32x4ExtendLowI16x8S
    I32x4ExtendHighI16x8S
    I32x4ExtendLowI16x8U
    I32x4ExtendHighI16x8U
    I32x4Shl
    I32x4ShrS
    I32x4ShrU
    I32x4Add
    I32x4Sub
    I32x4Mul
    I32x4MinS
    I32x4MinU
    I32x4MaxS
    I32x4MaxU
    I32x4DotI16x8S
    I32x4ExtMulLowI16x8S
    I32x4ExtMulHighI16x8S
    I32x4ExtMulLowI16x8U
    I32x4ExtMulHighI16x8U
    I64x2Abs
    I64x2Neg
    I64x2AllTrue
    I64x2Bitmask
    I64x2ExtendLowI32x4S
    I64x2ExtendHighI32x4S
    I64x2ExtendLowI32x4U
    I64x2ExtendHighI32x4U
    I64x2Shl
    I64x2ShrS
    I64x2ShrU
    I64x2Add
    I64x2Sub
    I64x2Mul
    I64x2ExtMulLowI32x4S
    I64x2ExtMulHighI32x4S
    I64x2ExtMulLowI32x4U
    I64x2ExtMulHighI32x4U
    F32x4Ceil
    F32x4Floor
    F32x4Trunc
    F32x4Nearest
    F32x4Abs
    F32x4Neg
    F32x4Sqrt
    F32x4Add
    F32x4Sub
    F32x4Mul
    F32x4Div
    F32x4Min
    F32x4Max
    F32x4Pmin
    F32x4Pmax
    F64x2Ceil
    F64x2Floor
    F64x2Trunc
    F64x2Nearest
    F64x2Abs
    F64x2Neg
    F64x2Sqrt
    F64x2Add
    F64x2Sub
    F64x2Mul
    F64x2Div
    F64x2Min
    F64x2Max
    F64x2Pmin
    F64x2Pmax
    I32x4TruncSatF32x4S
    I32x4TruncSatF32x4U
    F32x4ConvertI32x4S
    F32x4ConvertI32x4U
    I32x4TruncSatF64x2SZero
    I32x4TruncSatF64x2UZero
    F64x2ConvertLowI32x4S
    F64x2ConvertLowI32x4U
    F32x4DemoteF64x2Zero
    F64x2PromoteLowF32x4
    I8x16RelaxedSwizzle
    I32x4RelaxedTruncF32x4S
    I32x4RelaxedTruncF32x4U
    I32x4RelaxedTruncF64x2SZero
    I32x4RelaxedTruncF64x2UZero
    F32x4RelaxedMadd
    F32x4RelaxedNmadd
    F64x2RelaxedMadd
    F64x2RelaxedNmadd
    I8x16RelaxedLaneselect
    I16x8RelaxedLaneselect
    I32x4RelaxedLaneselect
    I64x2RelaxedLaneselect
    F32x4RelaxedMin
    F32x4RelaxedMax
    F64x2RelaxedMin
    F64x2RelaxedMax
    I16x8RelaxedQ15mulrS
    I16x8RelaxedDotI8x16I7x16S
    I32x4RelaxedDotI8x16I7x16AddS
    } derive(Eq,
    Debug
    )

    MemoryType

    A memory's type.

    Module

    pub(all) struct Module {
    types : Array[SubType]
    rec_groups : Array[RecGroup]
    imports : Array[Import]
    funcs : Array[Int]
    tables : Array[Table]
    memories : Array[MemoryType]
    globals : Array[Global]
    exports : Array[Export]
    start : Int?
    elems : Array[Element]
    codes : Array[FunctionCode]
    datas : Array[Data]
    tags : Array[TagType]
    text : TextView
    names : Names
    target_features : Array[(Int, Bytes)]
    } derive(
    Debug
    )

    A whole module, in the form the encoder writes out.

    Module::empty

    fn Module::empty() -> Module

    A module with nothing in it.

    Names

    pub(all) struct Names {
    module_ : Bytes?
    functions : Map[Int, Bytes]
    locals : Map[Int, Map[Int, Bytes]]
    labels : Map[Int, Map[Int, Bytes]]
    types : Map[Int, Bytes]
    tables : Map[Int, Bytes]
    memories : Map[Int, Bytes]
    globals : Map[Int, Bytes]
    elem : Map[Int, Bytes]
    data : Map[Int, Bytes]
    fields : Map[Int, Map[Int, Bytes]]
    tags : Map[Int, Bytes]
    } derive(
    Debug
    )

    The name custom section: what everything in the module is called.

    Upstream had a single func_names : Map[Int, String] on the module, which the encoder never read -- so every name was dropped. There are twelve name spaces, not one, and wasm_output.ml emits all of them.

    Maps rather than arrays, mirroring the reference's IntMap: the format wants each vector in ascending index order, and making that the encoder's job rather than the caller's is one fewer way to differ by a byte.

    Names::empty

    fn Names::empty() -> Names

    No names at all, which is also what makes the section disappear.

    OnClause

    pub(all) enum OnClause {
    OnLabel(Int, Int)
    OnSwitch(Int)
    } derive(Eq,
    Debug
    )

    One arm of a resume table: what happens when the continuation suspends with a given tag.

    ParamOwner

    pub(all) enum ParamOwner {
    OwnerFunc(Int)
    OwnerTag(Int)
    OwnerType(Int)
    } derive(Eq, Hash,
    Debug
    )

    Whose parameters a name list belongs to. Imported functions and tags sit in different index spaces, so the index alone does not say.

    Priority

    pub(all) struct Priority {
    compilation : Int
    optimization : Int?
    } derive(Eq,
    Debug
    )

    #[priority]: advice about the function as a whole rather than about one instruction, which is why it lives on the code entry and is recorded at offset 0 -- the position that means "the function itself".

    RecGroup

    pub(all) struct RecGroup {
    start : Int
    len : Int
    explicit : Bool
    } derive(Eq,
    Debug
    )

    A run of defined types emitted as one rec (...).

    Upstream carried this as one group id per type and then never read it: the type section wrote every type flat, so a module whose types referred to each other came out as a set of unrelated definitions.

    explicit is not redundant with len == 1. A singleton rec is a different type from the same definition written bare -- recursive type identity is by group -- so the encoder cannot infer the prefix from the length, and what the source said has to be recorded.

    Span

    pub(all) struct Span {
    start : Int
    head : Int
    end : Int
    loc :
    Location

    } derive(Eq,
    Debug
    )

    A function body: its locals, then its instructions. One node's run in a body: where it starts, where its OWN emission begins (everything before that is its operands), where it ends, and where the source wrote it.

    SubType

    pub(all) struct SubType {
    final_ : Bool
    supertypes : Array[Int]
    descriptor : Int?
    describes : Int?
    composite : CompositeType
    } derive(Eq,
    Debug
    )

    A defined type, with its supertypes and whether it may be subtyped further.

    descriptor and describes are the custom-descriptors proposal's two clauses, and they come in pairs: descriptor names the type of this struct's runtime descriptor, describes names the struct this one is the descriptor OF. A type may carry either, both, or neither.

    SubType::func

    A final function type, from its parameters and results.

    SubType::simple

    fn SubType::simple(composite : CompositeType) -> SubType

    A subtype that is final and inherits from nothing -- the common case.

    Table

    pub(all) struct Table {
    type_ : TableType
    init : Array[Instruction]?
    init_spans : Array[Span]
    } derive(Eq,
    Debug
    )

    A defined table, with the initialiser every element starts at.

    TableType

    A table's type. The element type is a REFERENCE type, not a value type: nothing else can go in a table.

    TagType

    pub(all) struct TagType {
    type_idx : Int
    } derive(Eq,
    Debug
    )

    An exception tag: an index into the type section, naming a function type whose parameters are the exception's payload and whose results are empty.

    TextView

    pub(all) struct TextView {
    field_order : Array[FieldRef]
    field_locs : Array[
    Location
    ]
    decl_param_names : Map[ParamOwner, Map[Int, Bytes]]
    decl_typeuse : Map[ParamOwner, TypeUse]
    standalone_exports : Map[Int, Bool]
    named_types : Map[Int, Bool]
    conditionals : Array[CondGroup]
    } derive(
    Debug
    )

    The source facts the text form needs and the binary has no room for.

    Recorded as the lowering goes rather than recovered afterwards: there is nothing in the sections to recover them from, and a second derivation could disagree with the first with nothing to say which output is wrong.

    TextView::empty

    fn TextView::empty() -> TextView

    An empty view, for a module nothing recorded one for.

    TypeUse

    pub(all) struct TypeUse {
    named : Bool
    spelled : Bool
    } derive(Eq,
    Debug
    )

    Which of the two clauses a declaration wrote for its type. Both are optional and they are independent: fn f: ft(i32) wrote both.

    encode

    fn encode(mod : Module) -> Bytes raise EncodeError

    Encode a module.

    Section order is the reference's, which is the format's and not the order of the section ids: tags (13) go between memories (5) and globals (6), the data count (12) before the code (10), and the custom sections last -- except the metadata.code.* ones, which the branch-hinting proposal requires between the function and code sections, and which are not emitted yet.