selfhost: retire stk[i].str spill workaround (closes #14)

End-to-end validation of #8: removed the task-#8 spill in
dotchainresolve; bootstrap ww2==ww3==ww4 still holds.
This commit is contained in:
2026-05-13 23:52:39 +09:00
parent 9ef9bef340
commit dd92938eff
3 changed files with 6 additions and 36 deletions

View File

@@ -2402,7 +2402,6 @@ export fn dotchainresolve(c: *cgen, n: *node, out: *dotchain) bool = {
// bootstrap fixed-point (tests 993/995) — letting these locals get
// declared inside the branch bodies trips a per-stage divergence in
// slot counting.
let stepnd: *node = nil;
let stepnm: str = "";
let fi: *fieldinfo = nil;
let found: *fieldinfo = nil;
@@ -2414,17 +2413,8 @@ export fn dotchainresolve(c: *cgen, n: *node, out: *dotchain) bool = {
for (i >= 0) {
let csi: *structinfo = structlookup(c, curstruct);
if (csi == nil) { return false; };
// Spill `stk[i]` to a *node local before reading its `.str`.
// Task #8 closed the cgen bug behind this — cstage's N_DOT
// had no N_INDEX-lhs branch and fell through, returning the
// (AX, BX) cgindex shape as if it were the field. The fix
// lives in cmd/w6c/cgen.c N_DOT and the mirror in this
// module's cgenexpr.ww cgdot. The spill stays for now (Pike
// rule — workaround retirement is task #14), so cstage
// compiling this source emits byte-identical asm to wwstage.
stepnd = stk[i];
if (stepnd == nil) { return false; };
stepnm = stepnd.str;
if (stk[i] == nil) { return false; };
stepnm = stk[i].str;
fi = csi.fields;
found = nil;
for (fi != nil) {