skip to main content
10.1145/581478.581504acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Final shift for call/cc:: direct implementation of shift and reset

Published:17 September 2002Publication History

ABSTRACT

We present a direct implementation of the shift and reset control operators in the SFE system. The new implementation improves upon the traditional technique of simulating shift and reset via callcc. Typical applications of these operators exhibit space savings and a significant overall performance gain. Our technique is based upon the popular incremental stack/heap strategy for representing continuations. We present implementation details as well as some benchmark measurements for typical applications.

References

  1. Vincent Balat and Olivier Danvy. Strong normalization by type-directed partial evaluation and run-time code generation. In Proceedings of the ACM SIGPLAN Workshop on Types in Compilation (TIC'98), number 1473 in Lecture Notes in Computer Science, Kyoto, Japan, March 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Edoardo Biagioni, Ken Cline, Peter Lee, Chris Okasaki, and Chris Stone. Safe-for-space threads in Standard ML. Higher-Order and Symbolic Computation, 11(2):209--225, December 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Carl Bruggeman, Oscar Waddell, and R. Kent Dybvig. Representing control in the presence of one-shot continuations. In Proc. of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation, pages 99--107, Philadelphia, PA, USA, May 1996. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. William D. Clinger, Dan P. Friedman, and Mitchell Wand. A scheme for a higher-level semantic algebra. In John Reynolds and Maurice Nivat, editors, Algebraic Methods in Semantics: Proceedings of the US-French Seminar on the Application of Algebra to Language Definition and Compilation, pages 237--250, Cambridge, 1985. Cambridge University Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. William D. Clinger, Anne Hartheimer, and Eric Ost. Implementation strategies for first-class continuations. Higher-Order and Symbolic Computation, 1(12):7--45, April 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Olivier Danvy. Type-directed partial evaluation. In John Hatcliff, Torben \AE. Mogensen, and Peter Thiemann, editors, Partial Evaluation---Practice and Theory. Proceedings of the 1998 DIKU International Summerschool, number 1706 in Lecture Notes in Computer Science, pages 367--411. Springer-Verlag, Copenhagen, Denmark, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Olivier Danvy. Formalizing implementation strategies for first-class continuations. In Gert Smolka, editor, Proc. 9th European Symposium on Programming, number 1782 in Lecture Notes in Computer Science, pages 88--103, Berlin, Germany, March 2000. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Olivier Danvy and Andrzej Filinski. Abstracting control. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pages 151--160, Nice, France, 1990. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Olivier Danvy and Andrzej Filinski. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 2:361--391, 1992.]]Google ScholarGoogle ScholarCross RefCross Ref
  10. Richard P. Draves. Control Transfer in Operating System Kernels. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213, May 1994. CMU-CS-94-142.]]Google ScholarGoogle Scholar
  11. Matthias Felleisen. The theory and practice of first-class prompts. In Proc. 15th Annual ACM Symposium on Principles of Programming Languages, pages 180--190, San Diego, California, January 1988. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Matthias Felleisen, Dan P. Friedman, Bruce Duba, and J. Merrill. Beyond continuations. Technical Report 216, Computer Science Department, Indiana University, Bloomington, Indiana, 1987.]]Google ScholarGoogle Scholar
  13. Andrzej Filinski. Representing monads. In Proceedings of the 1994 ACM SIGPLAN Symposium on Principles of Programming Languages, pages 446--457, Portland, OR, January 1994. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Andrzej Filinski. Representing layered monads. In Alexander Aiken, editor, Proceedings of the 1999 ACM SIGPLAN Symposium on Principles of Programming Languages, pages 175--188, San Antonio, Texas, USA, January 1999. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Carl Gunter, Didier Rémy, and John Riecke. A generalization of exceptions and control in ML-like languages. In Simon Peyton Jones, editor, Proc. Functional Programming Languages and Computer Architecture 1995, pages 12--23, La Jolla, CA, June 1995. ACM Press, New York.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Simon Helsen and Peter Thiemann. Two flavors of offline partial evaluation. In J. Hsiang and A. Ohori, editors, Advances in Computing Science - ASIAN'98, number 1538 in Lecture Notes in Computer Science, pages 188--205, Manila, The Philippines, December 1998.]]Google ScholarGoogle Scholar
  17. Robert Hieb, R. Kent Dybvig, and Carl Bruggeman. Representing control in the presence of first-class continuations. In Proc. Conference on Programming Language Design and Implementation '90, pages 66--77, White Plains, New York, USA, June 1990. ACM.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Graham Hutton and Erik Meijer. Monadic parsing in Haskell. Journal of Functional Programming, 8(4), 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Richard A. Kelsey. Pre-Scheme: A Scheme dialect for systems programming. June 1997.]]Google ScholarGoogle Scholar
  20. Richard A. Kelsey and Jonathan A. Rees. A tractable Scheme implementation. Lisp and Symbolic Computation, 7(4):315--335, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Julia Lawall and Olivier Danvy. Continuation-based partial evaluation. In Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pages 227--238, Orlando, Florida, USA, June 1994. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Julia Lawall and Olivier Danvy. Continuation-based partial evaluation. Technical Report Technical Report CS-95-178, Brandeis University, Waltham, Massachusetts, 1995. Extended version of {21} from ftp://ftp.brics.dk/pub/danvy/Papers/lawall-danvy-lfp94-extended.ps.gz.]]Google ScholarGoogle Scholar
  23. Luc Moreau and Christian Queinnec. Partial continuations as the difference of continuations --- a duumvirate of control operators. In Manuel V. Hermenegildo and Jaan Penjam, editors, International Symposium on Programming Languages, Implementations, Logics and Programs (PLILP '94), number 844 in Lecture Notes in Computer Science, Madrid, Spain, September 1994. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Dorai Sitaram and Matthias Felleisen. Control delimiters and their hierarchies. Lisp and Symbolic Computation, 3(1):67--99, January 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Eijiro Sumii and Naoki Kobayashi. A hybrid approach to online and offline partial evaluation. Higher-Order and Symbolic Computation, 14(2/3):101--142, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Peter Thiemann. Combinators for program generation. Journal of Functional Programming, 9(5):483--525, September 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Peter Thiemann. The PGG System---User Manual. Universität Freiburg, Freiburg, Germany, March 2000. Available from http://www.informatik.uni-freiburg.de/proglang/software/pgg/.]]Google ScholarGoogle Scholar

Index Terms

  1. Final shift for call/cc:: direct implementation of shift and reset

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming
      October 2002
      294 pages
      ISBN:1581134878
      DOI:10.1145/581478
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 37, Issue 9
        September 2002
        283 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/583852
        Issue’s Table of Contents

      Copyright © 2002 ACM

      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]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 17 September 2002

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      ICFP '02 Paper Acceptance Rate24of76submissions,32%Overall Acceptance Rate333of1,064submissions,31%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader