Lambda-lifting in Quadratic Time

O. Danvy, U.P. Schultz

    Research output: Contribution to journal/Conference contribution in journal/Contribution to newspaperJournal articleResearchpeer-review

    Abstract

    Lambda-lifting is a program transformation that is used in compilers, partial evaluators, and program transformers. In this article, we show how to reduce its complexity from cubic time to quadratic time, and we present a flow-sensitive lambda-lifter that also works in quadratic time. Lambda-lifting transforms a block-structured program into a set of recursive equations, one for each local function in the source program. Each equation carries extra parameters to account for the free variables of the corresponding local function and of all its callees. It is the search for these extra parameters that yields the cubic factor in the traditional formulation of lambda-lifting, which is due to Johnsson. This search is carried out by computing a transitive closure. To reduce the complexity of lambda-lifting, we partition the call graph of the source program into strongly connected components, based on the simple observation that all functions in each component need the same extra parameters and thus a transitive closure is not needed. We therefore simplify the search for extra parameters by treating each strongly connected component instead of each function as a unit, thereby reducing the time complexity of lambda-lifting from O(n^3) to O(n^2) . where n is the size of the program. Since a lambda-lifter can output programs of size O(n^2), our algorithm is asympotically optimal.
    Original languageEnglish
    JournalJournal of Functional and Logic Programming (JFLP)
    Volume2004
    Issue1
    Number of pages43
    Publication statusPublished - 2004

    Fingerprint

    Dive into the research topics of 'Lambda-lifting in Quadratic Time'. Together they form a unique fingerprint.

    Cite this