wcc+w6c+w6c_ww: global tuple lets — DATA emit + element reads + len(g.N) (C-t3, #48)
Global tuple lets were WHOLLY unwired, silently: let_emit_size returned 0 so emit_lets SKIPPED the definition (no DATA, no diagnostic), then cstage's t.N read and #235 len arm read BP-frame garbage (localfind→0) while wwstage — with the tuple never in collectlets — mis-emitted the field index as a symbol (`MOVQ 0(SB), AX`). ken's #48 was the len() facet of this. Now: let_emit_size/letemitsize admit TY_TUPLE (slot-sum size, rides C-t0); emit_tuple_data/emittupledata lay the slot-format DATAW row — a scalar element one 8B LE word, a str element its 24B header slot with a DATAR ptr patch at the element's slot offset (the #18 [N]str per-element pattern; strlits pre-interned in element order) — and any element that doesn't reduce to an int/str literal dies LOUD instead of skipped. The t.N read and len arms gain the global base (LEAQ sym(SB) into CX, the struct-field-global pattern; wwstage's C5 len loud-stop graduates to the working path). A GLOBAL tuple as a first-class VALUE (`let q = g;`) loud-stops on both stages — pre-fix it byte-identically loaded word0 only and read a stale cursor for words 1+ (element reads are the supported surface). 941 grows the t3 rows: global element reads (str+i64 and packed u32,u32 incl. len(g.0)) + rejects (float-element init, whole-value use, pre-existing element-write anchor). 7/82 checks fail at the C-t2 parent (cs silent-garbage runtime, ww C5 build-fail, both rejects vacuous-or-absent).
This commit is contained in:
@@ -436,6 +436,52 @@ static const struct row rows[] = {
|
||||
" return 0;\n"
|
||||
"};\n", 0,
|
||||
K_BUILDERR, "element kind unsupported" },
|
||||
|
||||
/* ---- C-t3 (#48): GLOBAL tuples. Pre-C-t3 the definition was
|
||||
* SILENTLY skipped (let_emit_size 0 → no DATA, no diagnostic);
|
||||
* cstage element reads then read BP-frame garbage (localfind→0)
|
||||
* and wwstage mis-emitted the field index as a symbol
|
||||
* (`MOVQ 0(SB), AX`). Now: slot-laid DATAW (+ DATAR str-element
|
||||
* ptr patches), element reads + len(g.N) via LEAQ sym(SB);
|
||||
* unsupported element inits and the whole-tuple-as-value shape
|
||||
* die LOUD. ---- */
|
||||
{ "t3_global_elem",
|
||||
"package main;\n"
|
||||
"let g: (str, i64) = (\"hello\", 9);\n"
|
||||
"let h: (u32, u32) = (5, 6);\n"
|
||||
"export fn main() i32 = {\n"
|
||||
" if (len(g.0) != 5) { return 1; };\n"
|
||||
" if (g.1 != 9) { return 2; };\n"
|
||||
" if (h.0 != 5) { return 3; };\n"
|
||||
" if (h.1 != 6) { return 4; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN, NULL },
|
||||
{ "t3_reject_float_global",
|
||||
"package main;\n"
|
||||
"let g: (f64, i64) = (2.5, 4);\n"
|
||||
"export fn main() i32 = {\n"
|
||||
" if (g.1 != 4) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0,
|
||||
K_BUILDERR, "unsupported element init (int/str literals only; rule 7)" },
|
||||
{ "t3_reject_whole_value",
|
||||
"package main;\n"
|
||||
"let g: (i64, i64) = (3, 4);\n"
|
||||
"export fn main() i32 = {\n"
|
||||
" let q: (i64, i64) = g;\n"
|
||||
" if (q.0 != 3) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0,
|
||||
K_BUILDERR, "global tuple as a first-class value unwired" },
|
||||
/* pre-existing loud (no-regress pin): global tuple element WRITE. */
|
||||
{ "t3_reject_global_write",
|
||||
"package main;\n"
|
||||
"let g: (i64, i64) = (3, 4);\n"
|
||||
"export fn main() i32 = {\n"
|
||||
" g.0 = 7;\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0,
|
||||
K_BUILDERR, "unsupported assign target shape" },
|
||||
};
|
||||
|
||||
/* build+run via a driver (ww / ww_ww); returns 0 pass, nonzero fail. */
|
||||
|
||||
Reference in New Issue
Block a user