cgen: B5-c3 #89 cgreturn return-position widen — rt/vu chase, trace-first
Trace at the c2 tip (rebuilt binaries, #80-c4 form): ret_widen's mk()
emitted `MOVQ -16(BP),AX / MOVQ AX,DX / MOVQ $0,CX` — the scalar
shuffle arm, payload word 1 ZEROED (s.b/e.aux dropped, cs silent
exit 1). Deciding predicate: the vu single peel left an alias struct
source TY_NAMED → isstruct false → scalar arm. The rt single peel was
the succ half: a 2-LEVEL alias return type stayed NAMED → the whole
tagged-return block was skipped → no tag synthesis at any return
(kb5_succ's three paired return-position insertions). Fix = the three
granted peels (bare-return rt, value-return rt, vu) →
type_chase_named; the route predicates (istagged/isstruct/istuple/
passthrough) key on the chased vu. Raw `->under` in cgen.c 62→59.
#89 CLOSES.
TRAIN INVARIANT holds: cs-only; _ww binaries bit-identical to the
bcd948d baseline md5s. cs movers vs the c2 tip bounded to EXACTLY the
return-route family: ret_widen, kb4_xret, kna_ret_errunion, kb5_succ.
Zero ww movers; detectors pinned (kb4_xampdef stays 139/139 #94;
def93/x93/l2_local stay cs-SEGV — c4's targets; fill/tuparg/v2
families unchanged).
Graduations (cs1/ww0 BYTE-DIVERGE → 0/0 BYTE-ID): g89_ret_widen (the
banked spelling), g89_ret_errunion (the live e.aux truncation seed),
and succ_2lvl flips K_RUN_NOID → K_RUN exactly as C1-CORR-1 predicted
(pins-follow-the-layer). g89_ret_named_ctl (bare NAMED control) held
0/0 byte-id throughout.
944_alias_cgen_b5_run 25→28 rows (75 checks); 944 family green;
sizelint 0.
This commit is contained in:
@@ -12243,8 +12243,7 @@ cgstmt(Cg *c, Node *n, Local **locals, int *frame)
|
||||
* is producing the void variant. Emit its tag; the payload is
|
||||
* undefined (void has size 0). */
|
||||
if (n->lhs == NULL && cg_ret_type) {
|
||||
Type *rt = cg_ret_type;
|
||||
if (rt->kind == TY_NAMED) rt = rt->under;
|
||||
Type *rt = type_chase_named(cg_ret_type);
|
||||
if (rt && rt->kind == TY_TAGGED) {
|
||||
/* #38b: an sret-classified tagged return (slot
|
||||
* > the AX/DX/CX/R8 cursor) writes the void-
|
||||
@@ -12283,12 +12282,18 @@ cgstmt(Cg *c, Node *n, Local **locals, int *frame)
|
||||
}
|
||||
}
|
||||
if (n->lhs && cg_ret_type) {
|
||||
Type *rt = cg_ret_type;
|
||||
if (rt->kind == TY_NAMED) rt = rt->under;
|
||||
/* #89: the single peel left a 2-level alias return
|
||||
* type NAMED (rt — the whole tagged block skipped, no
|
||||
* tag synthesis) and an alias struct source NAMED (vu
|
||||
* — isstruct missed, the scalar arm shuffled word0
|
||||
* into DX and ZEROED the rest of the payload). Both
|
||||
* silent; ww routes via rhsstructpayload→
|
||||
* structlookupchain since B2-c2 and is the runtime-
|
||||
* correct reference. */
|
||||
Type *rt = type_chase_named(cg_ret_type);
|
||||
if (rt && rt->kind == TY_TAGGED) {
|
||||
Type *vt = n->lhs->type;
|
||||
Type *vu = (vt && vt->kind == TY_NAMED)
|
||||
? vt->under : vt;
|
||||
Type *vu = type_chase_named(vt);
|
||||
int istagged = vu && vu->kind == TY_TAGGED;
|
||||
/* #263: passthrough forwards the source's AX/DX/CX
|
||||
* unchanged — correct ONLY when the source already
|
||||
|
||||
Reference in New Issue
Block a user