Parent: #146 Blocks: #429 Related: #132, #133
Introduce the optimizer's architecture-neutral profiling and IR pipeline, distinct from the existing baseline numeric tier. Compilation counters and shell observability must report installed optimizing code, never warmup guesses or compatibility constants.
Acceptance
- Add per-function call/branch/type/value/shape profiles with race-free snapshots; profiles remain advisory and every speculation is guarded.
- Define optimizing IR, control-flow graph, SSA/value representation, canonicalization, and dead-code elimination with deterministic dumps.
- Add a separate optimizing-tier state machine, compile claims, immutable publication, invalidation generations, and real compile counters.
- Lower an initial portable numeric/control subset through the optimizer and preserve interpreter/baseline fallback.
- Add native-off/baseline/optimizer differential tests, publication races, rejection caching, and counter convergence tests.
- Document the supported optimizer subset and keep unsupported functions explicitly below the optimizing tier.
Landed checkpoints
ec65181: race-free advisory profiles, distinct publication/counter state, deterministic CFG foundation, and fail-closed subset selection.3736fc5: block-argument SSA for locals and operand stacks, loop backedges, effect-aware canonicalization, dead-value elimination, stable dumps, and invalid stack-merge rejection.9cede38: serialized publication/invalidation, generation-stamped claims, cached rejection, race convergence, and install-only 64-bit counters.74fd22d: first executable optimizer artifact for exact primitive-constant SSA returns on supported AArch64 hosts, owner-leased publication/invalidation, optimizer-first dispatch, exact step accounting, and native-off/baseline/optimizer differential evidence.951c5c5: architecture-neutral virtual-register lowering for guarded Number parameters, optimizer-native AArch64 arithmetic/comparisons, pre-accounting side exits, and ordinary direct-call dispatch with exact fallback.e3f411a: explicit SSA branch values, portable exact two-way control selection, AArch64 native branch dispatch, equal-path step proof, and fail-closed rejection of asymmetric paths/merges/loops.
Completion boundary
This issue establishes and executes the initial portable numeric/control optimizer subset. General merges/loops and unequal-path accounting require OSR/deoptimization/checkpoint reconstruction and remain under #432; property/array regions, concurrent artifact semantics, backend completion, and PR-249 promotion remain under #132, #133, #433, #434, and #429.