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
D119: migrator array spelling, guaranteed no-heap List lowering, migrator List rule #2301
Ruling D119 (2026-10-09). In order, after D118's rename:
Migrator spelling: emit [T; N] (not [N]T), type elements by the array's element type instead of casting each one, sizeof(t)/sizeof(t[0]) → t.len(); re-migrate the four corpora (D112). Today: 878 [N]T arrays with per-element casts.
Guaranteed lowering (§4.3c): a List literal never pushed, grown, moved out, stored or retained lives on the stack or in static data. Gate: allocation-count test (today let t = [1, 2, 3, 4] in a function called 1000 times makes 1003 allocations; must be 3).
Migrator rule (with-migrate-spec.md, Arrays): local and file-scope arrays → List literals (zero fill of the length for buffers; List[[T; N]] for 2-D locals; data pointer + length when the address goes to C); struct/union fields stay [T; N]. Benchmark each corpus against its C before and after.
Step 2 (the guaranteed no-heap lowering) is in the tree: mir_mark_stack_literals (MirLower, §4.3c) and the frame-resident build in mir_emit_collection_literal_intrinsic_call. Measured on main c97a00852 with the installed compiler: fn f(i: i32) -> i32: let t = [1, 2, 3, 4]; t[0] + i called a thousand times reports allocations=3 under --debug-alloc, the same three a print(1) program makes, so the literal costs nothing per call (the issue's gate asked for 3; it was 1003). The gate fixture test/debug_alloc/da_d119_literal_no_heap.w (expect allocations=3) goes in with the next stack (~/.local/with-staging/da_d119_literal_no_heap.w).
Step 1 (migrator spelling [T; N], no per-element casts, sizeof ratio → len(), re-migration) landed earlier on branch d119-spelling per the campaign memory; step 3 (the migrator's List rule for locals and tables, with each corpus benchmarked against its C) is the remaining item and is migrator work (CiMigrate.w "Arrays"), separate from the compiler guarantee.
D119 step 3 landed in #2364 (squash ede7749, battery GREEN on 23db29c: gate rc=0, uat rc=0, battery-checks rc=0). Steps 1-2 were already on main; this completes the migrator's List rule. The step also fixed, each with a fixture: §9.1c stable-global storage (a stable List global is writable static data, and a migrated file-scope array declares a stable binding, since C cannot assign an array and a var List global cannot cross a bundle), and Emit-C declaring struct types reached only as container elements.
Activity
D119 step 1 + Amendment 1: [T; N] and [T; 2, 3] in the migrator, the …
ehartford commentedon Oct 12, 2026
Step 2 (the guaranteed no-heap lowering) is in the tree:
mir_mark_stack_literals(MirLower, §4.3c) and the frame-resident build inmir_emit_collection_literal_intrinsic_call. Measured on mainc97a00852with the installed compiler:fn f(i: i32) -> i32: let t = [1, 2, 3, 4]; t[0] + icalled a thousand times reportsallocations=3under--debug-alloc, the same three aprint(1)program makes, so the literal costs nothing per call (the issue's gate asked for 3; it was 1003). The gate fixturetest/debug_alloc/da_d119_literal_no_heap.w(expectallocations=3) goes in with the next stack (~/.local/with-staging/da_d119_literal_no_heap.w).Step 1 (migrator spelling
[T; N], no per-element casts,sizeofratio →len(), re-migration) landed earlier on branch d119-spelling per the campaign memory; step 3 (the migrator's List rule for locals and tables, with each corpus benchmarked against its C) is the remaining item and is migrator work (CiMigrate.w "Arrays"), separate from the compiler guarantee.D119 step 3 (#2301): a C local or file-scope array becomes a List of …
D119 step 3 (#2301): a C local or file-scope array becomes a List of …
D119 step 3 (#2301): a C local or file-scope array becomes a List; th…
ehartford commentedon Oct 12, 2026
D119 step 3 landed in #2364 (squash ede7749, battery GREEN on 23db29c: gate rc=0, uat rc=0, battery-checks rc=0). Steps 1-2 were already on main; this completes the migrator's List rule. The step also fixed, each with a fixture: §9.1c stable-global storage (a stable List global is writable static data, and a migrated file-scope array declares a stable binding, since C cannot assign an array and a var List global cannot cross a bundle), and Emit-C declaring struct types reached only as container elements.