Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2661103.2661106acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Optimizing closures in O(0) time

Published: 09 September 2012 Publication History
  • Get Citation Alerts
  • Abstract

    The flat-closure model for the representation of first-class procedures is simple, safe-for-space, and efficient, allowing the values or locations of free variables to be accessed with a single memory indirect. It is a straightforward model for programmers to understand, allowing programmers to predict the worst-case behavior of their programs. This paper presents a set of optimizations that improve upon the flat-closure model along with an algorithm that implements them, and it shows that the optimizations together eliminate over 50% of run-time closure-creation and free-variable access overhead in practice, with insignificant compile-time overhead. The optimizations never add overhead and remain safe-for-space, thus preserving the benefits of the flat-closure model.

    References

    [1]
    A. Appel. Private communication. 1994.
    [2]
    A. W. Appel. Compiling with Continuations. Cambridge University Press, 40 West 20th Street, New York, NY 10011-4211, 1992.
    [3]
    A. W. Appel. Closure conversion, chapter 10, pages 103--124. Cambridge University Press, 40 West 20th Street, New York, NY 10011-4211, 1992.
    [4]
    L. Cardelli. The functional abstract machine. Technical report, Bell Laboratories, 1983.
    [5]
    W. D. Clinger. Description of benchmarks, 2008. URL http://www.larcenists.org/benchmarksAboutR6.html. Accessed Oct 20, 2011.
    [6]
    I. Dragoş. Optimizing Higher-Order Functions in Scala. In Third International Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems, 2008.
    [7]
    R. K. Dybvig. Three Implementation Models for Scheme. PhD thesis, University of North Carolina, Chapel Hill, Apr. 1987.
    [8]
    P. Fradet and D. Le Métayer. Compilation of functional languages by program transformation. ACM Trans. Program. Lang. Syst., 13:21--51, January 1991. ISSN 0164-0925. URL http://doi.acm.org/10.1145/114005.102805.
    [9]
    A. Ghuloum and R. K. Dybvig. Fixing letrec (reloaded). In Proceedings of the 2009 Workshop on Scheme and Functional Programming, pages 57--65, 2009.
    [10]
    J. Guy L. Steele. Rabbit: A compiler for scheme. Technical report, Massachusetts Institute of Technology, Cambridge, MA, USA, 1978.
    [11]
    T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In Proceedings 1985 Conference on Functional Programming Languages and Compiler Architecture, pages 190--203. Springer-Verlag, 1985.
    [12]
    D. A. Kranz. ORBIT: An Optimizing Compiler for Scheme. PhD thesis, Yale University, 1988.
    [13]
    M. Serrano. Control flow analysis: A functional languages compilation paradigm. In Proceedings of the 1995 ACM symposium on Applied computing, pages 118--122. ACM, 1995.
    [14]
    Z. Shao and A. W. Appel. Efficient and safe-for-space closure conversion. ACM TOPLAS, 22:129--161, 2000.
    [15]
    O. Shivers. Control flow analysis in Scheme. In Proceedings of the ACM SIGPLAN 1988 conference on Programming Language design and Implementation, pages 164--174. ACM, 1988.
    [16]
    M. Sperber, R. K. Dybvig, M. Flatt, A. Van Straaten, R. Findler, and J. Matthews. Revised6 report on the algorithmic language scheme. Journal of Functional Programming, 19(Supplement S1):1--301, 2009. URL http://dx.doi.org/10.1017/S0956796809990074.
    [17]
    P. A. Steckler and M. Wand. Lightweight closure conversion. ACM Trans. Program. Lang. Syst., 19:48--86, January 1997. ISSN 0164-0925. URL http://doi.acm.org/10.1145/239912.239915.
    [18]
    R. E. Tarjan. Depth-first search and linear graph algorithms. SIAM J. Comput., 1(2):146--160, 1972.
    [19]
    O. Waddell, D. Sarkar, and R. K. Dybvig. Fixing letrec: A faithful yet efficient implementation of Scheme's recursive binding construct. Higher-order and and symbolic computation, 18(3/4):299--326, 2005.

    Cited By

    View all
    • (2019)Closure conversion is safe for spaceProceedings of the ACM on Programming Languages10.1145/33416873:ICFP(1-29)Online publication date: 26-Jul-2019
    • (2019)Toward efficient gradual typing for structural types via coercionsProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314627(517-532)Online publication date: 8-Jun-2019
    • (2017)Compiling without continuationsACM SIGPLAN Notices10.1145/3140587.306238052:6(482-494)Online publication date: 14-Jun-2017
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    Scheme '12: Proceedings of the 2012 Annual Workshop on Scheme and Functional Programming
    September 2012
    99 pages
    ISBN:9781450318952
    DOI:10.1145/2661103
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 09 September 2012

    Permissions

    Request permissions for this article.

    Check for updates

    Qualifiers

    • Research-article

    Conference

    ICFP'12
    Sponsor:

    Acceptance Rates

    Scheme '12 Paper Acceptance Rate 4 of 4 submissions, 100%;
    Overall Acceptance Rate 4 of 4 submissions, 100%

    Upcoming Conference

    ICFP '24

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)23
    • Downloads (Last 6 weeks)1

    Other Metrics

    Citations

    Cited By

    View all
    • (2019)Closure conversion is safe for spaceProceedings of the ACM on Programming Languages10.1145/33416873:ICFP(1-29)Online publication date: 26-Jul-2019
    • (2019)Toward efficient gradual typing for structural types via coercionsProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314627(517-532)Online publication date: 8-Jun-2019
    • (2017)Compiling without continuationsACM SIGPLAN Notices10.1145/3140587.306238052:6(482-494)Online publication date: 14-Jun-2017
    • (2017)Compiling without continuationsProceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3062341.3062380(482-494)Online publication date: 14-Jun-2017
    • (2013)A nanopass framework for commercial compiler developmentACM SIGPLAN Notices10.1145/2544174.250061848:9(343-350)Online publication date: 25-Sep-2013
    • (2013)A nanopass framework for commercial compiler developmentProceedings of the 18th ACM SIGPLAN international conference on Functional programming10.1145/2500365.2500618(343-350)Online publication date: 25-Sep-2013

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media