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:
@@ -1,21 +1,9 @@
|
||||
// selfhost/cmd/wcc/cgenstmt.ww — split out of cgen.ww.
|
||||
//
|
||||
// cgstmt is a thin dispatcher over n.kind; each branch defers to a
|
||||
// per-kind helper: cgblock, cgreturn, cgexprstmt, cglet, cgif, cgfor,
|
||||
// cgmassign, cgbreak, cgcontinue.
|
||||
//
|
||||
// The expression generator (cgexpr) lives in cgenexpr.ww; the
|
||||
// foundation (types, emit primitives, collect* tables, FFI/module
|
||||
// maps) lives in cgen.ww.
|
||||
|
||||
package wcc;
|
||||
|
||||
import os;
|
||||
import syntax;
|
||||
import strconv;
|
||||
|
||||
// ---- statement cgen --------------------------------------------------
|
||||
|
||||
fn cgstmt(c: *cgen, n: *syntax.node) void = {
|
||||
if (n == nil) { return; };
|
||||
let k: syntax.nkind = n.kind;
|
||||
@@ -64,9 +52,8 @@ fn cgstmt(c: *cgen, n: *syntax.node) void = {
|
||||
};
|
||||
|
||||
fn cgyield(c: *cgen, n: *syntax.node) void = {
|
||||
// Evaluate the value into AX (and BX for str), then JMP to the
|
||||
// enclosing match's end label. Falls through silently if there
|
||||
// is no active match — should be a checker error eventually.
|
||||
// Falls through silently if there is no active match — should be
|
||||
// a checker error eventually.
|
||||
if (n.lhs != nil) { cgexpr(c, n.lhs); };
|
||||
if (c.yieldtop > 0) {
|
||||
let tgt: str = c.yieldbuf[c.yieldtop - 1];
|
||||
@@ -100,8 +87,6 @@ fn cgblock(c: *cgen, n: *syntax.node) void = {
|
||||
return;
|
||||
};
|
||||
|
||||
// rundefers — emit cgexpr for every queued defer in LIFO order.
|
||||
// Called from cgreturn and the cgfn implicit-return path.
|
||||
fn rundefers(c: *cgen) void = {
|
||||
let i: i32 = c.defertop - 1;
|
||||
for (i >= 0) {
|
||||
@@ -3178,11 +3163,6 @@ fn cgfor(c: *cgen, n: *syntax.node) void = {
|
||||
return;
|
||||
};
|
||||
|
||||
// Tuple-destructure assign: `a, b = call();`. The call's tuple
|
||||
// return lands in (AX, DX); push DX to free it, store AX into
|
||||
// the first lvalue, then pop DX into the second. Mirrors
|
||||
// cmd/w6c/cgen.c:2424-2440. Lvalues beyond two are dropped (same
|
||||
// as C — no fixture uses >2 today).
|
||||
fn cgmassign(c: *cgen, n: *syntax.node) void = {
|
||||
// #83: positional per-element destructure REASSIGN. Same cursor as
|
||||
// cgmlet (and cgreturn; harec create_unpack_bindings,
|
||||
@@ -3394,17 +3374,6 @@ fn cgmassign(c: *cgen, n: *syntax.node) void = {
|
||||
return;
|
||||
};
|
||||
|
||||
// Multi-let from a tuple-returning call: `let n, s = call();` or
|
||||
// `let (n, s) = call();`. wwstage has no checker, so each binding's
|
||||
// type is taken from its explicit annotation (l.lhs) when present
|
||||
// or inferred from the called fn's return-type tuple element.
|
||||
//
|
||||
// Per the AX:DX:CX:R8 return convention (mirrors C cgen nkind.N_MLET):
|
||||
// (scalar, scalar) — AX → l0, DX → l1.
|
||||
// (scalar, str) — AX → scalar slot, (DX, CX, R8) → str slot
|
||||
// as (.ptr, .len, .cap). Position-agnostic — the
|
||||
// regs are routed by element type, not by AX/DX.
|
||||
// str IS []u8 (24B): cap rides R8 (#1/Phase 3, task #5).
|
||||
fn cgmlet(c: *cgen, n: *syntax.node) void = {
|
||||
let rhs: *syntax.node = n.rhs;
|
||||
if (rhs == nil) { return; };
|
||||
@@ -3958,7 +3927,6 @@ fn cgforrange(c: *cgen, n: *syntax.node) void = {
|
||||
nbinds = 1;
|
||||
};
|
||||
|
||||
// init: ioff(BP) = 0
|
||||
emitline("\tMOVQ\t$0, ");
|
||||
emitoff(ioff: i64);
|
||||
emitline("(BP)\n");
|
||||
@@ -4290,5 +4258,3 @@ fn cgcontinue(c: *cgen, n: *syntax.node) void = {
|
||||
c.lastwasreturn = 0;
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user