lib/ww + wcc + w6c + wwdump: strip *arena cascade (γ-6)

amalloc has 0 callers post-γ-2; the *arena threaded through
newnode/newscope/newtype/prim/typesinit/type{ptr,slice,array,chan,
named}/lexinit/parserinit/joindotted/checkinit/arenau64tos/cgeninit
and the scope.a / tctx.a / lex.a / parser.a / checker.a / cgen.a
fields are vestigial.

Drop `import mem;` from 15 files, remove six struct fields, strip
*arena from 14 signatures, update ~120 call sites across lib/ww +
wcc + w6c + wwdump. selfhost/test/sym_link.ww fixture drops the
newarena/freearena probe; still exits 42 on scopedefine/scopelookup.
Both main.combined.ww auto-regenerated.

Comments retidied: typ.ww "once per arena" → "once per program";
parse.ww drops "arena-build" qualifier on joindotted; sym.ww drops
mem-sibling-imports rationale.

Verified 132/132 incl. 994_w6c_ww + 995_self_rebuild byte-identity
(the primary symmetric-stages gate).
This commit is contained in:
2026-05-21 13:01:57 +09:00
parent f83e65b82a
commit 353dffb5e8
19 changed files with 543 additions and 824 deletions

View File

@@ -14,7 +14,6 @@ package main;
import os;
import rt;
import mem;
import strings;
import tok;
import lex;
@@ -135,7 +134,6 @@ export fn main(argc: i32, argv: **u8) i32 = {
os.close(ofd);
};
let ar: *arena = newarena();
let nlen: u64 = cstrlen(src);
let view: str;
view.ptr = src;
@@ -143,10 +141,10 @@ export fn main(argc: i32, argv: **u8) i32 = {
let fname: str = strings.dup(view);
let l: lex;
lexinit(&l, ar, fname, buf, blen);
lexinit(&l, fname, buf, blen);
let ps: parser;
parserinit(&ps, ar, &l);
parserinit(&ps, &l);
let f: *node = parsefile(&ps);
// Gate cgen on parse-stage errors. Mirrors cmd/w6c/main.c's
// `if (l.errs || p.errs) return 1;` — broken AST otherwise reaches
@@ -160,14 +158,14 @@ export fn main(argc: i32, argv: **u8) i32 = {
// enum↔int reinterpret, #53 N_BLOCK scoping, #55 nominal-first variant
// compare, #56 bare-leaf same-module preference.
let tc: tctx;
typesinit(&tc, ar);
typesinit(&tc);
let ck: checker;
checkinit(&ck, ar, &tc);
checkinit(&ck, &tc);
checkfile(&ck, f);
if (ck.errs > 0) { return 1; };
let cg: cgen;
cgeninit(&cg, ar);
cgeninit(&cg);
cgfile(&cg, f);
return 0;
};