wwstage: copy full tagged-element slot for N_DOT/N_INDEX-base index read (#261)
The #259 store fix unmasked a pre-existing latent cs!=ww in the tagged- element READ via an N_DOT base (`x.o[i]`) / chained N_INDEX base (`m[i][j]`): wwstage materialized the element as a SCALAR one-word load + zeroed tag where cstage copies the full tagged slot — silently dropping the tag/payload-high word (wrong variant). Three sites all keyed off the same N_IDENT-only gate; cstage classifies TY_TAGGED for ANY base off the checker-stamped element type. Align wwstage UP: - cgindex (cgenexpr.ww): the N_DOT/N_INDEX-base arm now sets elem_tagged/elem_slot_sz from n.type_ (the stamped element tinfo), mirroring cstage cgen.c:8101 — the full-slot copy arms then fire. - rhstaggedabicall (cgenutil.ww): the N_INDEX branch reads typeistagged(src.type_) for any base instead of an N_IDENT-only structural lookup, mirroring cstage's src->type keying — fixes the let-init / call-arg widen-source spill. - forwardtagged (cgenstmt.ww): the return-path passthrough gate now accepts N_INDEX/N_DOT tagged rhs (which cgexpr materializes into the tagged ABI), not just N_CALL — fixes `return x.o[i]`. read + call-arg + return + chained 2D all close by construction (one materialization path). cstage unchanged (pure wwstage-align-up). 949 gains 9 #261 rows (i32 + explicit-void variant per shape proves the tag survives) and flips the two #259 read-back rows to byteid=1.
This commit is contained in:
@@ -1272,6 +1272,25 @@ fn cgindex(c: *cgen, n: *node) void = {
|
||||
elemisstr = isstrtype(c, etn);
|
||||
elemisslice = isslicetype(c, etn);
|
||||
};
|
||||
// N_DOT / N_INDEX base (`x.o[i]`, chained `m[i][j]`): the
|
||||
// element tinfo is n.type_ (the checker-stamped indexresult),
|
||||
// same source the esz/str/slice/float flags read above. Mirror
|
||||
// cstage cgen.c:8101 `esubu->kind == TY_TAGGED` — classified for
|
||||
// ANY base, NOT gated on N_IDENT, and NOT excluding the nullable
|
||||
// fold (slot_sz=8 degrades the copy arm to one MOVQ, matching
|
||||
// cstage's fallback `MOVQ AX,BX; MOVQ (BX),AX`). #261: without
|
||||
// this an N_DOT-base tagged element fell to the scalar
|
||||
// loadopsz path and silently dropped the tag/payload-high word.
|
||||
if (base.kind == nkind.N_DOT || base.kind == nkind.N_INDEX) {
|
||||
let dt: *tinfo = n.type_: *tinfo;
|
||||
if (dt != nil) {
|
||||
if (typeistagged(dt)) {
|
||||
elem_tagged = true;
|
||||
elem_slot_sz = dt.size: i32;
|
||||
esz = elem_slot_sz;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
cgexpr(c, idx);
|
||||
if (esz > 1) {
|
||||
|
||||
Reference in New Issue
Block a user