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:
@@ -491,13 +491,6 @@ type cgen = struct {
|
||||
yieldbuf: []str, // stack of match end labels for yield
|
||||
defertop: i32,
|
||||
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
|
||||
// so two variadic callsites with different arities in one fn
|
||||
// get distinct slots (the shared slot fail-louds under #15's
|
||||
// @-prefix grow-on-pin discipline).
|
||||
varargseq: i32,
|
||||
// System V AMD64 sret discipline (#23). Plain TY_STRUCT returns
|
||||
// with size > 24B are passed via a hidden first-arg pointer
|
||||
// (RDI) to a caller-prealloc dest; the callee writes through
|
||||
@@ -547,7 +540,6 @@ fn cgeninit(c: *cgen) void = {
|
||||
c.frame = 0;
|
||||
c.lastwasreturn = 0;
|
||||
c.labelseq = 0;
|
||||
c.varargseq = 0;
|
||||
c.sretdestoff = 0;
|
||||
c.sretdestnode = nil;
|
||||
c.sretforward = 0;
|
||||
|
||||
Reference in New Issue
Block a user