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:
@@ -114,7 +114,7 @@ enum {
|
||||
A_LAST
|
||||
};
|
||||
|
||||
const char *anames(int); /* opcode -> mnemonic */
|
||||
const char *rnames(int); /* register -> name */
|
||||
const char *anames(int);
|
||||
const char *rnames(int);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
/*
|
||||
* gc.h — w6c-private header: Prog/Adr structs, scratch register set,
|
||||
* stack-frame state. Plan 9 cmd/6c/gc.h shape, trimmed.
|
||||
*/
|
||||
/* Plan 9 cmd/6c/gc.h shape, trimmed. */
|
||||
#ifndef SIX_GC_H
|
||||
#define SIX_GC_H
|
||||
|
||||
@@ -73,9 +70,7 @@ void emit(Cg*, Prog*);
|
||||
/* txt.c */
|
||||
void txt_emit(FILE*, Prog *head);
|
||||
|
||||
/* wwi.c — `.wwi` export-data producer (w6c -I). M2 dead-code: writes a
|
||||
* re-parseable ww-prototype rendering of the package's exported surface.
|
||||
* Returns non-zero if check_exported_type rejects a dangling export. */
|
||||
/* wwi.c — non-zero return: check_exported_type rejected a dangling export. */
|
||||
int wwi_emit(Checker *c, FILE *of, Node *file);
|
||||
|
||||
/* swt.c, peep.c, reg.c — placeholders for now */
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
/*
|
||||
* w6c — amd64 compiler driver. Reads a .ww source file, runs the
|
||||
* libwcc frontend (lex → parse → check), then walks the typed AST
|
||||
* via cgen.c and writes Plan 9-flavoured amd64 asm to stdout (or
|
||||
* the file given by -o).
|
||||
*/
|
||||
#include "gc.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* peep.c — peephole pass. Currently a no-op; reserved for the kind of
|
||||
* cleanup Plan 9 6c does (folding adjacent moves, removing redundant
|
||||
* compares). Wire in `peephole(c)` from cgen.c after the main walk.
|
||||
* Currently a no-op; reserved for the kind of cleanup Plan 9 6c does
|
||||
* (folding adjacent moves, removing redundant compares). Wire in
|
||||
* `peephole(c)` from cgen.c after the main walk.
|
||||
*/
|
||||
#include "gc.h"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* reg.c — register allocator. The current cgen pins everything to AX
|
||||
* with BX as a scratch top-of-stack — no real allocation. This file
|
||||
* is the seam where a linear-scan or graph-colouring pass would land
|
||||
* later; today it's empty.
|
||||
* The current cgen pins everything to AX with BX as a scratch
|
||||
* top-of-stack — no real allocation. This file is the seam where a
|
||||
* linear-scan or graph-colouring pass would land later; today it's
|
||||
* empty.
|
||||
*/
|
||||
#include "gc.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* swt.c — switch-statement lowering. Stub for now: cgen falls
|
||||
* through to a no-op for N_SWITCH. When we add a real lowering, it
|
||||
* will live here, mirroring Plan 9 6c's pswt.c.
|
||||
* Stub for now: cgen falls through to a no-op for N_SWITCH. When we
|
||||
* add a real lowering, it will live here, mirroring Plan 9 6c's
|
||||
* pswt.c.
|
||||
*/
|
||||
#include "gc.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* txt.c — print a Prog list as Plan 9-flavoured amd64 asm text.
|
||||
*
|
||||
* Format we emit (and that w6a expects):
|
||||
* TEXT name<framesize>
|
||||
* MOVQ $1, AX
|
||||
|
||||
@@ -35,11 +35,11 @@ wwi_primary(Node *n)
|
||||
return n && n->imported == 0;
|
||||
}
|
||||
|
||||
/* --- check_exported_type (drew) ------------------------------------- *
|
||||
* Resolve an N_TNAME to its type sym WITHOUT the side effects of
|
||||
* resolve_typename (no on-demand resolve, no double "unknown type"
|
||||
* error). A primitive/keyword resolves to no SK_TYPE → leaf. By the
|
||||
* time the producer runs, check_file has finished and c->cur == c->top.
|
||||
/* check_exported_type (drew): resolve an N_TNAME to its type sym WITHOUT
|
||||
* the side effects of resolve_typename (no on-demand resolve, no double
|
||||
* "unknown type" error). A primitive/keyword resolves to no SK_TYPE →
|
||||
* leaf. By the time the producer runs, check_file has finished and
|
||||
* c->cur == c->top.
|
||||
*/
|
||||
static Sym *
|
||||
wwi_typesym(Checker *c, const char *nm)
|
||||
@@ -141,7 +141,7 @@ wwi_check_decl(Checker *c, Node *d)
|
||||
return bad;
|
||||
}
|
||||
|
||||
/* --- type-expr + const-expr unparser (rob §2.2/§2.4) ---------------- */
|
||||
/* type-expr unparse per rob §2.2; const-expr per rob §2.4. */
|
||||
|
||||
static void wwi_expr(FILE *of, Node *e);
|
||||
static void wwi_type(FILE *of, Node *t);
|
||||
@@ -447,7 +447,7 @@ wwi_decl(FILE *of, Node *d)
|
||||
}
|
||||
}
|
||||
|
||||
/* --- deterministic ordering (rob §3) -------------------------------- */
|
||||
/* deterministic ordering per rob §3. */
|
||||
|
||||
struct declent { Node *d; int idx; };
|
||||
struct useent { const char *path; int idx; };
|
||||
|
||||
Reference in New Issue
Block a user