w6c: fold dot chains through inferred-alloc struct pointers (#24 residue)
wwstage dotchainresolve gated its *T roots on an N_TPTR-over-N_TNAME
tnode; an inferred `let p = alloc(S{...})!` rides the checker-
SYNTHESIZED N_TPTR whose pointee is the struct BODY node (the #24
TNAME-normalize covers only the direct struct-lit binding), so the
root gate failed and chained p.field.pseudo reads fell to the
unfused deref arms — shape-only divergence vs cstage's type-keyed
fold (both stages runtime-correct; the historical field(SB) leak the
pin described was already fixed). Widen the local and global root
gates to accept the N_TSTRUCT pointee; correctness stays enforced by
the stamped-tinfo peel below (TY_PTR -> pointee TY_STRUCT).
Graduates alias_g73_heapfill out of DATABYTEID_DIVERGED (2 pins
remain, both the tagged-spill family); adds compile fixtures pinning
the newly-converged siblings (nested read+store, slice .cap,
inferred-global root; pin 1730/22/3460) and a runtime lang row that
mutates then re-points the heap base — a read bypassing the pointer
returns the wrong len.
This commit is contained in:
@@ -5403,11 +5403,20 @@ export fn dotchainresolve(c: *cgen, n: *syntax.node,
|
||||
// `*T` root (param/local): dereference at emit time;
|
||||
// pointee struct supplies the field layout. Callers
|
||||
// that opt in via *outptrroot emit a MOVQ load of the
|
||||
// slot before indexing.
|
||||
// slot before indexing. N_TSTRUCT pointee: an inferred
|
||||
// `let p = alloc(S{...})!` rides the checker-synthesized
|
||||
// N_TPTR whose pointee is the struct BODY node (the #24
|
||||
// TNAME-normalize covers only the direct struct-lit
|
||||
// binding); correctness is enforced by the stamped-tinfo
|
||||
// peel below (TY_PTR → pointee TY_STRUCT), mirroring
|
||||
// cstage's type-keyed root gate (cgen.c cg N_DOT
|
||||
// chained-spine ptr_root) — this kind check is only a
|
||||
// shape filter.
|
||||
if (lc.tnode.kind == syntax.nkind.N_TPTR) {
|
||||
let pe: *syntax.node = lc.tnode.lhs;
|
||||
if (pe != nil) {
|
||||
if (pe.kind == syntax.nkind.N_TNAME) {
|
||||
if (pe.kind == syntax.nkind.N_TNAME
|
||||
|| pe.kind == syntax.nkind.N_TSTRUCT) {
|
||||
*outrootoff = lc.off;
|
||||
*outptrroot = true;
|
||||
resolved = true;
|
||||
@@ -5429,7 +5438,8 @@ export fn dotchainresolve(c: *cgen, n: *syntax.node,
|
||||
if (gtn.kind == syntax.nkind.N_TPTR) {
|
||||
let pe: *syntax.node = gtn.lhs;
|
||||
if (pe != nil) {
|
||||
if (pe.kind == syntax.nkind.N_TNAME) {
|
||||
if (pe.kind == syntax.nkind.N_TNAME
|
||||
|| pe.kind == syntax.nkind.N_TSTRUCT) {
|
||||
*outisglobal = true;
|
||||
*outptrroot = true;
|
||||
resolved = true;
|
||||
|
||||
Reference in New Issue
Block a user