From 7bbee3005ab28a5999de0196f68ea07e99f18285 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Thu, 4 Jun 2026 04:56:27 +0900 Subject: [PATCH] selfhost: unstale the localadd @-prefix doc for the #44 size-keyed tagscr (#44 review) The header still cited cstage's retired cg_tagscr single cache and listed the scratch by its pre-#44 name; the grow-fatal mechanism doc stays (it still guards @retscr et al.) with a pointer to how #44 sidesteps it for the tagged scratch. --- selfhost/cmd/w6c/main.combined.ww | 9 +++++---- selfhost/cmd/wcc/cgen.ww | 9 +++++---- selfhost/cmd/wwdump/main.combined.ww | 9 +++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index d402bfc0..38ac9b8d 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -33246,16 +33246,17 @@ fn localadd(c: *cgen, name: str, sz: i32, tnode: *node) i32 = { // would force a later outer `let a: [128]u8` onto the 8B slot, // and `a[127]` would write at +119(BP), past the saved RIP. // - // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, + // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, // `@sretarg`, `@sretscr`, `@match_spill`, `@vararg_*`) share // one slot per name per fn. Post #15/#26c the slot is sized // at first use and reused by every later caller; a later // caller asking for a larger slot than the first allocation // pinned fatals (rule 7 — surface, don't silently corrupt // the frame: the pinned offset already neighbours other - // locals so the slot can't grow in place). Mirrors cstage's - // cg_tagscr / cg_retscr / cg_sretscr same-fn caches in - // cmd/w6c/cgen.c (#26 / #15). + // locals so the slot can't grow in place; #44 sidesteps the + // fatal for the tagged scratch by keying its NAME by size). + // Mirrors cstage's cg_tagscr_slot table / cg_retscr / + // cg_sretscr same-fn caches in cmd/w6c/cgen.c (#26 / #15 / #44). if (name.len > 0) { if (name[0] == '@') { let asz: i32 = sz; diff --git a/selfhost/cmd/wcc/cgen.ww b/selfhost/cmd/wcc/cgen.ww index 506c17e7..1f14194c 100644 --- a/selfhost/cmd/wcc/cgen.ww +++ b/selfhost/cmd/wcc/cgen.ww @@ -603,16 +603,17 @@ fn localadd(c: *cgen, name: str, sz: i32, tnode: *node) i32 = { // would force a later outer `let a: [128]u8` onto the 8B slot, // and `a[127]` would write at +119(BP), past the saved RIP. // - // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, + // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, // `@sretarg`, `@sretscr`, `@match_spill`, `@vararg_*`) share // one slot per name per fn. Post #15/#26c the slot is sized // at first use and reused by every later caller; a later // caller asking for a larger slot than the first allocation // pinned fatals (rule 7 — surface, don't silently corrupt // the frame: the pinned offset already neighbours other - // locals so the slot can't grow in place). Mirrors cstage's - // cg_tagscr / cg_retscr / cg_sretscr same-fn caches in - // cmd/w6c/cgen.c (#26 / #15). + // locals so the slot can't grow in place; #44 sidesteps the + // fatal for the tagged scratch by keying its NAME by size). + // Mirrors cstage's cg_tagscr_slot table / cg_retscr / + // cg_sretscr same-fn caches in cmd/w6c/cgen.c (#26 / #15 / #44). if (name.len > 0) { if (name[0] == '@') { let asz: i32 = sz; diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 23a7a90a..91721e52 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -33246,16 +33246,17 @@ fn localadd(c: *cgen, name: str, sz: i32, tnode: *node) i32 = { // would force a later outer `let a: [128]u8` onto the 8B slot, // and `a[127]` would write at +119(BP), past the saved RIP. // - // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, + // `@`-prefix scratch slots (`@tagscr`, `@retscr`, `@tagbase`, // `@sretarg`, `@sretscr`, `@match_spill`, `@vararg_*`) share // one slot per name per fn. Post #15/#26c the slot is sized // at first use and reused by every later caller; a later // caller asking for a larger slot than the first allocation // pinned fatals (rule 7 — surface, don't silently corrupt // the frame: the pinned offset already neighbours other - // locals so the slot can't grow in place). Mirrors cstage's - // cg_tagscr / cg_retscr / cg_sretscr same-fn caches in - // cmd/w6c/cgen.c (#26 / #15). + // locals so the slot can't grow in place; #44 sidesteps the + // fatal for the tagged scratch by keying its NAME by size). + // Mirrors cstage's cg_tagscr_slot table / cg_retscr / + // cg_sretscr same-fn caches in cmd/w6c/cgen.c (#26 / #15 / #44). if (name.len > 0) { if (name[0] == '@') { let asz: i32 = sz;