selfhost: retire dotchain bundle workaround (closes #17)

dotchain struct + bundle pre-declares retired. dotchainresolve now
takes 6 direct out-params; per-iter locals declared inline. Bootstrap
ww2==ww3==ww4 byte-identical — end-to-end validation of session's
N_DOT / N_INDEX / TK_AMP / fldloadop fixes.

i64 widths retained on out-params via task #19 workaround (i32 deref-
stores leave caller slot upper 4B stale, MOVQ reads zero-extend to
garbage). Documented in selfhost/CLAUDE.md active-workarounds.
This commit is contained in:
2026-05-14 01:11:07 +09:00
parent f26c86f5b7
commit 5f87c60e6c
6 changed files with 383 additions and 417 deletions

View File

@@ -175,6 +175,27 @@ static const struct row rows[] = {
" return 0;\n"
"};\n",
42 },
/* Task #19 pin (widen-deref). Natural shape `fn f(p: *i32)`
* with `*p = -16i32` lowers to MOVL (4B store) into the
* caller's 8B slot. The caller's slot was zero-init via MOVQ,
* so the upper 4B stay zero; a later i64-widening read emits
* MOVQ (8B raw) and returns 0x00000000_FFFFFFF0 = 4294967280
* instead of -16. Surfaced inside dotchainresolve when
* worker-retire-dotchain tried i32 out-params; the helper now
* widens all numeric out-params to *i64 as a workaround until
* #19 lands. This row pins the WORKAROUND: out-param typed
* *i64, caller reads i64 → MOVQ store/load pair agree, -16
* round-trips intact. When #19 lands, add a sibling row that
* exercises the natural `*p: *i32` shape and expects -16. */
{ "i64_out_param_neg_widen_deref_workaround",
"fn setneg(p: *i64) void = { *p = -16i64; };\n"
"fn main() i32 = {\n"
" let x: i64 = 0i64;\n"
" setneg(&x);\n"
" if (x == -16i64) { return 42; };\n"
" return 0;\n"
"};\n",
42 },
};
static int