Compiling without continuations

  title={Compiling without continuations},
  author={Luke Maurer and P. Downen and Zena M. Ariola and Simon PEYTON JONES},
  journal={Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation},
  • Luke Maurer, P. Downen, S. PEYTON JONES
  • Published 14 June 2017
  • Computer Science
  • Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation
Many fields of study in compilers give rise to the concept of a join point—a place where different execution paths come together. Join points are often treated as functions or continuations, but we believe it is time to study them in their own right. We show that adding join points to a direct-style functional intermediate language is a simple but powerful change that allows new optimizations to be performed, including a significant improvement to list fusion. Finally, we report on recent work… 

Figures and Tables from this paper

Compiling with continuations, or without? whatever.
A novel IR with a control operator that resembles Felleisen’s C, eliminating certain redundant rewrites observed in the previous study, and defines a selective CPS translation of the IR, which erases control operators while preserving the meaning and typing of programs.
Compiling effect handlers in capability-passing style
This paper presents a language for effect handlers in _capability-passing style_ (λCap) and an implementation of this language as a translation to simply-typed lambda calculus in _iterated continuation-passed style_.
Counting immutable beans: reference counting optimized for purely functional programming
This work proposes a new mechanism for efficiently reclaiming memory used by nonshared values, reducing stress on the global memory allocator and describes an approach for minimizing the number of reference counts updates using borrowed references and a heuristic for automatically inferring borrow annotations.
MIL, a Monadic Intermediate Language for Implementing Functional Languages
This paper describes MIL, a "monadic intermediate language" that is designed for use in optimizing compilers for strict, strongly typed functional languages. By using a notation that exposes the
Embracing a mechanized formalization gap
Core parts of the Haskell compiler GHC are translated into Coq, using hs-to-coq, and invariants related to the use of term variables are verified, to shrink and simplify the model until it is manageable, while still retaining a meaningful, declaratively documented connection to the original, unmodified source code.
Formally Verified Space-Safety for Program Transformations
This work expands upon existing notions of space-safety, allowing them to be used to reason about long-running programs with both input and output, while ensuring that the program maintains some temporal locality of space costs.
A Formal Equational Theory for Call-By-Push-Value
This work adapts Lassen's normal form bisimulations technique to establish the soundness of equational theories for both an untyped call-by-value \(\lambda \)-calculus and a variant of Levy’s call- by-push-value language.
Lambda the Ultimate SSA: Optimizing Functional Programs in SSA
  • Siddharth Bhat, T. Grosser
  • Computer Science
    2022 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)
  • 2022
This work exploits a new SSA construct — regions — in order to express functional optimizations via classical SSA-based reasoning to regions for functional-style analyses and transformations and believes it will pave the way for a unified optimization framework capable of representing, analyzing, and optimizing both functional and imperative languages.
Compiling Dependent Types Without Continuations
This work extends the A-normal form (ANF) translation to the Extended Calculus of Constructions (ECC), a representative subset of Coq, and proves type preservation, and correctness of separate compilation from ECC to an ANF-restricted ECC with a machine semantics.
Monadic Intermediate Language for Implementing Functional Languages
This paper describes MIL, a “monadic intermediate language” that is designed for use in optimizing compilers for strict, strongly typed functional languages. By using a notation that exposes the


Compiling with Continuations
This book shows how continuation-passing style is used as an intermediate representation to perform optimizations and program transformations to create practical optimizing compilers for modern languages like ML.
A Transformation-Based Optimiser for Haskell
Let-floating: moving bindings to give faster programs
Let-floating has not received much explicit attention in the past, but measurements show that it is an important group of transformations (at least for lazy languages), offering a reduction of more than 30% in heap allocation and 15% in execution time.
SSA is functional programming
The SSA community draws pictures of graphs with basic blocks and flow edges, and the functional-language community writes lexically nested functions, but (as Richard Kelsey recently pointed out) they’re both doing exactly the same thing in different notation.
Rabbit: A Compiler for Scheme
A compiler for the lexically-scoped dialect of LISP known as SCHEME, which handles only a small basis set which reflects the semantics of lambda-calculus, and serves to produce code as good as that produced by more traditional compilers.
Shrinking Reductions in SML.NET
This is the first implementation and evaluation of a linear-time rewriting algorithm proposed by Appel and Jim, working with a mutable, pointer-based term representation, which significantly outperforms the existing functional algorithm.
Compiling with continuations, continued
We present a series of CPS-based intermediate languages suitable for functional language compilation, arguing that they have practical benefits over direct-style languages based on A-normal form
Contification using dominators
This paper gives a formal presentation of contification in MLton, a whole-program optimizing Standard ML compiler, as well as a new algorithm based on the dominator tree of a program's call graph that is optimal.
A Functional Perspective on SSA Optimisation Algorithms
Call-pattern specialisation for Haskell programs
This paper describes a simple, modular transformation that specialises recursive functions according to their argument "shapes", and describes the implementation in the Glasgow Haskell Compiler, and gives measurements that demonstrate substantial performance improvements.