Skip to main content

Module emitter

Module emitter 

Source
Expand description

AArch64 text emitter (design §6): buffers, labels, span stack, and the encoding-limit helpers (load_imm64, frame/sp/global addressing) that lower.rs must never bypass.

Two dialects (design §9): Linux GNU as/ELF (bare symbols, .L locals, :lo12: relocations, .rodata/.bss) and macOS Mach-O via clang (_-prefixed C symbols, L locals, @PAGE/@PAGEOFF, __TEXT,__const/.zerofill). Instructions are identical on both.

Structs§

Assembly
Finished assembly module plus a per-line source span map for snapshots and the playground (design §6.2, §12).
Emitter
FunctionFrame
Everything end_function needs to splice prologue and epilogue around a finished body (design §6.1).

Enums§

AsmDialect
Assembler/object-format dialect (design §9). Everything the two supported platforms disagree on — C symbol prefixes, private-label spelling, adrp relocation syntax, and data-section directives — routes through here; the instruction stream itself is identical.

Constants§

CLOSURE_SLOT_OFFSET
Byte offset below x29 of the hidden closure slot (design §6).

Functions§

call_area_size
Call-site argument area size: 8-byte packed callee + args, 16-aligned (design §7.1).
scratch_area_size
8-byte packed scratch area (array/hash/free-variable lists), 16-aligned.
slot_offset
Byte offset below x29 of symbol slot index (design §6: [x29, #-16*(i+2)]).