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
C backend lacks LLVM-backend parity for several intrinsic families (dyn dispatch, MultiIndex, get_disjoint, SlotMap, VecRange) #301
The C backend (--emit-c) loudly bails on five intrinsic families that the LLVM backend supports. Programs using them compile and run on LLVM but cannot be emitted to C. There is no tracking issue for this parity gap, so this issue consolidates it.
Unsupported in the C backend (src/CCodegen.w, emit_builtin_call_term)
Each calls self.fail("C backend does not yet support ...") — correct (loud, not a silent fallback), but it means these constructs are LLVM-only.
Newly relevant: length-method narrowing
While implementing §18.6 collection length methods (#282), len32/len64/ulen32 were added for every collection. For Vec/HashMap/str/array the C backend emits the narrowing correctly. For SlotMap and VecRange, the new SLOTMAP_LEN32/64/ULEN32 and VECRANGE_LEN32/64/ULEN32 intrinsics map to the catch-all CcBuiltin.SLOTMAP / CcBuiltin.VECRANGE, which hit the loud-fail above. So SlotMap.len32() / VecRange.len32() work on LLVM but fail to emit C — same gap, just widened.
Acceptance criteria
Implement C-backend lowering for these families (or a documented subset), reaching parity with the LLVM backend, or explicitly scope which families are intentionally LLVM-only and document that.
For SlotMap/VecRange specifically, route the *_LEN32/64/ULEN32 intrinsics through the same narrowing helper (CCodegen.emit_len_result) once base SlotMap/VecRange support lands.
Notes
Pre-existing for dyn/MultiIndex/get_disjoint/SlotMap/VecRange base intrinsics; the length-method variants extend the same gap.
--emit-c is for is bootstrapping. in bootstrapping scenario - the user has external LLVM available. bootstrapping is the one time we use external LLVM instead of our own compiled LLVM - and that's just for the first seed. The second seed will use the normal release process - in which we compile the embedded llvm and libclang ourselves.
in summary - I am not certain we need to
Resolved as LLVM-only by design (the acceptance criteria's documented-scope alternative), not by implementing parity — in b094475.
Analysis. The C backend (--emit-c) exists for exactly one job: the no-LLVM bootstrap (emit-c-fixpoint emits the whole compiler to C, builds it with cc, and verifies the C-built compiler re-emits byte-identical C). It only has to emit the compiler's own source. User programs always go through the LLVM backend (the release binary embeds its own LLVM/libclang), so they never route through --emit-c.
The five families here — dyn dispatch, MultiIndex, Vec.get_disjoint, SlotMap, VecRange (and the §18.6 *_LEN32/64/ULEN32 variants, which are just the same base gap widened) — are not used by the compiler internally (verified: no &dyn-typed values, no SlotMap/VecRange fields in src/; emit-c-fixpoint round-trips the full compiler). So they can never block the bootstrap. And user programs that use them compile fine on LLVM. The gap is unreachable by any real path.
The one genuine exposure — the compiler later adopting one of these internally — is already guarded: make emit-c-fixpoint fails loudly and points at it the moment the compiler stops being C-emittable.
Done:
Documented this boundary in docs/with-bootstrap-runbook.md ("Scope of the C backend").
Updated the two emit-c compile-error regression tests to the new message text.
make build + make fixpoint + make test green. The only emit-C gaps worth fixing are ones the compiler's own source hits (surfacing as emit-c-fixpoint failures); #300 is a separate, real such gap.
Activity
ehartford commentedon May 31, 2026
--emit-c is for is bootstrapping. in bootstrapping scenario - the user has external LLVM available. bootstrapping is the one time we use external LLVM instead of our own compiled LLVM - and that's just for the first seed. The second seed will use the normal release process - in which we compile the embedded llvm and libclang ourselves.
in summary - I am not certain we need to
Document the C backend as LLVM-only by design, not a parity gap (#301)
ehartford commentedon May 31, 2026
Resolved as LLVM-only by design (the acceptance criteria's documented-scope alternative), not by implementing parity — in b094475.
Analysis. The C backend (
--emit-c) exists for exactly one job: the no-LLVM bootstrap (emit-c-fixpointemits the whole compiler to C, builds it withcc, and verifies the C-built compiler re-emits byte-identical C). It only has to emit the compiler's own source. User programs always go through the LLVM backend (the release binary embeds its own LLVM/libclang), so they never route through--emit-c.The five families here — dyn dispatch, MultiIndex,
Vec.get_disjoint, SlotMap, VecRange (and the §18.6*_LEN32/64/ULEN32variants, which are just the same base gap widened) — are not used by the compiler internally (verified: no&dyn-typed values, no SlotMap/VecRange fields insrc/;emit-c-fixpointround-trips the full compiler). So they can never block the bootstrap. And user programs that use them compile fine on LLVM. The gap is unreachable by any real path.The one genuine exposure — the compiler later adopting one of these internally — is already guarded:
make emit-c-fixpointfails loudly and points at it the moment the compiler stops being C-emittable.Done:
docs/with-bootstrap-runbook.md("Scope of the C backend").CCodegen.wfailures from "does not yet support" to "LLVM-only … by design (C backend lacks LLVM-backend parity for several intrinsic families (dyn dispatch, MultiIndex, get_disjoint, SlotMap, VecRange) #301)", with a rationale comment so a future agent doesn't mistake them for unfinished work. Loud fail kept; no silent fallback.emit-ccompile-error regression tests to the new message text.make build+make fixpoint+make testgreen. The only emit-C gaps worth fixing are ones the compiler's own source hits (surfacing asemit-c-fixpointfailures); #300 is a separate, real such gap.Document the C backend as LLVM-only by design, not a parity gap (#301)