wcc: converge let-IDENT memcpy, IDENT-assign recv, nested struct call-recv onto structabisize

Three more wwstage cgen sites still used unrounded structnaturalsize where
cstage rounds via lu->size — pre-existing gate-blind cs!=ww latents the #169b
reviewer surfaced: cgenstmt N_LET struct-IDENT memcpy (let p2: T = p1; twin
cgen.c:7869), cgenexpr N_ASSIGN N_IDENT-lhs register RECV (s = mk(); twin
cgen.c:4700-4737), and cgenutil's nested struct N_CALL recv inside
cgstructlitfill (twin cgen.c:2121).

Converge all three onto structabisize, completing the same-class closure
started by #169 and continued by #169b. Also corrected the inline comment at
cgenutil.ww:3273-3286 that wrongly claimed fl->type->size was natural
(check.c:760 sets ABI). sretretsize at cgenutil.ww:1301 is gate-equivalent
natural and is left alone.

Probe 698 +3 rows (one per converged site) with cs==ww .s byte-cmp and a
pre-fix-rebuild discriminator. 990-997 byte-id hold.
This commit is contained in:
2026-05-28 14:07:58 +09:00
parent 39f9267bc9
commit 66a91c8969
6 changed files with 142 additions and 60 deletions

View File

@@ -1358,8 +1358,8 @@ fn cglet(c: *cgen, n: *node) void = {
// Struct ident copy: `let p2: T = p1;` where T is a struct
// >8B and rhs is a local ident. Per-qword MOVQ from src
// slot to dst slot, with a sized tail (MOVL/MOVB) for
// natural sizes that aren't 8-aligned (e.g. `struct
// { i32, i32, i32 }` is 12B). Pre-fix this path fell
// ABI sizes that aren't 8-aligned (e.g. `struct
// { i32, i32, i32 }`, maxalign 4 → ABI 12B). Pre-fix this path fell
// through to `cgexpr + MOVQ AX, off(BP)` which stored
// only the first qword (and a stale BX for sz==16 lets
// via the str-init tail) — silent partial copy. Mirrors
@@ -1373,7 +1373,13 @@ fn cglet(c: *cgen, n: *node) void = {
if (sname.len > 0) {
let lsi: *structinfo = structlookup(c, sname);
if (lsi != nil) {
let lsz: i32 = structnaturalsize(lsi);
// memcpy run sizes on the maxalign-rounded ABI
// size — cstage N_LET sets sz = lu->size
// (cgen.c:7533, struct-IDENT branch :7869),
// check.c:760 SSoT. structnaturalsize would
// short struct{i64,i32} (natural 12, ABI 16)
// to MOVQ+MOVL where cstage writes MOVQ+MOVQ.
let lsz: i32 = structabisize(lsi);
if (lsz > 8) {
let lc: *local = localfindnode(c, rhs.str);
if (lc != nil) {