Better Defunctionalization through Lambda Set Specialization
summary
Claims a compiler pass called Lambda set specialization that turns defunctionalization into type monomorphization, implemented as a polymorphic internal type system with a tractable inference algorithm and mechanized soundness and completeness proofs in Isabelle/HOL. A preprocessing pass targets MLton (Standard ML), OCaml, and the Morphic compiler; it generates specialized first‑order code, yields speedups (average 1.9x MLton, 3.45x OCaml, up to 78.93x on Morphic, best cases ~6.85x/3.45x/78.93x), and changes binaries by at most 35%.
AI-written summary · about
chapters (12)
- 0:00Lambda set specialization intro
- 1:47Lambdas expensive in functional langs
- 3:11Defunctionalization goals
- 6:36Prior techniques and limits
- 9:25Lambda set specialization approach
- 13:18Implementation results and gains
- 15:25Lessons from LSS in practice
- 16:29Summary and future of LSS
- 17:10Q&A on type-preserving compilers
- 18:55Comparison with continuation passing style
- 20:39LSS analysis complexity
- 22:46Closing remarks
related talks
14mThe Simple Essence of Monomorphization
45mLogic Meta Programming for Functional Languages
29mFlambda 2 Types: An abstract domain for static analysis of functional programs (mo...
15mType-safe generation of modules in applicative and generative styles
21mPolymorphic Type Inference for Dynamic Languages
15mMonadification of Attribute Grammars
36mDependently Typed Multi-Stage Programming, Revisited
22mEfficient OCaml compilation with Flambda 2
