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.
This commit is contained in:
2026-06-04 04:56:27 +09:00
parent b3d6bc4420
commit 7bbee3005a
3 changed files with 15 additions and 12 deletions

View File

@@ -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<sz>`, `@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;

View File

@@ -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<sz>`, `@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;

View File

@@ -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<sz>`, `@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;