"pure" universally means side-effect-free (GCC __attribute__((pure)), FP purity, D's pure) — the opposite of a register-clobbering context switch. The concept is "naked": no compiler-generated prologue/epilogue, body is raw asm that emits its own ret. That is the established term everywhere (LLVM's naked function attribute — which we literally emit — plus Zig callconv(.naked), Rust #[naked], GCC/Clang __attribute__ ((naked))). Rename the keyword + everything keyed off it so concept, surface, field, and the emitted LLVM attribute all agree. - ast.zig: ABI enum variant pure -> naked (+ doc). - parser: accept abi(.naked); error text updated. - IR Function.is_pure -> is_naked; type_resolver/decl/generic/pack/ emit_llvm references updated; diagnostics say abi(.naked). - examples 1800-1803 renamed *-pure-* -> *-naked-* (source + expected/ snapshots; .ir/.exit/.stdout/.stderr are byte-identical — the emitted IR is unchanged, only the keyword spelling differs). - docs (PLAN-FIBERS, CHECKPOINT-FIBERS, PLAN-POST-METATYPE, the design roadmap, the compiler-API checkpoint/design) updated; the naming rationale now records why .naked over .pure. No semantic change — pure cosmetics. Suite green (725/0).
20 lines
779 B
Plaintext
20 lines
779 B
Plaintext
// Stream B1 (fibers) — x86_64 sibling of 1800: `abi(.pure)` emits a naked
|
|
// function whose body is raw x86_64 asm (returns 42 in eax, then its own `ret`).
|
|
//
|
|
// Lowered via LLVM's `naked` attribute (no prologue/epilogue/frame). x86_64-
|
|
// pinned via `.build`: ir-only on a non-x86 host — the `.ir` snapshot locks the
|
|
// `naked` attribute + the bare asm body (`movl $42, %eax` / `ret`) and the
|
|
// frame-pointer-free attribute set — and runs end-to-end (exit 42) on
|
|
// x86_64-linux. The IR text (the `naked` attribute, the `call void asm`) is
|
|
// target-independent; only the asm string differs from the aarch64 1800.
|
|
answer :: () -> i64 abi(.pure) {
|
|
asm volatile {
|
|
#string A
|
|
movl $42, %eax
|
|
ret
|
|
A
|
|
};
|
|
}
|
|
|
|
main :: () -> i64 { return answer(); }
|