| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
ReWire.Synolon.Transform
Description
Process-level cleanups of the block graph, between purify and the machine lint:
- Epsilon-block inlining: a block with no commands whose terminator is a single goto is glue; references to it re-target its successor directly (with the argument substitution applied). A pause target is never inlined away — it is a machine state. Chain-following is fuel-bounded by the block count: the goto-only subgraph is acyclic on guarded input, but the machine lint's guardedness rule is only checked downstream of this pass.
- Alpha-equal block merge (the retired duplicate-definition merge's structural successor): blocks whose bodies are alpha-equivalent (binders renumbered; labels and cells compared by identity) merge, and references redirect to the survivor. Iterated to a fixpoint: each round of merging can unify the targets of further blocks. This is what keeps the state count minimal — an INLINE-duplicated continuation mints many identical pause targets.
- Unreachable-block purge: purify drops the continuation of a computation that cannot return (an error at monadic type), which orphans the blocks compiled for it. Orphaned pause targets would otherwise mint machine states (and dispatch entries) and mask the never-pauses lint, so blocks unreachable from the entry are removed.
Synopsis
- optimizeProc :: Proc -> Proc
- machineSummary :: Proc -> Text
Documentation
optimizeProc :: Proc -> Proc Source #
machineSummary :: Proc -> Text Source #
The machine accounting (doc/synolon.md §7): states are the pause targets plus the entry (reset) state; the tag is their count's bit width. Printed as a verbose diagnostic by ReWire.ModCache.