diff --git a/selfhost/cmd/w6c/main.combined.ww b/selfhost/cmd/w6c/main.combined.ww index 84c1ef0e..e3a3c137 100644 --- a/selfhost/cmd/w6c/main.combined.ww +++ b/selfhost/cmd/w6c/main.combined.ww @@ -21544,12 +21544,12 @@ type cgen = struct { // before walking the body. fnret: *node, // declared return type of current fn (or nil) looptop: i32, - loopendbuf: *str, // stack of end labels for break - loopcontbuf: *str, // stack of cont labels for continue + loopendbuf: []str, // stack of end labels for break + loopcontbuf: []str, // stack of cont labels for continue yieldtop: i32, - yieldbuf: *str, // stack of match end labels for yield + yieldbuf: []str, // stack of match end labels for yield defertop: i32, - deferbuf: **node, // stack of deferred exprs (LIFO at return) + deferbuf: []*node, // stack of deferred exprs (LIFO at return) // Variadic-call gather state. cgcall bumps this on each gather // emit and uses it to mint `@vararg_d_N` / `@vararg_sl_N` per // callsite; mirrors cstage's mklabel("vararg_d/sl") freshness @@ -21609,16 +21609,16 @@ fn cgeninit(c: *cgen, a: *arena) void = { // persist across cgfn calls within one file. cgfile resets them // at the start of each compilation unit. c.looptop = 0; - // #35: per-slot stride is sizeof(str); the bare 16 is the str=16 - // width and undershoots under str=24, so indices past (LOOP_MAX*16)/24 - // = 10 would spill into the next amalloc. Bumped to 24/slot; +8/slot - // over-alloc under str=16 is harmless under the bump arena. - c.loopendbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; - c.loopcontbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let loopendbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopendbuf = loopendbuf; + let loopcontbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopcontbuf = loopcontbuf; c.yieldtop = 0; - c.yieldbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let yieldbuf: []str = alloc([], LOOP_MAX: u64)!; + c.yieldbuf = yieldbuf; c.defertop = 0; - c.deferbuf = amalloc(a, (DEFER_MAX: u64) * 8u64): **node; + let deferbuf: []*node = alloc([], DEFER_MAX: u64)!; + c.deferbuf = deferbuf; }; // localalloc — append a slot for `name` without dedup. Used for diff --git a/selfhost/cmd/wcc/cgen.ww b/selfhost/cmd/wcc/cgen.ww index f98c2d36..d9cf57a5 100644 --- a/selfhost/cmd/wcc/cgen.ww +++ b/selfhost/cmd/wcc/cgen.ww @@ -469,12 +469,12 @@ type cgen = struct { // before walking the body. fnret: *node, // declared return type of current fn (or nil) looptop: i32, - loopendbuf: *str, // stack of end labels for break - loopcontbuf: *str, // stack of cont labels for continue + loopendbuf: []str, // stack of end labels for break + loopcontbuf: []str, // stack of cont labels for continue yieldtop: i32, - yieldbuf: *str, // stack of match end labels for yield + yieldbuf: []str, // stack of match end labels for yield defertop: i32, - deferbuf: **node, // stack of deferred exprs (LIFO at return) + deferbuf: []*node, // stack of deferred exprs (LIFO at return) // Variadic-call gather state. cgcall bumps this on each gather // emit and uses it to mint `@vararg_d_N` / `@vararg_sl_N` per // callsite; mirrors cstage's mklabel("vararg_d/sl") freshness @@ -534,16 +534,16 @@ fn cgeninit(c: *cgen, a: *arena) void = { // persist across cgfn calls within one file. cgfile resets them // at the start of each compilation unit. c.looptop = 0; - // #35: per-slot stride is sizeof(str); the bare 16 is the str=16 - // width and undershoots under str=24, so indices past (LOOP_MAX*16)/24 - // = 10 would spill into the next amalloc. Bumped to 24/slot; +8/slot - // over-alloc under str=16 is harmless under the bump arena. - c.loopendbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; - c.loopcontbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let loopendbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopendbuf = loopendbuf; + let loopcontbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopcontbuf = loopcontbuf; c.yieldtop = 0; - c.yieldbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let yieldbuf: []str = alloc([], LOOP_MAX: u64)!; + c.yieldbuf = yieldbuf; c.defertop = 0; - c.deferbuf = amalloc(a, (DEFER_MAX: u64) * 8u64): **node; + let deferbuf: []*node = alloc([], DEFER_MAX: u64)!; + c.deferbuf = deferbuf; }; // localalloc — append a slot for `name` without dedup. Used for diff --git a/selfhost/cmd/wwdump/main.combined.ww b/selfhost/cmd/wwdump/main.combined.ww index 89df55d7..34c8323f 100644 --- a/selfhost/cmd/wwdump/main.combined.ww +++ b/selfhost/cmd/wwdump/main.combined.ww @@ -21544,12 +21544,12 @@ type cgen = struct { // before walking the body. fnret: *node, // declared return type of current fn (or nil) looptop: i32, - loopendbuf: *str, // stack of end labels for break - loopcontbuf: *str, // stack of cont labels for continue + loopendbuf: []str, // stack of end labels for break + loopcontbuf: []str, // stack of cont labels for continue yieldtop: i32, - yieldbuf: *str, // stack of match end labels for yield + yieldbuf: []str, // stack of match end labels for yield defertop: i32, - deferbuf: **node, // stack of deferred exprs (LIFO at return) + deferbuf: []*node, // stack of deferred exprs (LIFO at return) // Variadic-call gather state. cgcall bumps this on each gather // emit and uses it to mint `@vararg_d_N` / `@vararg_sl_N` per // callsite; mirrors cstage's mklabel("vararg_d/sl") freshness @@ -21609,16 +21609,16 @@ fn cgeninit(c: *cgen, a: *arena) void = { // persist across cgfn calls within one file. cgfile resets them // at the start of each compilation unit. c.looptop = 0; - // #35: per-slot stride is sizeof(str); the bare 16 is the str=16 - // width and undershoots under str=24, so indices past (LOOP_MAX*16)/24 - // = 10 would spill into the next amalloc. Bumped to 24/slot; +8/slot - // over-alloc under str=16 is harmless under the bump arena. - c.loopendbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; - c.loopcontbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let loopendbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopendbuf = loopendbuf; + let loopcontbuf: []str = alloc([], LOOP_MAX: u64)!; + c.loopcontbuf = loopcontbuf; c.yieldtop = 0; - c.yieldbuf = amalloc(a, (LOOP_MAX: u64) * 24u64): *str; + let yieldbuf: []str = alloc([], LOOP_MAX: u64)!; + c.yieldbuf = yieldbuf; c.defertop = 0; - c.deferbuf = amalloc(a, (DEFER_MAX: u64) * 8u64): **node; + let deferbuf: []*node = alloc([], DEFER_MAX: u64)!; + c.deferbuf = deferbuf; }; // localalloc — append a slot for `name` without dedup. Used for