cgen: type-key the struct field-layout receiver arms via stamped tinfo (#31 c1)
wwstage cgen resolved struct field LAYOUT (offset + field type) by bare-leaf
name (structlookupchain / structlookup / letvarstructinfo) at nine field
READ / addr-of / let-copy receiver arms whose base is a *struct pointer, a
value struct, or a module global. Under a cross-module same-leaf collision
(two modules each exporting a `pair`, 16B vs 24B) the bare-leaf lookup
first-matches the wrong-size struct -> the field is read / addressed / copied
at the wrong offset with the wrong width. cstage type-keys off the stamped
node.type_ (type_chase_named(base->type)->fields) and is correct; this aligns
wwstage UP to it (ww-only change).
Route the nine arms off the stamped receiver tinfo: R1/R2 *struct reads via a
new shared choke-point cgptrfieldloadtf (the tinfo twin of cgptrfieldload);
A1/A2/A3 addr-of and W3 scalar global-store via tichase(recv.type_)->fields;
C1/W4a copy/size via structabisizetn(tichase(.type_)). Mirrors #21 (5ae6e34);
the *struct arms peel the pointee with tichase(.type_).sub, the faithful twin
of cstage type_chase_named(bu->sub).
The global value-struct arms (R2/R3/A3/W3/W4a) are converted-for-construction:
a global struct's type is always explicitly qualified, so the bare leaf already
resolved correctly and they cannot be reddened -- byte-id (cs.s==ww.s) is their
net, not a value pin. Labelled so the absent reddening pin is explained, not
silent.
Commit 1 of a 2-commit arc (RULING R2 / Opt-2, .ai/ken-31-spec.md): closes the
field-LAYOUT read/copy/addr surface. Commit 2 converts the W1/W2/W5/W4b store
loops to a tinfo-native fill (cgstructlitfilltn + sretretsizetn) and closes the
in-loop nested sub-arms by construction. Part of the #224 name-keyed-cgen
cluster retirement.
Pin: test/wcc/797 value-asserts R1 ptr-read / C1 let-copy / A1/A2 addr, each
reddening under independent per-arm revert (a ratchet proves nothing for this
silent-capable class).
This commit is contained in:
12
Makefile
12
Makefile
@@ -431,6 +431,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_type_value_shadow_run \
|
||||
$(BIN)/test_xmod_alias_struct_collide_run \
|
||||
$(BIN)/test_xmod_struct_argpush_collide_run \
|
||||
$(BIN)/test_xmod_struct_field_layout_collide_run \
|
||||
$(BIN)/test_xmod_variant_match \
|
||||
$(BIN)/test_xmod_qualstructlit_run \
|
||||
$(BIN)/test_spread_variant_match \
|
||||
@@ -1532,6 +1533,17 @@ $(BIN)/test_xmod_struct_argpush_collide_run: test/wcc/793_xmod_struct_argpush_co
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 797 #31 (RULING R2 commit-1): inferred-let struct field-LAYOUT receiver
|
||||
# arms — local *struct READ, let-COPY size, &p.f / &o.f addr-of — keyed
|
||||
# off the bare leaf that mis-resolves cross-module; fix routes them off the
|
||||
# stamped tinfo (tichase(recv.type_)->fields / structabisizetn). Direct
|
||||
# continuation of 793 (#21). Own 2-module fixtures in a private mktemp dir.
|
||||
$(BIN)/test_xmod_struct_field_layout_collide_run: test/wcc/797_xmod_struct_field_layout_collide_run.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# #13: cross-module decomposition of an imported union's variants
|
||||
# (`case pkg.a`). Pre-fix the wwstage checker rejected it; cstage built
|
||||
# it. cstage driver build + run pins routing; ww-sep build (w6c_ww must
|
||||
|
||||
Reference in New Issue
Block a user