cgen: B6-c3 addr-of/field-walk/index spine single peels fold into type_chase_named — 14 lines
The exact B6-c3 set (rob b6 spec §2, numbering at4cac1cb): :3949 (&ident classify ou), :4006 (&mod.G leaf lu), :4124/:4128 (&p.f ptr-field fallback bu/inner), :5029/:5035/:5052 (indexed-elem struct-field STORE elemu/inner/bu), :5937 (assign-region esub peel), :10953/:10956 (chained N_DOT ptr lu/inner), :11046/:11052/:11067 (indexed-elem struct-field READ twin), :11285 (index-region esub peel — gates key the chased esubu exactly as the ident arm, per the EYES condition). Raw `->under` in cgen.c 41→27. RE-ATTRIBUTION (ken c3-STOP addendum, adjudicated on his independent scratch build): kb6_idxf and kb6_ampf did NOT land on the oracle's predicted post-states — and the train direction is CORRECT anyway. Bit-proven mechanism: post-chase cs_alias asm == ww_PLAIN (the byte-id-gate-proven canonical dedicated shape) for BOTH rows; it is WWSTAGE that is alias-blind at these two sites (ww_alias != ww_plain — its indexed-elem struct-field store/read gates and the &p.f ptr-field fallback don't fire on alias bases and fall to generic-but- runtime-correct routes). Converging cs onto ww_alias would re-blind cs — canonical is the convergence target. ampf's pre-c3 byte-id was both-stages-on-the-generic-route identity (gate-blind, #263-class), NOT M5 latency — oracle self-correction banked. Both rows pinned K_RUN_NOID (cs-0 + ww-0, byte-id waived) + plain-control rows pin the convergence target; they graduate to full byte-id when the filed ww-side W2 fold (task #102) lands (ww gate chase; kw1/#100/W1 precedent; zero metric-1 content). chdot/esub byte-NEUTRAL bound held. TRAIN INVARIANT: cs-only; w6c_ww/ww_ww bit-identical to the4cac1cbbaselines (b6bddc8e…/4e9ca874…). cs movers c2→c3 bounded to exactly {kb6_idxf, kb6_ampf} — the named c3 family; both run-cells ok/0 held; rest of corpus + five mains byte-NEUTRAL; detectors unmoved; 989 ratchet zero flips. 944_alias_cgen_b6_run grows 8→14 rows, 22→38 checks: idxf_2lvl/ ampf_2lvl NOID pins + idxf_plain_ctl/ampf_plain_ctl canonical-shape pins + chdot_2lvl/esub_2lvl controls. All 944-family suites green; sizelint 0.
This commit is contained in:
@@ -3945,8 +3945,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
if (opnd && opnd->kind == N_IDENT) {
|
||||
int off = localfind(locals, opnd->str);
|
||||
Type *ot = opnd->type;
|
||||
Type *ou = (ot && ot->kind == TY_NAMED)
|
||||
? ot->under : ot;
|
||||
Type *ou = type_chase_named(ot);
|
||||
if (off != 0) {
|
||||
ins2(c, A_LEAQ, amem(D_BP, off), areg(D_AX));
|
||||
} else if (ou && ou->kind == TY_FN) {
|
||||
@@ -4002,8 +4001,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
&& (opnd->lhs->type == NULL
|
||||
|| opnd->lhs->type == ty_err)) {
|
||||
Type *lt = opnd->type;
|
||||
Type *lu = (lt && lt->kind == TY_NAMED)
|
||||
? lt->under : lt;
|
||||
Type *lu = type_chase_named(lt);
|
||||
if (lu && lu->kind == TY_FN)
|
||||
ins2(c, A_LEAQ,
|
||||
mafn(c, opnd->str,
|
||||
@@ -4120,12 +4118,9 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
if (!amped && opnd->lhs
|
||||
&& opnd->lhs->kind == N_IDENT) {
|
||||
Type *bt = opnd->lhs->type;
|
||||
Type *bu = (bt && bt->kind == TY_NAMED)
|
||||
? bt->under : bt;
|
||||
Type *bu = type_chase_named(bt);
|
||||
if (bu && bu->kind == TY_PTR && bu->sub) {
|
||||
Type *inner = bu->sub;
|
||||
if (inner->kind == TY_NAMED)
|
||||
inner = inner->under;
|
||||
Type *inner = type_chase_named(bu->sub);
|
||||
if (inner && inner->kind == TY_STRUCT) {
|
||||
for (Tfield *f = inner->fields;
|
||||
f; f = f->next) {
|
||||
@@ -5025,14 +5020,11 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
Node *idx = n->lhs->lhs->rhs;
|
||||
if (idxbase && idxbase->kind == N_IDENT && idx) {
|
||||
Type *elemt = n->lhs->lhs->type;
|
||||
Type *elemu = (elemt && elemt->kind == TY_NAMED)
|
||||
? elemt->under : elemt;
|
||||
Type *elemu = type_chase_named(elemt);
|
||||
Type *struct_t = NULL;
|
||||
int viaptr = 0;
|
||||
if (elemu && elemu->kind == TY_PTR) {
|
||||
Type *inner = elemu->sub;
|
||||
if (inner && inner->kind == TY_NAMED)
|
||||
inner = inner->under;
|
||||
Type *inner = type_chase_named(elemu->sub);
|
||||
if (inner && inner->kind == TY_STRUCT) {
|
||||
struct_t = inner;
|
||||
viaptr = 1;
|
||||
@@ -5048,8 +5040,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
n->lhs->str) == 0)
|
||||
{ f = fl; break; }
|
||||
Type *bt = idxbase->type;
|
||||
Type *bu = (bt && bt->kind == TY_NAMED)
|
||||
? bt->under : bt;
|
||||
Type *bu = type_chase_named(bt);
|
||||
int is_arr = bu && bu->kind == TY_ARRAY;
|
||||
int is_sl = bu && bu->kind == TY_SLICE;
|
||||
int is_ptr = bu && bu->kind == TY_PTR;
|
||||
@@ -5933,8 +5924,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
int elem_is_str = eff && eff->sub && type_isstr(eff->sub);
|
||||
int elem_is_slice = eff && eff->sub && type_isslice(eff->sub);
|
||||
Type *esub = eff ? eff->sub : NULL;
|
||||
Type *esubu = (esub && esub->kind == TY_NAMED)
|
||||
? esub->under : esub;
|
||||
Type *esubu = type_chase_named(esub);
|
||||
int elem_tagged = esubu && esubu->kind == TY_TAGGED;
|
||||
/* Tagged-union element: route widening through a
|
||||
* scratch slot, then copy slot bytes to &arr[i].
|
||||
@@ -10940,10 +10930,9 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
* field. (Surfaced building ww-w6l.) */
|
||||
if (n->lhs->kind == N_DOT) {
|
||||
Type *lt = n->lhs->type;
|
||||
Type *lu = (lt && lt->kind == TY_NAMED) ? lt->under : lt;
|
||||
Type *lu = type_chase_named(lt);
|
||||
if (lu && lu->kind == TY_PTR && lu->sub) {
|
||||
Type *inner = lu->sub;
|
||||
if (inner->kind == TY_NAMED) inner = inner->under;
|
||||
Type *inner = type_chase_named(lu->sub);
|
||||
if (inner && inner->kind == TY_STRUCT) {
|
||||
for (Tfield *f = inner->fields; f; f = f->next) {
|
||||
if (strcmp(f->name, n->str) != 0) continue;
|
||||
@@ -11032,14 +11021,11 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
&& n->lhs->lhs->kind == N_IDENT) {
|
||||
Node *idxbase = n->lhs->lhs;
|
||||
Type *elemt = n->lhs->type;
|
||||
Type *elemu = (elemt && elemt->kind == TY_NAMED)
|
||||
? elemt->under : elemt;
|
||||
Type *elemu = type_chase_named(elemt);
|
||||
Type *struct_t = NULL;
|
||||
int viaptr = 0;
|
||||
if (elemu && elemu->kind == TY_PTR) {
|
||||
Type *inner = elemu->sub;
|
||||
if (inner && inner->kind == TY_NAMED)
|
||||
inner = inner->under;
|
||||
Type *inner = type_chase_named(elemu->sub);
|
||||
if (inner && inner->kind == TY_STRUCT) {
|
||||
struct_t = inner;
|
||||
viaptr = 1;
|
||||
@@ -11053,8 +11039,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
if (strcmp(fl->name, n->str) == 0)
|
||||
{ f = fl; break; }
|
||||
Type *bt = idxbase->type;
|
||||
Type *bu = (bt && bt->kind == TY_NAMED)
|
||||
? bt->under : bt;
|
||||
Type *bu = type_chase_named(bt);
|
||||
int is_arr = bu && bu->kind == TY_ARRAY;
|
||||
int is_sl = bu && bu->kind == TY_SLICE;
|
||||
int is_ptr = bu && bu->kind == TY_PTR;
|
||||
@@ -11271,8 +11256,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
int esz = 1;
|
||||
if (eff && eff->sub) esz = (int)eff->sub->size;
|
||||
Type *esub = eff ? eff->sub : NULL;
|
||||
Type *esubu = (esub && esub->kind == TY_NAMED)
|
||||
? esub->under : esub;
|
||||
Type *esubu = type_chase_named(esub);
|
||||
int elem_tagged = esubu && esubu->kind == TY_TAGGED;
|
||||
|
||||
if (n->lhs->kind == N_IDENT && u) {
|
||||
|
||||
Reference in New Issue
Block a user