You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emit-c call marshalling: &str params need address-of for literal/value args (direct extern path) #785
Follow-up to the emit-c decl sync. The decl table and with_runtime.h now match rt's &str (pointer) signatures, but the call-arg renderer (CCodegen.w cc gen_call args, ~5720) only takes addresses when call_param_expects_c_pointer fires; for the fixture shape
the emitted C is with_print_str(WITH_STR_LIT("ok")) — a with_str value passed to const with_str* (now a loud cc error; before the decl sync it silently passed the data pointer as a header pointer and printed nothing).
Needed: the direct-extern path must resolve the callee sig (callee_sig_from_operand / fn_param_is_c_pointer) for these calls and wrap value operands as &((with_str){...}) — or better, route the whole C backend through one FnAbi-derived descriptor per D6 instead of per-path param classification. Also audit: mixed decls remaining in with_runtime.h (eprintln still owned — correct today), and the .ptr cast branch at ~5768 for TY_REF-of-str params looks wrong for header-pointer params.
Test: cli-selfhost-edge-tests emit_c_receiver_abi (currently the only red).
Progress: decl table + with_runtime.h synced (committed), and the TY_REF-of-str .ptr wrong-code branch now passes a real header pointer via (with_str[]){arg} (committed). Remaining sites from the receiver_abi cc log, all in emitted prelude shims:
with_str_concat_n((const with_str[]){_1, WITH_STR_LIT("")}, 2) — _1 is a pointer local; array elements need *_1 when the local is pointer-typed.
(*_3) == _2 — eq renders one operand deref'd, the other raw pointer; comparison rendering must deref pointer locals consistently.
with_print_str(WITH_STR_LIT("ok")) — the direct-extern call path never consults the marshaller (callee sig resolution comes back empty for the user-declared extern), so no address-of is applied.
All three want the same cure: one FnAbi-derived per-param descriptor consulted by every renderer (D6), instead of per-site pointer classification.
Correction to the map: the fresh stage1 emit shows neither compound-literal patch fires for the direct-extern literal call — that call is rendered by a different path than the ~5720 args marshaller (unidentified; do not trust my earlier claim that sites 1/2 were cleared — they persist at 6220/6356 in the emitted shims). The committed decl-table/header sync and the .ptr wrong-code fix stand; everything else here needs the D6 descriptor pass with the renderer actually located first (grep for where CK_STR const args render in calls — it is not callee_sig-driven).
Status: the pinned red (emit_c_receiver_abi in cli-selfhost-edge-tests) passes as of today's full green battery on 830018d — 2fff2a8's header-pointer marshalling covered the failing shape. Remaining asks from this issue (the per-D6 single FnAbi-derived descriptor for the C backend, the .ptr cast branch audit at ~5768, the residual mixed decls in with_runtime.h) are now tracked as part of the D30 campaign's R2c stage — see docs/d30-implementation-plan.md, which subsumes the emit-c decl-sync work: each runtime family flip deletes its hand-maintained with_runtime.h prototypes as the family moves to sema-resolved in-unit calls. Keeping this open until the .ptr branch is audited or R2c retires the path.
Triage 2026-08-31: CLOSE (overcome by events). Fixed by 2fff2a8 + 5a312d9 — the filed fixture now emits the pointer-decay form (with_print_str(((with_str[]){ WITH_STR_LIT("ok") }))) and the emitted C passes cc -fsyntax-only -I runtime (rc=0).
Activity
docs: flip test-green campaign handoff — one red left (emit-c marshal…
ehartford commentedon Aug 15, 2026
Progress: decl table + with_runtime.h synced (committed), and the TY_REF-of-str
.ptrwrong-code branch now passes a real header pointer via(with_str[]){arg}(committed). Remaining sites from the receiver_abi cc log, all in emitted prelude shims:with_str_concat_n((const with_str[]){_1, WITH_STR_LIT("")}, 2)—_1is a pointer local; array elements need*_1when the local is pointer-typed.(*_3) == _2— eq renders one operand deref'd, the other raw pointer; comparison rendering must deref pointer locals consistently.with_print_str(WITH_STR_LIT("ok"))— the direct-extern call path never consults the marshaller (callee sig resolution comes back empty for the user-declared extern), so no address-of is applied.All three want the same cure: one FnAbi-derived per-param descriptor consulted by every renderer (D6), instead of per-site pointer classification.
emit-c: str args to &str/*str params pass a header pointer (#785 part…
ehartford commentedon Aug 15, 2026
Correction to the map: the fresh stage1 emit shows neither compound-literal patch fires for the direct-extern literal call — that call is rendered by a different path than the ~5720 args marshaller (unidentified; do not trust my earlier claim that sites 1/2 were cleared — they persist at 6220/6356 in the emitted shims). The committed decl-table/header sync and the .ptr wrong-code fix stand; everything else here needs the D6 descriptor pass with the renderer actually located first (grep for where CK_STR const args render in calls — it is not callee_sig-driven).
emit-c: resolve dotless extern sigs, marshal str consts typed &str, v…
ehartford commentedon Aug 18, 2026
Status: the pinned red (
emit_c_receiver_abiin cli-selfhost-edge-tests) passes as of today's full green battery on 830018d — 2fff2a8's header-pointer marshalling covered the failing shape. Remaining asks from this issue (the per-D6 single FnAbi-derived descriptor for the C backend, the.ptrcast branch audit at ~5768, the residual mixed decls in with_runtime.h) are now tracked as part of the D30 campaign's R2c stage — see docs/d30-implementation-plan.md, which subsumes the emit-c decl-sync work: each runtime family flip deletes its hand-maintained with_runtime.h prototypes as the family moves to sema-resolved in-unit calls. Keeping this open until the .ptr branch is audited or R2c retires the path.rt/codegen/emit-c: vec join sep observes via &str on every path (D30 …
rt/std: fix the decl/def seams the in-unit lane exposed (D30 R2b)
ehartford commentedon Aug 31, 2026
Triage 2026-08-31: CLOSE (overcome by events). Fixed by 2fff2a8 + 5a312d9 — the filed fixture now emits the pointer-decay form (
with_print_str(((with_str[]){ WITH_STR_LIT("ok") }))) and the emitted C passescc -fsyntax-only -I runtime(rc=0).emit-c: == / != and the orderings on &str views compare the text (#1560)
C backend and modeled-C fixes: map loops, generic structs, view compa…
emit-C: multi-field enum payloads, collection literals, declared Resu…