w6c+w6c_ww: size-keyed @tagscr — one tagged scratch per slot size (fix #44)
A fn mixing two tagged slot sizes smaller-first (regex compile(): 56B append-element widen then 64B sret return) hit the #15/#26c rule-7 grow-fatal — the single shared per-fn @tagscr is first-use-sized and its pinned offset can't grow. Key the scratch by slot size instead: @tagscr<sz>, one first-use-allocated slot per distinct size, all three sites (widen-store via_outer, widen-push, N_INDEX tagged-element assign) funnelled through cg_tagscr_slot / tagscradd in both stages. Single-size fns emit byte-identical asm to pre-fix (control row pinned + hand-cmp'd vs master w6c). 736's tagscr_size_grow_fatal fixture pinned the now-unreachable fatal; converted to a byte-id succ row. Runtime rows live in 926_tagscr_sizes_run.
This commit is contained in:
@@ -5679,13 +5679,13 @@ fn cgassign(c: *cgen, n: *node) void = {
|
||||
// scratch slot via cgwidentaggedstore (handles struct /
|
||||
// str / scalar / subset / nullable variants uniformly),
|
||||
// then compute &arr[i] and byte-copy. The scratch
|
||||
// (@tagscr) is reused across all tagged-arr stores in
|
||||
// the function; first-use sizes the slot (#15/#26c).
|
||||
// (@tagscr<sz>) is reused across all same-size tagged-arr
|
||||
// stores in the function; first-use sizes the slot
|
||||
// (#15/#26c, size-keyed by #44).
|
||||
if (elemtn != nil) {
|
||||
if (istaggedtype(c, elemtn)) {
|
||||
let slot_sz: i32 = slotsize(c, elemtn);
|
||||
let scroff: i32 = localadd(c, "@tagscr",
|
||||
slot_sz, nil);
|
||||
let scroff: i32 = tagscradd(c, slot_sz);
|
||||
// Pre-zero scratch (matches push helper).
|
||||
emitline("\tXORQ\tAX, AX\n");
|
||||
let zz: i32 = 0;
|
||||
|
||||
Reference in New Issue
Block a user