toolchain: banner purge + WHY-only comment sweep (rule 8)

selfhost/, cmd/, internal/ join the tree-wide sweep: every section
banner dies (91 selfhost + the cmd C-style dividers -> 0); narration
and stale contracts deleted (pre-#22 bundler notes, retired
single-PT_LOAD and no-archive claims, superseded ABI tables); every
ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10
twin pointer kept; lost lifetime/rationale lines restored where the
sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment-
only proven: all five wwstage tool binaries byte-identical across
the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent),
and test-bootstrap (fixed point + 991-995 byte-id) all exit 0.
The read-through banked 66 latent-bug leads (checkpoint).
This commit is contained in:
2026-08-08 23:14:03 +09:00
parent 83f5956df2
commit 62b9d20383
60 changed files with 232 additions and 1045 deletions

View File

@@ -1366,9 +1366,9 @@ let_emit_size(Type *t)
}
}
/* Is the unwrapped type a str? Used by the load/store paths so the
* (AX, BX) pair convention is preserved for str globals, mirroring
* what we already do for str locals. */
/* Used by the load/store paths so the (AX, BX) pair convention is
* preserved for str globals, mirroring what we already do for str
* locals. */
static int
let_isstr(Type *t)
{
@@ -1377,8 +1377,8 @@ let_isstr(Type *t)
return u && u->kind == TY_STR;
}
/* Is the unwrapped type a slice? Slice globals flow as the (AX, BX,
* CX) triple — same as the local ABI. */
/* Slice globals flow as the (AX, BX, CX) triple — same as the local
* ABI. */
static int
let_isslice(Type *t)
{
@@ -1387,9 +1387,9 @@ let_isslice(Type *t)
return u && u->kind == TY_SLICE;
}
/* Is the unwrapped type a struct? Struct globals only support field
* access (read + plain `=` write for scalar fields). Whole-struct
* by-value flow through expressions isn't wired. */
/* Struct globals only support field access (read + plain `=` write
* for scalar fields). Whole-struct by-value flow through expressions
* isn't wired. */
static int
let_isstruct(Type *t)
{
@@ -1398,9 +1398,8 @@ let_isstruct(Type *t)
return u && u->kind == TY_STRUCT;
}
/* Is the unwrapped type a fixed-length array? Array globals are
* zero-init DATAW slots; cgindex addresses them as LEAQ name(SB)
* and lets the element load/store run as usual. */
/* Array globals are zero-init DATAW slots; cgindex addresses them as
* LEAQ name(SB) and lets the element load/store run as usual. */
static int
let_isarray(Type *t)
{
@@ -1409,9 +1408,9 @@ let_isarray(Type *t)
return u && u->kind == TY_ARRAY;
}
/* Is the unwrapped type a float (f32 or f64)? Float globals flow
* through X0 — load/store goes LEAQ name(SB),CX → MOVSS/MOVSD via the
* indirect, since the asm has no D_EXTERN form for SSE moves yet. */
/* Float globals flow through X0 — load/store goes LEAQ name(SB),CX →
* MOVSS/MOVSD via the indirect, since the asm has no D_EXTERN form
* for SSE moves yet. */
static int
let_isfloat(Type *t)
{
@@ -1722,7 +1721,6 @@ let_var_type(const char *name)
return NULL;
}
/* Glue `<module>.<ident>` into a fresh arena buffer. */
static const char *
mod_join(Cg *c, const char *mod, const char *ident)
{
@@ -1944,9 +1942,6 @@ cgslicehdr(Cg *c, int base)
else if (base == D_AX) ins2(c, A_MOVQ, amem(base, 0), areg(D_AX));
}
/* ------------------------------------------------------------------ */
/* per-fn local table: name → stack offset (positive = below FP) */
typedef struct Local Local;
struct Local {
const char *name;
@@ -2074,8 +2069,7 @@ cg_base_cap(Cg *c, Node *base, Type *bu, Local *locals, int dst)
return 0;
}
/* ------------------------------------------------------------------ */
/* expressions: result lands in AX. Returns 1 on success. */
/* expressions: result lands in AX. */
static void cgexpr(Cg*, Node*, Local*);
static void cgstmt(Cg*, Node*, Local**, int*);
@@ -4678,7 +4672,6 @@ cgexpr(Cg *c, Node *n, Local *locals)
}
}
if (amped) break;
/* Fall through to silent-drop fallback below. */
}
if (opnd && opnd->kind == N_INDEX) {
/* &base[i] = base + i*esz, no dereference.
@@ -5436,7 +5429,6 @@ cgexpr(Cg *c, Node *n, Local *locals)
}
after_dot_assign:
if (u && u->kind == TY_STRUCT) {
/* find field metadata */
Tfield *f = NULL;
for (Tfield *fl = u->fields; fl; fl = fl->next)
if (strcmp(fl->name, n->lhs->str) == 0)
@@ -5725,7 +5717,6 @@ cgexpr(Cg *c, Node *n, Local *locals)
}
break;
}
/* now store AX into target */
if (via_ptr) {
if (boff == 0 && let_islet(base->str)) {
/* #47 (inverse): a GLOBAL *struct
@@ -15147,7 +15138,6 @@ cgstmt(Cg *c, Node *n, Local **locals, int *frame)
baseoff = localoff(c, locals, bname, 8, frame);
}
/* allocate per-name slots */
struct { int off, sz, foff; Type *ftype; } binds[8] = {0};
int nbinds = 0;
if (destruct) {
@@ -15733,7 +15723,6 @@ cgfn(Cg *c, FILE *out, Node *fn)
{
if (fn->body == NULL) return; /* extern decl, no body */
/* fresh per-fn state */
c->head = c->tail = NULL;
c->fnname = fn->str;
c->cur_mod = (fn->module && fn->module[0]) ? fn->module : NULL;
@@ -15788,7 +15777,6 @@ cgfn(Cg *c, FILE *out, Node *fn)
text->from.offset = 0; /* framesize patched below */
emit(c, text);
/* prologue */
ins1(c, A_PUSHQ, areg(D_BP));
ins2(c, A_MOVQ, areg(D_SP), areg(D_BP));
Prog *subsp = newprog(c, A_SUBQ);