cgen: c2 variant pass-2 structural fallback chases the full NAMED chain — both stages fused
F2a batch-4 c2. Site: cgenutil.ww flatvariantidxt pass-2 (was :2895 at74195ac, :2903 at4adf914post-batch-3) + cs twin cg_tag_for_variant (cmd/w6c/cgen.c:920-933). The structural fallback matched a bare source against a NAMED variant by peeling exactly ONE level (pu.under compare) — a 2-level-alias variant (type a=*X; type b=a) missed every pass and the widen defaulted to tag 0, SILENT (the legacy-#17-comment class; that comment's "task #17" label is retired here — current task #17 is the unrelated arrlit item). cs-twin probe DECIDED THE FUSE (spec obligation): v2_alias2 (bare *i64 into 2-level ptr-alias variant) ran exit 1/1 BOTH-WRONG-IDENTICAL byte-id pre-fix — cs has the identical single peel, so both stages fix in this commit (NOT ww-only align-up). NOTE: the cs BINARY is NOT frozen this train — this commit legitimately moves cstage codegen; movers must stay bounded to the c2 family (verdict-sweep obligation). Fix: typeeq/type_eq against tichase/type_chase_named of the variant; the TY_NAMED gate keeps bare variants in pass-1's exact domain; drew's >=2-candidate hard-error now guards the CHASED match set (v2_ambig pins it HOLDING; v2_ambig2 pins the RATIFIED acceptance NARROWING — 2-level twins flip build-accepted-silent-mis-tag -> hard-error BOTH stages, FLAG-P1/kb4_v2_ambig2). Not nominal-sensitive beyond the documented proviso — the chase only deepens the structural compare; nominal choice among >=2 candidates still hard-errors (#209/#211 hold condition does not trip). ROUTE-TRACE (rob's §3 ruling) — outcome (b): post-c2 the c4_bool2 shape (2-level bool alias variant, concrete-bool source on ww) runs 0/0 fully BYTE-ID — ww's concrete bool (the #90 stamp divergence, still open) now reaches the variant through the chased structural fallback and converges with cs's untyped-funnel route on the same tag. The graduation therefore belongs to THIS commit: 944 untyped_bool2lvl_bound90 flips K_RUN_CS -> K_RUN here; c5 (#90 stamp flip) pins its own acceptance rows. Pin rows (944, all OBSERVED at the c1 base): v2_ctrl bare *T into 1-level NAMED-*T (io vtable shape) pre 0/0 byte-id -> post HOLDS (the #15 consumer); v2_alias2 bare *T into 2-level alias variant pre cs1/ww1 byte-id (both-wrong) -> post 0/0 byte-id; v2_struct2 bare anonymous-let struct into 2-level alias variant pre cs1/ww1 -> post 0/0 runtime; byte-id SKIPPED via new K_RUN_NOID row kind: asm diverges on 3 PRE-EXISTING cglet zero-fill lines (cs XORQ+2 stores, ww none — #81 class, runtime-correct both, orthogonal to the tag; observed identical pre/post). Flip to K_RUN when that closes. The adjacent NAMED-source shape is task #95 (ken b4-oracle), OUT of this set; v2_ambig bare source matching >=2 NAMED variants (1-level twins) -> hard-error HOLDS both stages (K_BUILDERR, diag pinned); v2_ambig2 2-LEVEL twin variants — the RATIFIED narrowing pin: pre build-ACCEPTED both stages (chase-less fallback matched neither twin; silent mis-tag, byte-identical) -> post HARD-ERROR both stages (K_BUILDERR, diag pinned). Corpus: five-mains NEUTRAL vs the c1 build on identical inputs (both stages — the 2-level variant shape is zero-in-corpus, as the old comment predicted); cs==ww byte-id holds; 944 181/181. combined.ww regens ride along.
This commit is contained in:
@@ -18973,13 +18973,18 @@ fn flatvariantidxt(tagged: *tinfo, want: *tinfo) i32 = {
|
||||
let found: i32 = -1;
|
||||
let n: i32 = 0;
|
||||
for (q != nil) {
|
||||
// One-level NAMED unwrap: a chained ptr-alias variant
|
||||
// (type a=*X; type b=a) isn't reached here, so it would
|
||||
// silently mis-tag — unexercised (zero in corpus), see
|
||||
// task #17.
|
||||
// Full chase (F2a batch-4 c2): the old one-level
|
||||
// unwrap missed a chained ptr-alias variant
|
||||
// (type a=*X; type b=a) — every pass fell through
|
||||
// and the widen defaulted to tag 0, SILENT. The
|
||||
// TY_NAMED gate keeps bare variants in pass-1's
|
||||
// exact domain; drew's >=2-candidate hard-error
|
||||
// below now guards the CHASED match set. cs twin
|
||||
// cg_tag_for_variant fused in this commit (probe:
|
||||
// both-wrong-identical pre-fix).
|
||||
let pu: *tinfo = q.type_;
|
||||
if (pu != nil && pu.kind == tykind.TY_NAMED
|
||||
&& pu.under != nil && typeeq(pu.under, want)) {
|
||||
&& typeeq(tichase(pu), want)) {
|
||||
if (found < 0) { found = qi; };
|
||||
n += 1;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user