Repository navigation
Define and vendor the M8-O optimize comparison #92
Description
Part of #74 (Phase 1). Decide and record what M8-O means, then vendor the corpus. Two coupled decisions.
1. The goldens are JavaScript
The 10 optimize files have .out.js goldens, not CoreFn:
2866.out.js 4179.out.js 4229.out.js 4386.out.js Foreign.out.js
Monotonic.out.js Symbols.out.js RecursiveInstances.out.js Monad.out.js ...
The vendoring rule in tests/upstream/README.md keeps .purs only and excludes .out files — which would discard every golden. So either the rule changes for optimize, or the comparison never sees an oracle.
purs generates JavaScript from its own CoreFn-like IR after its own optimizer. We have P7 (source-type-aware local rewrites, lambda/global inlining, projection, specialization, dead-binding elimination on verified Typed Core) and P10 (MIR-level inlining, block pruning, constant propagation, terminator simplification, value forwarding on P9-lowered verified MIR). Neither is trying to reproduce purs' JavaScript.
Decide and write down which of these the gate means:
- (a) Shape equivalence — our optimized Core/MIR has the same structural properties as the oracle's: the functions the golden inlines are inlined, the ones it drops are dropped, tail positions stay tail. Compared by inspecting the golden's JS for the transformation, not by text.
- (b) Observable behavior — a source program whose golden output shows a specific result compiles and produces that result. Weaker, but directly executable.
- (c) purs IR comparison — requires a CoreFn printer and a normalized comparison. Most faithful, most work.
Recommendation: (a) plus (b). (c) is a large project on its own and should not block the rest of the plan.
2. Vendor the files
Add optimize to the tests/upstream/README.md rsync recipe. If (a) or (b) is chosen, .out.js must be vendored too, which changes the .out-exclusion rule — state the exception and why.
Acceptance
docs/design/D-04-suite-roadmap.md M8-O states the comparison in one paragraph, the corpus is vendored per that decision, and the gate row stops saying "not complete" in favor of a defined target.
Activity