đź“–Compiling with continuations, or without? whatever.
- authors
- Cong, Youyou and Osvald, Leo and Essertel, Grégory M and Rompf, Tiark
- year
- 2019
- builds on top of Maurer…2017
- add a control operator to eliminates certain redundant rewrites
- treat non-returning and non-escaping aspects of continuations separately
- selective CPS translation of IR, which erases control operators while preserving the meaning and typing of programs
q
Thus, we change the spectrum of available options from “CPS yes or no” to “as much or as little CPS as you want, when you want it.”
- this paper comes from experience implementing MiniScala compiler
q
our experiment shows that a subsequent CPS pass may have a positive impact on the overall performance of the compiler.
- Functional compilers have to do CPS translation anyway (when targeting CFG-based IRs in SSA-form—e.g., LLVM), so for each optimization you can decide whether to run it before or after CPS.
- 1st-class values never refer to 2nd-class values
- 1st-class values are heap-allocated
- 2nd-class values are kept on the stack