Optimal Lambda Lifting in Quadratic Time

The process of lambda lifting flattens a program by lifting all local function definitions to the global level. Optimal lambda lifting computes the minimal set of extraneous parameters needed by each function as is done by the O(n3) equation-based algorithm proposed by Johnsson. In contrast, modern lambda lifting algorithms have used a graph-based approach to compute the set of extraneous parameters needed by each function. Danvy and Schultz proposed an algorithm that reduced the complexity of lambda lifting from O(n3) to O(n2). Their algorithm, however, is an approximation of optimal lambda lifting. Morazan and Mucha proposed an optimal graph-based algorithm at the expense of raising the complexity to O(n3). Their algorithm, however, suggested that dominator trees might be used to develop an O(n2) algorithm. This article explores the relationship between the call graph of a program, its dominator tree, and lambda lifting by developing algorithms for successively richer sets of programs. The result of this exploration is an O(n2) optimal lambda lifting algorithm.

[1]  A. Gibbons Algorithmic Graph Theory , 1985 .

[2]  Olivier Danvy,et al.  Lambda-Lifting in Quadratic Time , 2002, J. Funct. Log. Program..

[3]  Simon Peyton Jones,et al.  The Implementation of Functional Programming Languages (Prentice-hall International Series in Computer Science) , 1987 .

[4]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[5]  Ronald J. Gould,et al.  Graph theory , 1988 .

[6]  Matthias Felleisen,et al.  Automatically Restructuring Programs for the Web , 2004, Automated Software Engineering.

[7]  Charles Consel,et al.  A tour of Schism: a partial evaluation system for higher-order applicative languages , 1993, PEPM '93.

[8]  Marco T. Morazán,et al.  Improved Graph-Based Lambda Lifting , 2006, Software Engineering Research and Practice.

[9]  Mitchell Wand,et al.  The VLISP verified PreScheme compiler , 1995, LISP Symb. Comput..

[10]  Olivier Danvy,et al.  Lambda-dropping: transforming recursive equations into programs with block structure , 2000, Theor. Comput. Sci..

[11]  Marco T. Morazán Towards Closureless Functional Languages , 2005, PLC.

[12]  Mikkel Thorup,et al.  Dominators in Linear Time , 1999, SIAM J. Comput..

[13]  Simon Peyton Jones,et al.  Implementing Functional Languages: a tutorial , 2000 .

[14]  Thomas Johnsson,et al.  Target code generation from G-machine code , 1987, Graph Reduction.

[15]  Mitchell Wand,et al.  Essentials of programming languages , 2008 .

[16]  Simon L. Peyton Jones,et al.  A modular fully‐lazy lambda lifter in Haskell , 1991, Softw. Pract. Exp..

[17]  Thomas Johnsson,et al.  Lambda Lifting: Treansforming Programs to Recursive Equations , 1985, FPCA.