Closure Conversion, Flat Environments, and the Complexity of Abstract Machines
Beniamino Accattoli (1), Dan Ghica (2, 3), Giulio Guerrieri (4), Cl\'audio Belo Louren\c{c}o (2), Claudio Sacerdoti Coen (5) ((1) Inria & LIX, \'Ecole Polytechnique, (2) Huawei Central Software Institute, (3) University of Birmingham, (4) University of Sussex

TL;DR
This paper explores the relationship between closure conversion and abstract machines, introducing a new proof technique, a novel environment handling method, and analyzing the impact on time complexity in functional language compilation.
Contribution
It presents a simple proof technique for closure conversion correctness, a new environment handling approach in abstract machines, and an analysis of complexity changes due to closure conversion.
Findings
Closure conversion reduces dynamic costs in abstract machines.
Closure conversion increases initial code size.
Overall machine complexity remains unchanged after conversion.
Abstract
Closure conversion is a program transformation at work in compilers for functional languages to turn inner functions into global ones, by building closures pairing the transformed functions with the environment of their free variables. Abstract machines rely on similar and yet different concepts of closures and environments. In this paper, we study the relationship between the two approaches. We adopt a very simple {\lambda}-calculus with tuples as source language and study abstract machines for both the source language and the target of closure conversion. Moreover, we focus on the simple case of flat closures/environments, that is, with no sharing of environments. We provide three contributions. Firstly, a new simple proof technique for the correctness of closure conversion, inspired by abstract machines. Secondly, we show how the closure invariants of the target language allow…
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.
