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

    Family

    pub(all) enum Family {
    Load(Width)
    Store(Width)
    Rmw(RmwOp, Width)
    Wait(NumTy)
    Notify
    } derive(Eq, Hash,
    Debug
    )

    A Wax method name denotes a FAMILY, not a single operation.

    The name carries the access width only -- atomic_load16, atomic_rmw_add8 -- and the i32/i64 value type is resolved from the operand and result types while type checking, exactly as it is for the plain scalar accesses (load16(p) as i64_u). atomic_wait32/atomic_wait64 and atomic_notify are the exceptions: they resolve from the name alone.

    Narrow

    pub(all) enum Narrow {
    N8
    N16
    N32
    } derive(Eq, Hash,
    Debug
    )

    A narrower access than the value type: i64.atomic.load16_u reads two bytes into an i64. None means the access is the full width of the value type.

    NumTy

    pub(all) enum NumTy {
    I32
    I64
    } derive(Eq, Hash,
    Debug
    )

    The value type an atomic operation works in.
    pub(all) enum Op {
    Notify
    Wait(NumTy)
    Load(NumTy, Narrow?)
    Store(NumTy, Narrow?)
    Rmw(RmwOp, NumTy, Narrow?)
    } derive(Eq, Hash,
    Debug
    )

    A concrete atomic operation, as the binary format sees it.

    RmwOp

    pub(all) enum RmwOp {
    Add
    Sub
    And
    Or
    Xor
    Xchg
    Cmpxchg
    } derive(Eq, Hash,
    Debug
    )

    The read-modify-write operations.

    Width

    pub(all) enum Width {
    W8
    W16
    W32
    W64
    } derive(Eq, Hash,
    Debug
    )

    The access width a Wax method name carries.

    Width::bytes

    fn Width::bytes(self : Width) -> Int

    How many bytes the width accesses. Its base-2 logarithm is the required -- and, for an atomic, exact -- alignment.

    access_bytes

    fn access_bytes(op : Op) -> Int

    How many bytes an operation accesses.

    all

    fn all() -> Array[Op]

    Every atomic operation, in binary order.

    families

    fn families() -> Array[Family]

    Every Wax method family, in completion order: loads, stores, RMWs, then wait and notify.

    family

    fn family(op : Op) -> Family

    The family a concrete operation belongs to.

    family_bytes

    fn family_bytes(f : Family) -> Int

    How many bytes a family accesses.

    method_name

    fn method_name(f : Family) -> String

    The Wax spelling on a memory receiver.

    name

    fn name(op : Op) -> String

    The WAT mnemonic.

    natural_align_log2

    fn natural_align_log2(op : Op) -> Int

    The alignment an atomic access requires, as a base-2 logarithm.

    Unlike a plain load or store, where the alignment is a hint and any smaller value is legal, an atomic's alignment must be exactly the natural one.

    of_method_name

    fn of_method_name(n : String) -> Family?

    of_opcode

    fn of_opcode(code : Int) -> Op?

    opcode

    fn opcode(op : Op) -> Int

    The 0xFE-prefix sub-opcode.

    signature

    fn signature(op : Op) -> (Array[NumTy], Array[NumTy])

    The stack signature AFTER the address operand, which always has the memory's own address type: what else is consumed, and what is produced.

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io