Multi-Backend Representation Optimization & ARC Intelligence
13 sections
Overview
Ori programs use compact, fast representations in every executable backend without exposing representation choices to programmers or allowing the backends to rediscover semantic facts independently. This realizes the approved representation-optimization proposal and the parent missions.md §Compiler / §AIMS intent: semantics remain canonical, while layout, allocation, and physical ownership/cleanup costs — including RC traffic when a plan selects counters — become the compiler's problem.
In Progress
3 sections
Enum Representation Optimization
Optimize enum layout with niche filling, discriminant narrowing, tagged pointers, and payload compression — matching Rust's enum layout optimizations
Collection Specialization
Optimize collection representations: SSO, SVO, packed and narrowed storage, and proof-backed in-place mutation for unique collections
Verification & Benchmarks
Prove representation correctness, leak freedom, speed, and memory efficiency across evaluator, VM, LLVM, and ori_backend without backend-local proof or layout drift
Planned
4 sections
Escape Analysis & Physical Placement
Compute lifetime/locality once in AIMS, combine it with neutral extent evidence, and let VM or compiled layout choose a satisfying physical placement
ARC Header Compression
Freeze site-keyed owner bounds and ownership-observation events in AIMS, then let VM and compiled layout plans choose independently verified storage and ownership operations
Thread-Local Non-Atomic ARC
Freeze backend-neutral ThreadReachability once in AIMS, then let validated VM and compiled plans choose synchronization that satisfies it
Shared Representation Evidence and Backend Layout Plans
Split representation proof from physical layout, preserve the shipped LLVM path exactly, give LLVM and ori_backend one compiled target-layout contract, and let the VM exploit the same proofs through VM-private safe storage
Completed
6 sections
Representation IR & Decision Framework
Deliver the historical ReprPlan/LLVM integration, then preserve its backend-neutral evidence for VmLayoutPlan and CompiledLayoutPlan projections
Transitive Triviality & ARC Elision
Classify compound types as trivial when all transitive children are scalar, eliding all ARC operations for these types
Value Range Analysis Framework
Build an abstract interpretation engine over integer intervals that computes provable value ranges for every int-typed expression in a function
Integer Narrowing Pipeline
Lower int (semantic i64) to the smallest machine integer (i8/i16/i32) that preserves correctness, saving memory in struct fields, collections, and stack slots
Float Narrowing Pipeline
Lower float (semantic f64) to f32 when the compiler can prove zero precision loss for the specific values used
Struct & Tuple Layout Optimization
Deliver the historical LLVM field-layout optimization, then project shared field identity into distinct VM and compiled physical layouts