selfhost/cmd/wcc: index-base esz from n.type_.size + delete indexbaseesz (#72, A.6.3k)

The N_INDEX node carries the checker-stamped element tinfo (#60 arc); cgindex,
cgun TK_AMP, and cgassign now read the element stride off that .type_.size
instead of indexbaseesz's manual N_DOT-pseudo-field + structlookup walk,
retiring the helper (0 callers, ~96 LOC). Aligns down to cstage's
idx_eff(base->type)->sub->size (cmd/w6c/cgen.c:3517-18, natural element size) --
strictly more cstage-faithful than indexbaseesz's totsize/slotsize derivation
(byte-id held only because firing shapes have totsize==natural; cstage reads
natural and ww-old==cstage, so the flip is structural). Each site keeps its
nil->default-8 fallback; cgindex stays esz-only (signed_elem unset for the
N_DOT base, as before).

Closes the A.6.3 cgenutil-collapse arc: every type/size/offset query in cgen
now reads the checker-stamped tinfo, and the AST-walker / structinfo-walk
helpers it replaced (dotfieldtnode, indexvaluetnode, rhstargetname,
dotinnerstructptr, indexbaseesz) are retired. make test 134/134, byte-id
990-997 hold. Coverage: 713/741/755 + self-rebuild.
This commit is contained in:
2026-05-24 03:16:14 +09:00
parent 0763377806
commit f45caf1cd9
5 changed files with 78 additions and 354 deletions

View File

@@ -1276,8 +1276,8 @@ fn tinfofornode(c: *checker, n: *node) *tinfo = {
// cmd/wcc/check.c:329-345 which stores tuple positionals on
// t->params (Tparam, no offset, consumer recomputes by walking
// at cgen.c:5723-5750); the offset-stored shape lets Phase
// 2/J/K consumers (dotchainresolve, indexbaseesz) read offsets
// directly per the A.6 stamp-once-read-many arc. Direct analog
// 2/J consumers (dotchainresolve) read offsets directly per
// the A.6 stamp-once-read-many arc. Direct analog
// 26724fe (#50 phase 1, A.6.3f-a) for the head/tail append
// pattern. Offset matches cstage's raw-sum layout (no per-
// element padding) — rule 10 aligns wwstage tuple layout down