Inlining as staged computation

  • Authors:
  • Stefan Monnier;Zhong Shao

  • Affiliations:
  • Department of Computer Science, Yale University, New Haven, CT 06520-8285, USA (e-mail: monnier@cs.yale.edu);Department of Computer Science, Yale University, New Haven, CT 06520-8285, USA (e-mail: shao@cs.yale.edu)

  • Venue:
  • Journal of Functional Programming
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Inlining and specialization appear in various forms throughout the implementation of modern programming languages. From mere compiler optimizations to sophisticated techniques in partial evaluation, they are omnipresent, yet each application is treated differently. This paper is an attempt at uncovering the relations between inlining (as done in production compilers) and staged computation (as done in partial evaluators) in the hope of bringing together the research advances in both fields. Using a two-level lambda calculus as the intermediate language, we show how to model inlining as a staged computation while avoiding unnecessary code duplication. The new framework allows us to define inlining annotations formally and to reason about their interactions with module code. In fact, we present a cross-module inlining algorithm that inlines all functions marked inlinable, even in the presence of ML-style parameterized modules.