wcc: TYPE-based forward-tagged predicate in wwstage cgreturn (#201)
cgreturn's forwardtagged detection was keyed on the CALLEE NAME (N_IDENT/N_DOT only via fnretlookupmod), so any other callee shape fell through to the variant-tag synthesis path — clobbering the just-returned AX/DX/CX/R8 tagged-ABI words. The deref-call case `(*r)(...)` (impl-e1-resume STOP, 994 w6c_ww byte-id red) was the proximate trigger. Replace with a TYPE-BASED predicate over the checker-stamped tinfos (rhs.type_ vs c.fnret.type_), mirroring cstage cgen.c:8007 passthrough. Peel TY_NAMED on both sides then identity-check the underlying TY_TAGGED — sufficient for the NAMED case because tinfocache memoizes per typedecl (#191 lineage). Variant-pointer fallback walks the params chain when identity fails so anonymous unions like the cross-module (i32 | void) shared between strings.byteindex and bytes.index still forward correctly; full recursive tinfo structural-eq is gated by #178 (typeeqast's TY_TAGGED arm conservatively returns false today). Probe 770_return_tagged_forward covers 6 rows — IDENT forward, widen non-matching, deref-call (the bug), scalar (sanity), nested call, cross-module forward — each gated on cstage runtime + wwstage runtime + cs.s == ww.s byte-identity.
This commit is contained in:
7
Makefile
7
Makefile
@@ -320,6 +320,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_match_variant_dispatch \
|
||||
$(BIN)/test_io_types_run \
|
||||
$(BIN)/test_dot_aliased_ptr \
|
||||
$(BIN)/test_return_tagged_forward \
|
||||
$(BIN)/test_use_promote_alias \
|
||||
$(BIN)/test_field_signed $(BIN)/test_frame_argcount \
|
||||
$(BIN)/test_selfhost $(BIN)/test_w6a_ww $(BIN)/test_w6l_ww \
|
||||
@@ -646,6 +647,12 @@ $(BIN)/test_dot_aliased_ptr: test/wcc/769_dot_aliased_ptr.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_return_tagged_forward: test/wcc/770_return_tagged_forward.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