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:
@@ -16,17 +16,12 @@
|
||||
// - A `.wwi` is ONE package's interface; the emit filters to PRIMARY
|
||||
// decls (imported==0).
|
||||
|
||||
// Imports mirror check.ww (os/tok/strconv only): node/nkind/sym/skind/
|
||||
// scopelookuptype/streq/checker/tkind resolve bare in the selfhost's flat
|
||||
// bundled scope, exactly as check.ww references them.
|
||||
package wcc;
|
||||
|
||||
import os;
|
||||
import syntax;
|
||||
import strconv;
|
||||
|
||||
// --- byte writers ------------------------------------------------------
|
||||
|
||||
fn wputs(fd: i32, s: str) void = {
|
||||
os.write(fd, s.ptr, s.len: u64);
|
||||
};
|
||||
@@ -71,13 +66,11 @@ fn wquote(fd: i32, s: str) void = {
|
||||
wputb(fd, '"');
|
||||
};
|
||||
|
||||
// --- check_exported_type (drew) ---------------------------------------
|
||||
//
|
||||
// Resolve an N_TNAME to its type sym via the public sym helpers (mirror
|
||||
// of cstage wwi_typesym / scope_lookup_type) WITHOUT the side effects of
|
||||
// the checker's aliassym (no on-demand resolve, no double error). A
|
||||
// primitive/keyword resolves to no SK_TYPE → leaf. By producer time
|
||||
// checkfile has finished and c.cur == c.top.
|
||||
// check_exported_type (drew): resolve an N_TNAME to its type sym via the
|
||||
// public sym helpers (mirror of cstage wwi_typesym / scope_lookup_type)
|
||||
// WITHOUT the side effects of the checker's aliassym (no on-demand
|
||||
// resolve, no double error). A primitive/keyword resolves to no SK_TYPE
|
||||
// → leaf. By producer time checkfile has finished and c.cur == c.top.
|
||||
|
||||
fn wwitypesym(c: *checker, nm: str) *syntax.sym = {
|
||||
let empty: str;
|
||||
@@ -188,7 +181,7 @@ fn wwicheckdecl(c: *checker, d: *syntax.node) i32 = {
|
||||
bad = bad | wwichecktype(c, d, p.lhs);
|
||||
p = p.next;
|
||||
};
|
||||
bad = bad | wwichecktype(c, d, d.lhs); // ret
|
||||
bad = bad | wwichecktype(c, d, d.lhs);
|
||||
} else { if (d.kind == syntax.nkind.N_TYPEDECL) {
|
||||
bad = bad | wwichecktype(c, d, d.lhs);
|
||||
} else { if (d.kind == syntax.nkind.N_DEF) {
|
||||
@@ -200,10 +193,8 @@ fn wwicheckdecl(c: *checker, d: *syntax.node) i32 = {
|
||||
return bad;
|
||||
};
|
||||
|
||||
// --- type-expr + const-expr unparser (rob §2.2/§2.4) ------------------
|
||||
|
||||
// wwihexdigits — emit the low `n` hex digits of `v`, most-significant
|
||||
// first, lowercase. Byte-identical to cstage's fprintf("%0Nx").
|
||||
// Type-expr + const-expr unparser (rob §2.2/§2.4). wwihexdigits is
|
||||
// byte-identical to cstage's fprintf("%0Nx").
|
||||
fn wwihexdigits(fd: i32, v: u64, n: i32) void = {
|
||||
let i: i32 = n - 1;
|
||||
for (i >= 0) {
|
||||
@@ -515,8 +506,6 @@ fn wwidecl(fd: i32, d: *syntax.node) void = {
|
||||
};};};};
|
||||
};
|
||||
|
||||
// --- deterministic ordering (rob §3) ----------------------------------
|
||||
|
||||
fn wwiprimary(n: *syntax.node) bool = {
|
||||
// imported==1 marks a decl reached through a `//ww:module <path>`
|
||||
// boundary (an imported module's concatenated section).
|
||||
@@ -529,8 +518,9 @@ fn wwiisdecl(d: *syntax.node) bool = {
|
||||
d.kind == syntax.nkind.N_DEF || d.kind == syntax.nkind.N_LET;
|
||||
};
|
||||
|
||||
// strcmp — byte lexicographic, mirror C strcmp sign (<0/0/>0). Both
|
||||
// stages key the sort identically, so the `.wwi` order is deterministic.
|
||||
// Deterministic ordering (rob §3): byte-lexicographic, mirror C strcmp
|
||||
// sign (<0/0/>0). Both stages key the sort identically, so the `.wwi`
|
||||
// order is deterministic.
|
||||
fn wwistrcmp(a: str, b: str) i32 = {
|
||||
let i: i32 = 0;
|
||||
for (i < a.len && i < b.len) {
|
||||
@@ -542,8 +532,7 @@ fn wwistrcmp(a: str, b: str) i32 = {
|
||||
return a.len - b.len;
|
||||
};
|
||||
|
||||
// Selection sort over parallel (key, node) arrays. Total order keyed on
|
||||
// the symbol name; ties broken by original index — so the result is
|
||||
// Total order keyed on the symbol name; ties broken by original index —
|
||||
// stable regardless of any same-name collision, matching cstage's qsort
|
||||
// + idx tiebreak.
|
||||
fn wwisortdecls(keys: []str, nodes: []*syntax.node, n: i32) void = {
|
||||
|
||||
Reference in New Issue
Block a user