s10 — Fast Tier: Full ISel Coverage
Goal
Every ArcInstr variant (21) and ArcTerminator variant (8) lowers through BIR->MIR on every target — the fast tier becomes semantically complete (unwind-edge lowering stubs route to s13; everything else real).
Implementation Sketch
Coverage waves over the instruction surface verified at plan time (ori_arc/src/ir/instr.rs):
- Data + control:
Construct(all CtorKind incl. closures {fn_ptr,env_ptr} per CG:TR-5 16-byte pair),Project(ReprPlan-driven field offsets —get_repr/memory_index; NEVER hand-computed offsets),Select,Switch(jump tables + compare chains by density),Jumpargs as block-param moves (parallel-move resolution). - RC surface:
RcInc/RcDecper all 6RcStrategyvariants (HeapPointer/FatPointer/Closure/AggregateFields/InlineEnum/Iterator) calling the exact ori_rt fns per strategy (table verified at plan time: ori_rc_inc/dec, ori_list_rc_inc/ori_buffer_rc_dec, env-ptr null-checked closure path, recursive field walks, tag-switched enums, ori_iter_drop);IsSharedas inline header load+icmp vs strong_count (CG:RT-2 named offsets, never magic numbers);Set/SetTagwith COW gates percow_annotations(StaticUnique/StaticShared/Dynamic three-path);Reset/Reuse/CollectionReusefast/slow paths;Burden*ops per the s03 lowering decision (landed at s06). The backend EMITS what AIMS decided — zero RC policy here (invariant 5). - Apply family:
Apply/ApplyIndirect/PartialApply(env construction),Invoke/InvokeIndirectlower their normal edge now with unwind edges stubbed to abort-on-unwind until s13 (explicit todo-with-diagnostic, never silent). - Protocol builtins intercepted before call emission:
__index,iter,__iter_next,ori_iter_drop,__collect_set(ownership semantics per arc.md protocol table). - Niche/narrowing fidelity: enum tag reads/writes through
ReprPlan::get_enum_repr(niche-encoded layouts honored); integer narrowing per FieldEntry.storage_width with trunc-store/sext-load discipline (RN-4). - Per-ISA fan-out: each wave lands x86-64 first, then aarch64/riscv64/s390x/wasm within the same wave (section-local matrix; the wave is not done until all 5 pass).
Test Strategy
- Matrix (the load-bearing one): instr-family x element type {int, str, [int], Option
, closure, struct, map, set} x target — AOT-executed with interpreter-parity assertions; cells tracked in a coverage table in this section. - Semantic pins: per RcStrategy one pin asserting the exact runtime call emitted (FileCheck-style on disassembly or MIR dump); COW three-path pins (static-unique elides check, static-shared skips check, dynamic branches).
- Negative pins: unwind-edge stub MUST abort with diagnostic (not run past); niche-encoded enum mis-read fixture fails.
- ORI_CHECK_LEAKS=1 + valgrind on the RC-heavy cells; debug+release green.
Work Items
- Data+control wave: Construct/Project/Select/Switch/Jump-args lowering on all 5 targets with ReprPlan-driven layout.
- RC wave: Rc*/IsShared/Set/SetTag/Reset/Reuse/CollectionReuse/Burden* per all 6 strategies + cow_annotations + drop_hints fidelity on all 5 targets.
- Apply wave: Apply/ApplyIndirect/PartialApply + Invoke normal-edge (unwind stub with explicit abort diagnostic) on all 5 targets.
- Protocol-builtin interception (5 builtins) with ownership-correct emission.
- Niche + narrowing fidelity (enum reprs, trunc/sext at storage sites) per repr.md rules.
- Coverage matrix table complete (instr x type x target) with parity green; strategy/COW pins + negative pins landed; leaks/valgrind clean on RC cells.