wcc_ww/cgen: #60+#79 alias-NAMED array/slice ELEMENT paths read the chased tinfo — tichase lands, SEGV families graduate byte-id
One class: alias-blind base+esz at the array/slice ELEMENT paths — index read/write, slice-expr, for-range, and literal-init store. The wwstage cgen derived element size and base addressing from the type-AST tnode; an alias-typed base (`type arr = [4]int; let a: arr`) shows only the N_TNAME leaf, so esz fell to a sentinel (1 on the read side, 8 on the init-store side) and the base classified as a POINTER (MOVQ of array words, no IMULQ): m8b_idx1/range1 SEGV 139, m8b_slice1 silent-wrong past little-endian prefix-luck (m8c_slice1big exit 2), m7c global [2]row read SEGV via the alias-blind element-is-array classify, and (#79, ken F2a1 oracle) `type A=[4]u32; let a:A=[...]` stored MOVQ stride-8 over a stride-4 slot — elements 2/3 landed at 0(BP)/+8(BP), a saved-BP/RIP smash masked whenever esz==8. cstage reads everything off the chased stamped type (type_chase_named/ idx_eff, correct post-F1), so every fixed shape graduates ww-SEGV/silent-wrong -> 0/0 byte-id. New tichase() in cgenutil.ww: nil-passthrough transitive TY_NAMED peel, exact twin of cmd/wcc/type.c:160-162. Routed sites, all gated on the stamped type being TY_NAMED (non-alias paths byte-identical): - cgindex (cgenexpr.ww): elem facts (esz/signed/float/f32) off tichase(n.type_); etn falls back to n for the tagged/str/slice classify; LEAQ-vs-MOVQ base off the chased kind; elem-is-array supplemented by tinfoisarray(n.type_) for alias ELEMENTS (m7c). - cgassign N_INDEX store + compound arms (cgenexpr.ww): esz + elemtn=lhs (the stamped-element idiom of the N_DOT/N_INDEX arms); chased-kind base classify at all four LEAQ/MOVQ sites. - cgslice + cgbasecap (cgenexpr.ww): esz, base classify, default-hi (TY_ARRAY -> $alen / TY_SLICE|TY_STR -> +8 len), cap word at +16; global-str cap keeps the #73 carve-out. - cgforrange (cgenstmt.ww, cross-file leg: the range pin cannot green without it): esz, element-node synthesis off .sub (FC0 precedent), isarr/isslicestr classify, alen off the chased tinfo. - cgarrlitfillbp (cgenstmt.ww, #79): an alias [count]T arrtn is the N_TNAME leaf (elemn nil) — synthesise the element node off the chased sub so the existing prim/agg/slice/tagged/narrow dispatch works unchanged; `...` repeat bound off the chased alen (cstage cg_arrlit_fill_bp receives the pre-chased bu and reads bu->alen). #8-PAIR COVERAGE: this is the STORE half of #8's two size-sources. The elemsizeofc READ half chases the ELEMENT internally (idxeffti + esub peel, the #8 fix) but NOT an alias-typed INDEXABLE node — that leg is covered at its #60-family call sites by the gates above (cgindex/cgslice/store/compound/cgforrange/pusharg). Remaining alias-blind elemsizeofc callers are enumerated as residuals below. - bare-let classify (cgenstmt.ww, #79 rider): `let a: arrk;` with an alias-to-array type took the composite zero-fill cstage doesn't emit (cstage keys the no-init shape on the chased lu->kind: arrays keep the per-index-write contract; an 8B alias-array still falls to the single MOVQ $0 arm). Required for the loopfill_1024 pin's byte-id; closes the array kind of the uninit-alias divergence. - pusharg N_SLICE (cgenutil.ww, pulled in by the same pin rule: the 944 slice_of_alias_arg row is a distinct lowering from cgslice): esz, base classify, default-hi. Tests: new 944_alias_idx_family_run (19 rows: idx/slice/range/init controls + 1-level + 2-level + decl-order permutations + index store + compound (+=, *=) + #79 [4]u32 literal-init + alias `[v...]` repeat + uninit [1024] loop-fill + slice1big (1000 elems, values >255, LAST-element readback, default-hi, .cap, range count) + re-slice of an alias slice + range over an alias slice + m7c global 2D + GLOBAL alias-slice indexed read + slice-as-call-arg; dual-stage run + per-row byte-id; LAST elements asserted throughout). The six 944_alias_accept_run rows citing "#60 (F2 batch 1)" flip K_RUN_CS -> K_RUN (incl. slicefield_wholeread_2lvl: its 738d7f4-era receive-spine divergence no longer reproduces at the F1-merged base, verified byte-id + 0/0). 989_lib_byteid checked: no DIVERGE entry graduates (the test fails loudly on graduation; lib has no alias-base consumers — the shape SEGVed before this fix). NOT pinned (g-fold territory, #77/#78): direct alias-typed global ARRAY rows. Expected state probe-verified UNCHANGED by this diff: `let g: arr = [...]` -> ww link-ERR (no DATA emitted), cs 1-level runs 0, cs 2-level runs WRONG (silent). The alias-GLOBAL base legs added here (isglobalarr reclassify, global default-hi/cap) are cs-aligned but runtime-unreachable until the DATA emit lands. Residuals filed with the team: alias-blind elemsizeofc callers not in the #60 pin family — cgun &a[i] addr-of (cgenexpr.ww:4638 region, task #82), append() on an alias-typed slice local (:5287), `alloc([], n)` into an alias-slice let (cgenstmt.ww:2159), arr[i].field= float store (:8536); tagged-element READ under an alias base keeps the ident-arm nullable semantics; checker asserttyped on `untyped_lit * rangevar` over an alias slice (pre-existing, check.ww is batch 4, task #80); uninit alias-to-STRUCT zero-fill unchanged (correct: cstage fills composites); range-destructure over alias-to-tuple-slice. selfhost/cmd/{w6c,wwdump}/main.combined.ww regenerated (cgen*.ww are embedded sources).
This commit is contained in:
@@ -28,17 +28,15 @@
|
||||
* idx/slice/range_ | index/slice/for-range over 2-level |
|
||||
* 2level, slice_arg | alias bases (F0 8b) — cs cgen index |
|
||||
* | family chased (idx_eff + base |
|
||||
* | classify); CS-ONLY rows: the wwstage |
|
||||
* | half is the task-#60 esz family (F2 |
|
||||
* | batch 1) — flip to K_RUN when it |
|
||||
* | lands | 0(cs)
|
||||
* | classify); ww half landed (#60, F2a |
|
||||
* | batch 1 tichase) — graduated K_RUN | 0
|
||||
* arg_2level_* | task #61: alias-NAMED struct PARAM |
|
||||
* | classify (fwd-ref / lit-init / 40B |
|
||||
* | 5-eightbyte / f64 SSE class legs + |
|
||||
* | base control) | 0
|
||||
* float_alias_param* / | ken-v3 leg: 2-level f64/str/slice |
|
||||
* str_alias_2level / | aliases at the cgen KIND classifiers |
|
||||
* slice_alias_param | (slice leg cs-only, #60) | 0
|
||||
* slice_alias_param | (slice leg graduated, #60 F2a b1) | 0
|
||||
* slicefield_* / | reviewer-F1 leg: 2-level alias of |
|
||||
* strfield_store_2lvl | slice/str as a STRUCT FIELD type — |
|
||||
* | cgen field gates chased (stores, |
|
||||
@@ -424,11 +422,11 @@ static const struct row rows[] = {
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN, NULL },
|
||||
/* whole-field read into a local: cs runtime-correct post-chase
|
||||
* (the clobbered-register r1b probe), but the `let w = b.s`
|
||||
* receive spine diverges cs vs ww at ONE level already (byte-id
|
||||
* NO at pristine 738d7f4 = pre-existing, #71-style divergence,
|
||||
* filed under #73's census) and ww's `w[i]` read is the task-#60
|
||||
* esz family — cs-only until both land. */
|
||||
* (the clobbered-register r1b probe). The `let w = b.s` receive
|
||||
* spine divergence noted at pristine 738d7f4 no longer
|
||||
* reproduces at the F1-merged base, and ww's `w[i]` read (the
|
||||
* task-#60 esz half) landed in F2a batch 1 — byte-id + 0/0
|
||||
* verified, graduated K_RUN. */
|
||||
{ "slicefield_wholeread_2lvl",
|
||||
"package main;\n"
|
||||
"type sl = []int;\n"
|
||||
@@ -447,7 +445,7 @@ static const struct row rows[] = {
|
||||
" if (w.len != 3) { return 1; };\n"
|
||||
" if (w[2] != 900) { return 2; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
/* #73 tripwire pin: the UNPROBED single-peel field gates
|
||||
* (indexed-elem store/read, ptr-chain read, heap fill, tuple-elem
|
||||
* read, static emit) hard-error on a 2+-level alias over an
|
||||
@@ -479,7 +477,7 @@ static const struct row rows[] = {
|
||||
" a[1] = 9999;\n"
|
||||
" if (a[1] != 9999) { return 2; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
{ "slice_2level",
|
||||
"package main;\n"
|
||||
"type sl = []int;\n"
|
||||
@@ -492,7 +490,7 @@ static const struct row rows[] = {
|
||||
" s[1] = 7777;\n"
|
||||
" if (a[2] != 7777) { return 3; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
{ "range_2level",
|
||||
"package main;\n"
|
||||
"type arr = [4]int;\n"
|
||||
@@ -505,7 +503,7 @@ static const struct row rows[] = {
|
||||
" };\n"
|
||||
" if (sum != 10) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
{ "slice_of_alias_arg",
|
||||
"package main;\n"
|
||||
"type arr = [4]int;\n"
|
||||
@@ -522,7 +520,7 @@ static const struct row rows[] = {
|
||||
" if (s[1] != 3000) { return 2; };\n"
|
||||
" if (sum(a[0:4]) != 10000) { return 3; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
/* ---- ken-v3 leg: the acceptance align above opens 2-level
|
||||
* float/str/slice aliases to the cgen KIND classifiers
|
||||
* (cg_isfloat/type_isf32/fld_isfloat/type_isstr/type_isslice),
|
||||
@@ -570,7 +568,7 @@ static const struct row rows[] = {
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN, NULL },
|
||||
/* slice leg: cs classify fixed; the ww half of the indexed read
|
||||
* is the task-#60 esz family — cs-only until F2. Values >255
|
||||
* (task-#60 esz family) landed in F2a batch 1. Values >255
|
||||
* break the esz=1 prefix-luck. */
|
||||
{ "slice_alias_param",
|
||||
"package main;\n"
|
||||
@@ -584,7 +582,7 @@ static const struct row rows[] = {
|
||||
" let s: b2 = a[0:3];\n"
|
||||
" if (first(s) != 1000) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN_CS, NULL }, /* ww: task #60 (F2 batch 1) */
|
||||
"};\n", 0, K_RUN, NULL }, /* graduated: #60 (F2a batch 1) */
|
||||
/* ---- task #61: cstage alias-NAMED struct PARAM classify.
|
||||
* The single peel classified a 2-level-alias param SCALAR: caller
|
||||
* pushed and callee spilled ONE eightbyte, fields read saved-BP/
|
||||
|
||||
Reference in New Issue
Block a user