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:
agra
2026-06-20 17:01:09 +03:00
parent b631590574
commit a7fe165684
40 changed files with 175 additions and 171 deletions

View File

@@ -1931,7 +1931,7 @@ pub const Parser = struct {
}
// Optional ABI / calling-convention annotation: `abi(.c)` / `abi(.zig)` /
// `abi(.pure)`. Sits in the postfix slot BEFORE the `extern`/`export`
// `abi(.naked)`. Sits in the postfix slot BEFORE the `extern`/`export`
// linkage keyword (it is part of the function declaration). `abi(.zig)`
// marks a binding to the comptime `compiler` library.
const abi = try self.parseOptionalAbi();
@@ -3684,7 +3684,7 @@ pub const Parser = struct {
return_type = try self.parseTypeExpr();
}
// Optional ABI annotation: abi(.c) / abi(.zig) / abi(.pure)
// Optional ABI annotation: abi(.c) / abi(.zig) / abi(.naked)
const abi = try self.parseOptionalAbi();
// A closure is its own function boundary: clear the cleanup-body flags
@@ -3793,7 +3793,7 @@ pub const Parser = struct {
}
/// Optional ABI / calling-convention annotation `abi(.c)` / `abi(.zig)` /
/// `abi(.pure)` in the postfix slot before `extern`/`export`. `.default` when
/// `abi(.naked)` in the postfix slot before `extern`/`export`. `.default` when
/// absent. Subsumes the old `callconv(...)` spelling.
fn parseOptionalAbi(self: *Parser) anyerror!ast.ABI {
if (self.current.tag != .kw_abi) return .default;
@@ -3801,16 +3801,16 @@ pub const Parser = struct {
try self.expect(.l_paren);
try self.expect(.dot);
if (self.current.tag != .identifier)
return self.fail("expected ABI name ('.c', '.compiler', or '.pure') after '.'");
return self.fail("expected ABI name ('.c', '.compiler', or '.naked') after '.'");
const abi_name = self.tokenSlice(self.current);
const abi: ast.ABI = if (std.mem.eql(u8, abi_name, "c"))
.c
else if (std.mem.eql(u8, abi_name, "compiler"))
.compiler
else if (std.mem.eql(u8, abi_name, "pure"))
.pure
else if (std.mem.eql(u8, abi_name, "naked"))
.naked
else
return self.fail("unknown ABI (expected '.c', '.compiler', or '.pure')");
return self.fail("unknown ABI (expected '.c', '.compiler', or '.naked')");
self.advance();
try self.expect(.r_paren);
return abi;