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

@@ -144,15 +144,15 @@ test "parser: bare extern leaves abi == .default" {
// Lock: `abi(.c)` parses standalone (no extern/export) in the postfix slot — the
// migrated spelling of the old `callconv(.c)` on an ordinary function pointer /
// fn decl. And `abi(.pure)` parses (naked-asm ABI).
test "parser: abi(.c) and abi(.pure) parse standalone" {
// fn decl. And `abi(.naked)` parses (naked-asm ABI).
test "parser: abi(.c) and abi(.naked) parse standalone" {
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
defer arena.deinit();
const alloc = arena.allocator();
const src =
\\cb :: () -> i64 abi(.c) { 0; }
\\nk :: () -> i64 abi(.pure) { 0; }
\\nk :: () -> i64 abi(.naked) { 0; }
\\
;
var parser = Parser.init(alloc, src);
@@ -163,7 +163,7 @@ test "parser: abi(.c) and abi(.pure) parse standalone" {
try std.testing.expectEqual(ast.ABI.c, decls[0].data.fn_decl.abi);
try std.testing.expectEqual(ast.ExternExportModifier.none, decls[0].data.fn_decl.extern_export);
try std.testing.expect(decls[1].data == .fn_decl);
try std.testing.expectEqual(ast.ABI.pure, decls[1].data.fn_decl.abi);
try std.testing.expectEqual(ast.ABI.naked, decls[1].data.fn_decl.abi);
}
// Lock: the postfix `abi(...)` slot PARSES on a STRUCT decl — `Name :: struct