wwstage: name vararg-gather slots via mklabel; graduate fmt 777/780/781 (#227)
wwstage named variadic-gather slots with mkvarargname off a separate varargseq counter, never bumping the shared labelseq that names match labels. cstage names them via mklabel (cmd/w6c/cgen.c:5427,5431), which advances labelseq twice per gather. So by the time main.main reached its `match (wr)`, wwstage's match-label counter ran two behind cstage's (_4/_5/_6 vs _6/_7/_8) — a pure label-numbering divergence that kept fmt cs/ww byte-id failing. Drop varargseq and the mkvarargname helper; call the existing mklabel for the two gather slots, matching cstage's order (vararg_d only when nvar>0, vararg_sl always). The slot names are locals-table keys only — they resolve to BP offsets and never reach the asm — so only the labelseq advance is observable, which is exactly what realigns the downstream match labels. cstage untouched (align wwstage up). This was the match-label half of fmt's divergence; with the earlier compound-assign fix it completes fmt byte-identity. Graduate 777/780/781 to STAGE_CS|STAGE_WW with byte_id, and drop the now-stale (void)asm_byte_identical guard in 777.
This commit is contained in:
@@ -86,34 +86,6 @@ fn callee_variadic_param(c: *cgen, callee: *node, nfixed_out: *i32) *node = {
|
||||
return findvariadicparam(ps, nfixed_out);
|
||||
};
|
||||
|
||||
// mkvarargname — fresh local-slot name "<prefix><seq>". Used for
|
||||
// the per-variadic-call scratch buffers (`@vararg_d_N` for the
|
||||
// element-data buffer, `@vararg_sl_N` for the 24B slice descriptor).
|
||||
// N is recorded on the N_CALL node at first emit so re-entry into
|
||||
// cgcall picks the same names regardless of walk order.
|
||||
fn mkvarargname(c: *cgen, prefix: str, seq: i32) str = {
|
||||
let buf: [128]u8;
|
||||
let i: i32 = 0;
|
||||
let j: i32 = 0;
|
||||
for (j < prefix.len) {
|
||||
buf[i] = prefix[j];
|
||||
i += 1; j += 1;
|
||||
};
|
||||
let ns: str = strconv.i64tos(seq: i64, strconv.base.DEC);
|
||||
let n: i32 = ns.len;
|
||||
let dk: i32 = 0;
|
||||
for (dk < n) { buf[i + dk] = ns.ptr[dk]; dk += 1; };
|
||||
let total: i32 = i + n;
|
||||
let p: []u8 = alloc([], (total: u64) + 1u64)!;
|
||||
let k: i32 = 0;
|
||||
for (k < total) { p[k] = buf[k]; k += 1; };
|
||||
p[total] = 0u8;
|
||||
let r: str;
|
||||
r.ptr = p.ptr;
|
||||
r.len = total;
|
||||
return r;
|
||||
};
|
||||
|
||||
// ---- expression cgen -------------------------------------------------
|
||||
|
||||
// pushargsrev — recursively walks the arg list, evaluates rightmost
|
||||
|
||||
Reference in New Issue
Block a user