AOT Monomorphization Completeness
8 sections
Overview
collect_mono_functions (compiler_repo/compiler/ori_llvm/src/monomorphize/mod.rs:71; line coords refreshed at execution time per routing.md §5) registers EVERY Apply / Invoke call site reachable from host-module callers — across module boundaries, builtin Apply targets in generic contexts, inherent methods on generic types, and methods on receivers whose type parameters are themselves complex generics. The four absorbed bugs are facets of one architectural completeness gap; the shared cure is a coordinated extension of the mono-collection pipeline plus the corresponding MonoInstance emission sites in the type checker.
Planned
5 sections
Complex-Generic-Arg Method Mono (BUG-04-061)
Mono dispatch resolves methods on receivers whose type parameters are themselves heap-typed generics (Option<[int]> vs Option<int>). MonoInstance dedup predicate distinguishes by full receiver type, not by name + generic-arg arity alone.
Builtin Apply Mono in Generic Context (BUG-04-114)
Builtin Apply targets (__cast, __index, __iter_next, etc.) inside generic bodies register MonoInstance records and resolve through collect_mono_functions. Generic functions using `as` casts compile cleanly.
Test Matrix + Dual-Execution Parity
Integrated test matrix covering all four mono-completeness facets. Dual-execution parity verified across every new and modified test. Zero leaks under ORI_CHECK_LEAKS=1.
Close-out — Cluster Bug Retirement + TPR + Hygiene
Full-plan /tpr-review + /impl-hygiene-review consensus, plan_corpus check clean, four absorbed bug tracker entries retired to bug-tracker/plans/completed/, /commit-push, BUILD_NUMBER bumped.
Derived `Default` + Prelude `min`/`max` Builtin Mono Crash — LLVM Spec-Backend Suite Abort
|
Completed
2 sections
Root Cause Analysis — Shared Monomorphization Completeness Gap
Characterize what collect_mono_functions does today, what it misses, and why the four absorbed bugs are facets of one architectural gap. Read-only investigation — no code changes; no `.rs` edits land in this section.
Import-Sigs Traversal — Cross-Module Imported Generic Top-Level Mono (BUG-04-119)
Extend collect_mono_functions to traverse import_sigs alongside function_sigs + impl_sigs; thread import_sigs through run_borrow_inference + arc_lowering test runner; promote the JIT imported-mono body-import carrier (Decision 01 Option B) onto the AOT path so cross-module imported top-level generic call sites register one MonoFunction per (generic_sig, instance_args) pair reachable from host-module callers.