Practical Inlining of Functions with Free Variables
Lars Bergstrom, Matthew Fluet, John Reppy, Nora Sandler

TL;DR
This paper presents a practical, general method for inlining functions with free variables in higher-order languages, addressing a longstanding challenge with proven correctness and performance evaluation.
Contribution
It introduces the first practical, general approach for inlining functions with free variables, including correctness proof and implementation tips.
Findings
The proposed method is both correct and efficient.
Inlining with free variables improves performance in higher-order language compilers.
The approach outperforms previous heuristics in practical scenarios.
Abstract
A long-standing practical challenge in the optimization of higher-order languages is inlining functions with free variables. Inlining code statically at a function call site is safe if the compiler can guarantee that the free variables have the same bindings at the inlining point as they do at the point where the function is bound as a closure (code and free variables). There have been many attempts to create a heuristic to check this correctness condition, from Shivers' kCFA-based reflow analysis to Might's Delta-CFA and anodization, but all of those have performance unsuitable for practical compiler implementations. In practice, modern language implementations rely on a series of tricks to capture some common cases (e.g., closures whose free variables are only top-level identifiers such as +) and rely on hand-inlining by the programmer for anything more complicated. This work…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsParallel Computing and Optimization Techniques · Logic, programming, and type systems · Formal Methods in Verification
