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:
@@ -351,7 +351,7 @@ linkage keyword are two orthogonal annotations.
|
||||
- `abi(.x)` — ABI / calling-convention annotation in the slot **before**
|
||||
`extern`/`export`. **Unified replacement for `callconv(...)`, which is removed.**
|
||||
`ABI = { default, c, zig, pure }`: `.c` (C ABI), `.zig` (Zig-layout weld → the
|
||||
`compiler` library), `.pure` (naked asm), `.default` (unannotated). Can appear
|
||||
`compiler` library), `.naked` (naked asm), `.default` (unannotated). Can appear
|
||||
standalone (no extern) on any fn / fn-type / lambda.
|
||||
- `extern <lib>` — linkage keyword + binding source (named library).
|
||||
|
||||
@@ -363,12 +363,12 @@ What landed:
|
||||
- **Lexer/token** (`src/token.zig`, `src/lexer.zig`): `kw_callconv` → `kw_abi`,
|
||||
keyword string `"callconv"` → `"abi"`.
|
||||
- **Parser** (`src/parser.zig`): `parseOptionalCallConv` → `parseOptionalAbi`
|
||||
(parses `abi(.c|.zig|.pure)`); wired in the fn-decl postfix slot (before
|
||||
(parses `abi(.c|.zig|.naked)`); wired in the fn-decl postfix slot (before
|
||||
`extern`/`export`), the function-type-expr slot, and the lambda slot;
|
||||
`isFunctionDef`/`hasFnBodyAfterArrow` recognise `kw_abi`.
|
||||
- **AST→IR map** (`src/ir/type_resolver.zig`, `src/ir/lower/decl.zig`, `sema.zig`,
|
||||
`closure.zig`): the AST `.abi == .c` reads kept their C-ABI meaning; the
|
||||
function-type resolver maps `.zig`/`.pure` → IR `.default` (no fn-pointer-type
|
||||
function-type resolver maps `.zig`/`.naked` → IR `.default` (no fn-pointer-type
|
||||
CC for those decl-level ABIs; neither occurs in a function-TYPE position yet).
|
||||
- **CC-mismatch diagnostic** (`src/ir/lower/expr.zig`, `src/sema.zig`): the
|
||||
user-facing text `callconv(.c)` → `abi(.c)`.
|
||||
@@ -379,7 +379,7 @@ What landed:
|
||||
- **Tests**: parser unit tests in `src/parser.test.zig` — `abi(.zig) extern <lib>`
|
||||
on a fn decl (asserts `abi == .zig`, `extern_export == .extern_`, `extern_lib ==
|
||||
"compiler"`); bare `extern` leaves `abi == .default`; standalone `abi(.c)` /
|
||||
`abi(.pure)`. lexer/sema tests updated.
|
||||
`abi(.naked)`. lexer/sema tests updated.
|
||||
|
||||
`zig build` + `zig build test` green (450/450 unit + 685 corpus).
|
||||
|
||||
@@ -1656,7 +1656,7 @@ when reached (sentinels or accessor fns; see the design doc Risks).
|
||||
after `struct`. Parser unit tests (welded `Field` + plain struct), break-verified.
|
||||
Build + suite green. Parse-only sub-step (fns + structs) of Phase 1.1 complete.
|
||||
- **Phase 1.1 first sub-step + `callconv`→`abi` unification.** Parsed `abi(.zig)
|
||||
extern <lib>` on fn decls; unified `callconv` into `abi(.c|.zig|.pure)` (removed
|
||||
extern <lib>` on fn decls; unified `callconv` into `abi(.c|.zig|.naked)` (removed
|
||||
the `callconv` keyword), migrated 52 sx files + compiler diagnostics + docs +
|
||||
snapshots. Build + suite green. The original design's `extern(.zig)` single
|
||||
qualifier was split into `abi(.zig)` (ABI/layout, before extern) + `extern
|
||||
|
||||
Reference in New Issue
Block a user