Clang ARC Lessons: Logical Ownership and Physical Projection Optimizations
6 sections
Overview
Adapt battle-tested ARC optimization patterns from Clang/LLVM and Swift at Ori's correct logical/physical seam:
Planned
6 sections
Logical and Physical Ownership Statistics
Report logical AIMS-event metrics separately from post-layout physical ownership-action metrics, without making a counter mechanism part of AIMS
Effect-Aware Coalescing Barriers
Logical ownership-event coalescing uses frozen callee contracts to flush only variables whose callees may observe sharing/transfer state, reducing unnecessary barriers by 40%+
Counter-Plan KnownSafe Nested Pair Elimination
After a validated physical plan selects counter actions, a reusable pure optimizer proves bracket positivity and eliminates redundant inner pairs without changing the frozen AIMS trace
COW Obligation and Physical Fusion
Freeze one backend-neutral CowMutationObligation per semantic mutation, then let each validated physical plan independently fuse its chosen observation/copy/mutate sequence
PRE-Style Global Counter-Plan Motion
A reusable post-layout optimizer moves selected counter actions across blocks while path-counting hazards and exact AIMS-trace refinement prevent unsound motion
Verification
Comprehensive test matrix, behavioral equivalence verification, and code journey proving all ARC optimizations are correct across the full type × pattern × CFG matrix