wcc_ww/cgen: #62 Layer-2 (ww half) — rhsstructpayload chases the alias chain; widen-store su at entry

The wwstage tagged widen's struct-payload classify was name-keyed:
rhsstructpayload's N_IDENT arm did a bare structlookup on the local's
declared TNAME, so an alias name (ali->base) missed the registered
structinfo and the value fell past the struct arm to the SCALAR widen
arm — word0-only box payload, words 1+ zero-filled. At normal decl
order this was BOTH-WRONG-IDENTICAL with cstage pre-F1 (byte-id YES,
gate-blind; F0 m5b_match1 exit 2/2). Choke-point fix: route the arm
through structlookupchain (the name-domain twin of cstage's
su = type_chase_named, c138605) and return the REGISTERED struct
name so every consumer's re-lookup hits. All three consumers
graduate through the one funnel (proof-grep: rhsstructpayload is the
only struct-payload classifier): cgwidentaggedstorebp's struct arm
(let/assign/match), pushargsrev's widen route (the call-arg twin),
and cgreturn's needswiden (cgenstmt.ww:1022). The variant TAG still
keys on the un-chased stamped type — the member's nominal identity
is the alias (cg_tag_for_variant precedent).

Rider, same store family: cgwidentaggedstorebp now chases the source
classify ONCE at entry (post cast peels, where src is final) —
`su = tichase(src.type_)` replaces the five per-arm chases
(nested-arm su / memread su37 / >32B+cast-guard sf37 / tuple-guard
stu72 / tuple-arm stu, all reading the same src.type_), mirroring
cstage cg_widen_tagged_store's su position. dt entry loop + the
remaining in-function plain chases (castu/ceti/fti/fvt) collapse to
tichase — mechanical, excluded from c1 only because the function was
c2 scope wholesale.

Runtime graduation (banked rows .ai/impl62r_layer2_rows.md):
m5b_match1 (L2-1 norm) + m5_match (L2-2 fwd) cs0/ww2 -> 0/0 byte-id;
L2-4 3-word (last payload word) 0/0; push-twin arg row 0/0; control
m5b_match0 holds 0/0 (ken confirms at verdict). test 944: the four
K_RUN_CS rows flip to K_RUN (both drivers + byte-id), 129/129.

SURFACED, FILED NOT FIXED (task #89): the RETURN-position leg
(`return x` of an alias struct into a (void|ali) fn return) was
both-wrong-identical (cs1/ww1 byte-id) and is now transiently
cs1/ww0 byte-id NO — ww is the runtime-correct side; cstage
cgreturn's own route into the widen misses the alias (F1 c138605
covered store+push only). F1-precedent transient divergence, noted
per the L2 rows file's acceptance clause.

Selfhost byte-id: new w6c_ww on the c1-HEAD five main.combined.ww —
byte-identical to the c1 build's output (the fix is asm-neutral on
the corpus); cs==ww on the regenerated five. make test-unit green
(288). Closes task #62's ww half — fix-landed-pending-gate (#71
precedent). combined.ww regens ride along.
This commit is contained in:
2026-06-05 21:46:36 +09:00
parent f19d0cb14d
commit f7fd3e4850
4 changed files with 122 additions and 131 deletions

View File

@@ -43,11 +43,11 @@
* | struct-lit, walk leaves, reads); |
* | unprobed gates LOUD-tripwired (#73, |
* | K_BUILDERR_CS pin) | 0
* union_store_* + | task #62 Layer-2 (cs half): alias- |
* union_push_arg | NAMED struct as union member — widen |
* | store/push word0-only; CS-ONLY until |
* | F2 lands the wwstage half; base ctl |
* | + the #54-bound `as` row pinned loud | 0(cs)
* union_store_* + | task #62 Layer-2: alias-NAMED struct |
* union_push_arg | as union member — widen store/push |
* | word0-only; cs half c138605, ww half |
* | F2a batch-2 c2 — graduated K_RUN; |
* | base ctl + #54-bound `as` row loud | 0
* nested_alias_field_* | task #71: alias-typed nested-field |
* | store/read/addr-of walks fold to |
* | direct offsets (byte-id graduation, |
@@ -657,14 +657,17 @@ static const struct row rows[] = {
" if (take(x) != 26) { return 1; };\n"
" return 0;\n"
"};\n", 0, K_RUN, NULL },
/* ---- task #62 Layer-2 (cstage half): alias-NAMED struct as a
* UNION MEMBER. The widen store/push su single peel fell past the
* struct arm to the scalar arm — word0-only payload (the banked
* rows /tmp/impl62r_layer2_rows.md; both-wrong-identical with
* wwstage at normal decl order = gate-blind byte-id). CS-ONLY
* until F2 routes wwstage rhsstructpayload/push through
* structlookupchain — flip these to K_RUN then. Values distinct
* per word; the LAST payload word is always checked. */
/* ---- task #62 Layer-2: alias-NAMED struct as a UNION MEMBER.
* The widen store/push source classify fell past the struct arm
* to the scalar arm — word0-only payload (the banked rows
* /tmp/impl62r_layer2_rows.md; both-wrong-identical at normal
* decl order = gate-blind byte-id). cs half c138605
* (cg_widen_tagged_store/push su chase); ww half F2a batch-2 c2
* (rhsstructpayload -> structlookupchain)K_RUN, byte-id.
* Values distinct per word; the LAST payload word is always
* checked. The RETURN-position leg stays both-stage divergent —
* cs cgreturn residual, task #89 (ww runtime-correct since c2;
* not pinned here until the cs half lands). */
{ "union_store_norm", /* banked row L2-1 (= F0 m5b_match1) */
"package main;\n"
"type base = struct { a: size, b: size };\n"
@@ -681,7 +684,7 @@ static const struct row rows[] = {
" case void => { return 3; };\n"
" };\n"
" return 0;\n"
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #62 F2 */
"};\n", 0, K_RUN, NULL },
{ "union_store_fwd", /* banked row L2-2 (= F0 m5_match) */
"package main;\n"
"type ali = base;\n"
@@ -698,7 +701,7 @@ static const struct row rows[] = {
" case void => { return 3; };\n"
" };\n"
" return 0;\n"
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #62 F2 */
"};\n", 0, K_RUN, NULL },
{ "union_store_3word", /* banked row L2-4: pins the width LOOP */
"package main;\n"
"type base = struct { a: size, b: size, c: size };\n"
@@ -715,7 +718,7 @@ static const struct row rows[] = {
" case void => { return 3; };\n"
" };\n"
" return 0;\n"
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #62 F2 */
"};\n", 0, K_RUN, NULL },
{ "union_push_arg", /* the cg_widen_tagged_push twin (F1 find) */
"package main;\n"
"type base = struct { a: size, b: size };\n"
@@ -731,7 +734,7 @@ static const struct row rows[] = {
" x.a = 4; x.b = 9;\n"
" if (peek(x) != 9) { return 1; };\n"
" return 0;\n"
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #62 F2 */
"};\n", 0, K_RUN, NULL },
/* banked row L2-5: the m5b_match0 gold invariant — base spelling
* indistinguishable (ken oracle PART 1.7). */
{ "union_store_base_ctl",