Expand description
AST ⇄ e-graph conversion and the statement-level Architect pass.
Each expression gets its OWN e-graph (mutation between statements can never leak equalities), seeded with the Oracle’s per-site facts. Two stability rules keep the seeding sound:
- Opaque uniqueness: every unmodeled subexpression (calls, list literals, ranges, …) becomes a FRESH opaque leaf per occurrence — two identical calls never unify, so effects are never deduplicated.
- Fact stability: Oracle facts are seeded only on subtrees whose
value cannot change WITHIN one evaluation of the enclosing
expression — literals, variables (no
Setcan run mid-expression), and pure arithmetic over those.Index/Length/opaque subtrees can observe a collection mutated by a sibling call, and two occurrences share one e-class, so per-site facts must not be intersected there.
Structs§
Functions§
- egraph_
stmts - The Architect statement pass: STRAIGHT-LINE RUNS of simple statements share one e-graph (a Let merges its variable with its defining expression’s class, so later statements extract against everything proven so far — the GVN replacement); everything else falls back to per-expression graphs and ENDS the run. Versioning makes mutation kills structural.
- simplify_
expr - Saturate ONE expression against the rule set and extract the cheapest equivalent. Returns the original pointer when nothing improved.