fibers: rename ABI variant .pure -> .naked
"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).
This commit is contained in:
@@ -408,9 +408,9 @@ pub const LLVMEmitter = struct {
|
||||
// its only references are in comptime code, so DCE drops the leftover
|
||||
// declaration. See current/PLAN-COMPILER-VM.md (S3).
|
||||
if (func.is_compiler_domain) continue;
|
||||
// `abi(.pure)` functions emit normally — the `naked` attribute (set
|
||||
// `abi(.naked)` functions emit normally — the `naked` attribute (set
|
||||
// in the declaration pass) makes the backend emit the body (inline
|
||||
// asm + its own `ret`) with no prologue/epilogue. See Function.is_pure.
|
||||
// asm + its own `ret`) with no prologue/epilogue. See Function.is_naked.
|
||||
self.emitFunction(&func, @intCast(i));
|
||||
}
|
||||
|
||||
@@ -1327,13 +1327,13 @@ pub const LLVMEmitter = struct {
|
||||
// Add frame-pointer and nounwind attributes for correct ARM64 codegen
|
||||
{
|
||||
const func_idx_attr: c.LLVMAttributeIndex = @bitCast(@as(i32, -1));
|
||||
if (func.is_pure) {
|
||||
// `abi(.pure)`: emit via LLVM's `naked` attribute — the backend
|
||||
if (func.is_naked) {
|
||||
// `abi(.naked)`: emit via LLVM's `naked` attribute — the backend
|
||||
// emits the body verbatim (our inline asm + its own `ret`) with
|
||||
// NO prologue/epilogue/frame. Do NOT request `frame-pointer`
|
||||
// (incompatible with a frameless function). `noinline` keeps the
|
||||
// asm body out of a framed caller; `nounwind` — naked asm never
|
||||
// unwinds. See Function.is_pure / current/PLAN-FIBERS.md.
|
||||
// unwinds. See Function.is_naked / current/PLAN-FIBERS.md.
|
||||
const naked_id = c.LLVMGetEnumAttributeKindForName("naked", 5);
|
||||
c.LLVMAddAttributeAtIndex(llvm_func, func_idx_attr, c.LLVMCreateEnumAttribute(self.context, naked_id, 0));
|
||||
const noinline_id = c.LLVMGetEnumAttributeKindForName("noinline", 8);
|
||||
|
||||
Reference in New Issue
Block a user