Join points in practice
summary
Join points are a small extension to GHC Core (tagging some let-binders) that the compiler infers with the Occurrence Analyser and treats specially in the Simplifier and a dedicated Exitification pass. The implementation maps joins to ordinary lets (but tail-only jumps that perform no allocation on jumps), enables pushing continuations into RHSes, unlocks new fusion and allocation wins (including for recursive joins), and proves practical across eight years of GHC engineering, with lint catching regressions.
AI-written summary · about
chapters (22)
- 0:00Introduction
- 1:08CPS and ANF history
- 3:36CPS to ANF and join points
- 7:08Zena and join points
- 8:31GHC Core overview
- 10:40Case of case optimization
- 13:58Join points to avoid duplication
- 16:02Join points as CFG labels
- 18:07Let-no-escape history
- 19:33Formalizing join points
- 21:18Practical compiler experience
- 25:14Join point typing rules
- 28:04Mapping to GHC Core
- 31:17Implementation details
- 34:28Occurrence analysis
- 37:17Join points as tail calls
- 40:29Optimization opportunities
- 46:10Pushing continuations
- 53:15Recursive join points
- 56:25Tricky corner cases
- 1:03:51Exitification
- 1:04:33Summary and open questions
related talks
01h 30mGHC Proposal Presentations
29mAnnotating Deeply Embedded Languages
13mHash Consed Points-To Sets
15mSealing Pointer-Based Optimizations Behind Pure Functions
32mGranite: Compositional Functional Logic Programming
01h 28mInto the Core Squeezing Haskell into nine Constructors
23mHigher order Patterns in Rewrite Rules
12mOn the power of syntactic methods: It is all syntax after all…
