test: regression lock for struct-ABI size formula (#78 lock)
Project #78 was ken-flagged: cstage folded size(struct{i32,i32,i32}) to 12 (cmd/wcc/check.c:760, `(off + maxalign - 1) & ~(maxalign - 1)`) while wwstage walked a slot-padded fsz ladder and yielded 16. The two checkers ran different layout formulas.d4e500f(#169) closed the cgen ABI half by introducing structabisize and walking it via per- field tinfo.align;39f9267+66a91c8converged the remaining cgen sites that had picked the slot-padded number. Verified at the size(T) fold and the .s byte-id on every layout-edge shape. Add 762_struct_abi_size.c (6 table rows) to lock the closure. Each row carries a (sz, aln) field table; the expected size is computed in C via the Hare layout formula (rule 13: no hardcoded size literals — a formula bump lands in compute_expected and every row tracks). Both gates run per row: a runtime check that `return size(T): i32` matches the computed expected on both stages (catches a fold drift), and a w6c vs w6c_ww .s byte-id (catches a cgen-ABI walker drift even when the fold still matches — the two walkers are independent SSoTs). Rows target maxalign edges: i32_x3_maxalign4 #78 canonical, natural==ABI==12 i32_i32_i64_lead_narrow maxalign 8, narrow lead, ABI 16 i64_i32_i32_sub8_tail #169 sub-8 tail, ABI 16 (the round-up) i16_x3_maxalign2 maxalign 2, natural==ABI==6 i32_i32_i64_mid_align mid-record align step explicit i64_x3_natural_24 all 8-wide, natural==ABI==24 GATE POLARITY: this file must stay GREEN. A red here means eitherd4e500freverted, or one of the two layout walkers (check.c:760 / check.ww:958 / cgen.c struct_arg_size / cgenutil.ww structabisize) drifted from the formula.
This commit is contained in:
7
Makefile
7
Makefile
@@ -312,6 +312,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_check_enum_fold \
|
||||
$(BIN)/test_def_widen_const \
|
||||
$(BIN)/test_inferred_struct_arg_push \
|
||||
$(BIN)/test_struct_abi_size \
|
||||
$(BIN)/test_use_promote_alias \
|
||||
$(BIN)/test_field_signed $(BIN)/test_frame_argcount \
|
||||
$(BIN)/test_selfhost $(BIN)/test_w6a_ww $(BIN)/test_w6l_ww \
|
||||
@@ -591,6 +592,12 @@ $(BIN)/test_inferred_struct_arg_push: test/wcc/761_inferred_struct_arg_push.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_struct_abi_size: test/wcc/762_struct_abi_size.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 $@ $<
|
||||
|
||||
$(BIN)/test_arrlit_str_full: test/wcc/711_arrlit_str_full.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
|
||||
Reference in New Issue
Block a user