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:
2026-06-01 05:04:46 +09:00
parent 9cf1560392
commit 954badd28f
8 changed files with 58 additions and 152 deletions

View File

@@ -117,7 +117,7 @@ static const struct row rows[] = {
" return 42;\n"
"};\n",
42,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintln_file_multi",
"package main;\n"
"import os;\n"
@@ -145,7 +145,7 @@ static const struct row rows[] = {
" return 43;\n"
"};\n",
43,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprint_file_raw",
"package main;\n"
"import os;\n"
@@ -173,7 +173,7 @@ static const struct row rows[] = {
" return 44;\n"
"};\n",
44,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "branched_fprintf",
"package main;\n"
"import os;\n"
@@ -206,7 +206,7 @@ static const struct row rows[] = {
" return 45;\n"
"};\n",
45,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintf_stream",
"package main;\n"
"import os;\n"
@@ -230,7 +230,7 @@ static const struct row rows[] = {
" return 46;\n"
"};\n",
46,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
};
static int
@@ -357,7 +357,6 @@ main(void)
int total = 0, fail = 0;
int wwpresent = (access(wdrv, X_OK) == 0);
int seq = 0;
(void)asm_byte_identical; /* cstage-only until #226/#227 land */
for (int i = 0; i < n; i++) {
if (rows[i].stage_mask & STAGE_CS) {

View File

@@ -115,7 +115,7 @@ static const struct row rows[] = {
" return 50;\n"
"};\n",
50,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "precision",
"package main;\n"
"import os;\n"
@@ -143,7 +143,7 @@ static const struct row rows[] = {
" return 51;\n"
"};\n",
51,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "base_hex",
"package main;\n"
"import os;\n"
@@ -171,7 +171,7 @@ static const struct row rows[] = {
" return 52;\n"
"};\n",
52,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "sign_plus",
"package main;\n"
"import os;\n"
@@ -199,7 +199,7 @@ static const struct row rows[] = {
" return 53;\n"
"};\n",
53,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "zero_pad",
"package main;\n"
"import os;\n"
@@ -227,7 +227,7 @@ static const struct row rows[] = {
" return 54;\n"
"};\n",
54,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
};
static int

View File

@@ -125,7 +125,7 @@ static const struct row rows[] = {
" return 60;\n"
"};\n",
60,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintfln_file_fmt",
"package main;\n"
"import os;\n"
@@ -153,7 +153,7 @@ static const struct row rows[] = {
" return 61;\n"
"};\n",
61,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintln_basic",
"package main;\n"
"import os;\n"
@@ -180,7 +180,7 @@ static const struct row rows[] = {
" return 64;\n"
"};\n",
64,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "fprintfln_basic",
"package main;\n"
"import os;\n"
@@ -205,7 +205,7 @@ static const struct row rows[] = {
" return 65;\n"
"};\n",
65,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "bsprintf_basic",
"package main;\n"
"import os;\n"
@@ -226,7 +226,7 @@ static const struct row rows[] = {
" return 62;\n"
"};\n",
62,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
{ "asprintf_basic",
"package main;\n"
"import os;\n"
@@ -242,7 +242,7 @@ static const struct row rows[] = {
" return 63;\n"
"};\n",
63,
STAGE_CS, 0 },
STAGE_CS | STAGE_WW, 1 },
};
static int