From Push/Enter to Eval/Apply by Program Transformation
Maciej Pir\'og (University of Oxford), Jeremy Gibbons (University of, Oxford)

TL;DR
This paper demonstrates a transformation method between push/enter and eval/apply calling conventions in functional language implementations, linking them to list data structures and applying it to the GHC Haskell compiler core.
Contribution
It introduces a novel transformation technique between calling conventions using program transformation principles, applicable to real-world compiler cores.
Findings
The stack behavior under both conventions resembles specific list implementations.
A systematic transformation from push/enter to eval/apply is feasible.
Applied to GHC, the method successfully converts its core machine.
Abstract
Push/enter and eval/apply are two calling conventions used in implementations of functional languages. In this paper, we explore the following observation: when considering functions with multiple arguments, the stack under the push/enter and eval/apply conventions behaves similarly to two particular implementations of the list datatype: the regular cons-list and a form of lists with lazy concatenation respectively. Along the lines of Danvy et al.'s functional correspondence between definitional interpreters and abstract machines, we use this observation to transform an abstract machine that implements push/enter into an abstract machine that implements eval/apply. We show that our method is flexible enough to transform the push/enter Spineless Tagless G-machine (which is the semantic core of the GHC Haskell compiler) into its eval/apply variant.
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.
