Sign in

    #machv/code_object

    This package is the final reusable boundary between target emission and an embedding runtime. It stores copied machine-code bytes together with typed relocations, trap sites, safepoints, root locations, and target-neutral unwind directives.

    build validates architecture-specific alignment, bounds, relocation kinds, known instruction encodings, and unwind state transitions before an object can escape. An unwind directive's offset is the code offset immediately after the prologue instruction that establishes the described state. Saved-register locations are relative to the canonical frame address.

    This package deliberately does not encode platform unwind formats, register unwind data with the host, resolve runtime symbols, allocate executable memory, or apply relocations. Those operations belong to the embedding product.

    CodeObjectVerifyError

    pub suberror CodeObjectVerifyError {
    EmptyCode
    MisalignedCodeSize(size~ : Int)
    InvalidRelocation(index~ : Int, message~ : String)
    DuplicateRelocationOffset(offset~ : Int)
    InvalidSourceSite(index~ : Int, offset~ : Int)
    InvalidTrapSite(index~ : Int, offset~ : Int)
    InvalidSafepointSite(index~ : Int, offset~ : Int)
    InvalidRootLocation(safepoint~ : Int, root~ : Int)
    InvalidStackMap(safepoint~ : Int)
    InvalidUnwindDirective(index~ : Int, message~ : String)
    } derive(Eq,
    Debug
    )

    CodeObjectVerifyError::equal

    CodeObjectVerifyError::not_equal

    CodeObjectVerifyError::output

    fn CodeObjectVerifyError::output(self : CodeObjectVerifyError, logger : &Logger) -> Unit

    CodeObjectVerifyError::to_string

    fn CodeObjectVerifyError::to_string(self : CodeObjectVerifyError) -> String

    Architecture

    pub(all) enum Architecture {
    AArch64
    X64
    } derive(Eq,
    Debug
    )

    Architecture::equal

    Architecture::not_equal

    fn Architecture::not_equal(x : Architecture, y : Architecture) -> Bool

    RegisterBank

    pub(all) enum RegisterBank {
    Int
    FpVector
    } derive(Eq,
    Debug
    )

    RegisterBank::equal

    RegisterBank::not_equal

    fn RegisterBank::not_equal(x : RegisterBank, y : RegisterBank) -> Bool

    Relocation

    pub struct Relocation {
    offset : Int
    kind : RelocationKind
    target : RelocationTarget
    addend : Int64
    } derive(Eq,
    Debug
    )

    Relocation::equal

    fn Relocation::equal(Relocation, Relocation) -> Bool

    Relocation::new

    fn Relocation::new(offset : Int, kind : RelocationKind, target : RelocationTarget, addend? : Int64) -> Relocation

    Relocation::not_equal

    fn Relocation::not_equal(x : Relocation, y : Relocation) -> Bool

    RelocationKind

    pub(all) enum RelocationKind {
    AArch64Call26
    AArch64Jump26
    AArch64Page21
    AArch64PageOffset12
    X64PcRelative32
    Absolute64
    } derive(Eq,
    Debug
    )

    RelocationKind::equal

    RelocationKind::not_equal

    fn RelocationKind::not_equal(x : RelocationKind, y : RelocationKind) -> Bool

    RelocationTarget

    RelocationTarget::equal

    RelocationTarget::not_equal

    fn RelocationTarget::not_equal(x : RelocationTarget, y : RelocationTarget) -> Bool

    RootLocation

    pub(all) enum RootLocation {
    Register(RegisterBank, Int)
    Stack(offset~ : Int, ty~ :
    ValueType
    )
    } derive(Eq,
    Debug
    )

    RootLocation::equal

    RootLocation::not_equal

    fn RootLocation::not_equal(x : RootLocation, y : RootLocation) -> Bool

    SourceSite

    pub struct SourceSite {
    offset : Int
    source :
    SourceLocation

    } derive(Eq,
    Debug
    )

    SourceSite::equal

    fn SourceSite::equal(SourceSite, SourceSite) -> Bool

    SourceSite::new

    SourceSite::not_equal

    fn SourceSite::not_equal(x : SourceSite, y : SourceSite) -> Bool

    TrapSite

    TrapSite::equal

    fn TrapSite::equal(TrapSite, TrapSite) -> Bool

    TrapSite::not_equal

    fn TrapSite::not_equal(x : TrapSite, y : TrapSite) -> Bool

    TrapSite::to_repr

    UnlinkedCodeObject

    pub struct UnlinkedCodeObject {
    // private fields
    } derive(
    Debug
    )

    UnlinkedCodeObject::architecture

    UnlinkedCodeObject::code

    fn UnlinkedCodeObject::code(self : UnlinkedCodeObject) -> Array[Byte]

    UnlinkedCodeObject::relocations

    UnlinkedCodeObject::safepoints

    UnlinkedCodeObject::sources

    UnlinkedCodeObject::traps

    UnlinkedCodeObject::unwind

    UnlinkedCodeObject::verify

    UnwindDirective

    pub struct UnwindDirective {
    offset : Int
    operation : UnwindOperation
    } derive(Eq,
    Debug
    )

    UnwindDirective::equal

    UnwindDirective::new

    fn UnwindDirective::new(offset : Int, operation : UnwindOperation) -> UnwindDirective

    UnwindDirective::not_equal

    fn UnwindDirective::not_equal(x : UnwindDirective, y : UnwindDirective) -> Bool

    UnwindOperation

    pub(all) enum UnwindOperation {
    StackAlloc(size~ : Int)
    SetFramePointer(RegisterBank, Int, cfa_offset~ : Int)
    SaveRegister(RegisterBank, Int, cfa_offset~ : Int)
    } derive(Eq,
    Debug
    )

    UnwindOperation::equal

    UnwindOperation::not_equal

    fn UnwindOperation::not_equal(x : UnwindOperation, y : UnwindOperation) -> Bool

    build

    fn build(architecture : Architecture, code : Array[Byte], relocations? : Array[Relocation], sources? : Array[SourceSite], traps? : Array[TrapSite], safepoints? : Array[SafepointSite], unwind? : Array[UnwindDirective]) -> UnlinkedCodeObject raise CodeObjectVerifyError

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io