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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- Olivier Danvy and Andrzej Filinski. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 2:361--391, 1992.]]Google ScholarCross Ref
- 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 Scholar
- 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 ScholarDigital Library
- Matthias Felleisen, Dan P. Friedman, Bruce Duba, and J. Merrill. Beyond continuations. Technical Report 216, Computer Science Department, Indiana University, Bloomington, Indiana, 1987.]]Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- Graham Hutton and Erik Meijer. Monadic parsing in Haskell. Journal of Functional Programming, 8(4), 1998.]] Google ScholarDigital Library
- Richard A. Kelsey. Pre-Scheme: A Scheme dialect for systems programming. June 1997.]]Google Scholar
- Richard A. Kelsey and Jonathan A. Rees. A tractable Scheme implementation. Lisp and Symbolic Computation, 7(4):315--335, 1995.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- Dorai Sitaram and Matthias Felleisen. Control delimiters and their hierarchies. Lisp and Symbolic Computation, 3(1):67--99, January 1990.]] Google ScholarDigital Library
- 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 ScholarDigital Library
- Peter Thiemann. Combinators for program generation. Journal of Functional Programming, 9(5):483--525, September 1999.]] Google ScholarDigital Library
- 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 Scholar
Index Terms
- Final shift for call/cc:: direct implementation of shift and reset
Recommendations
Final shift for call/cc:: direct implementation of shift and reset
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 ...
Implementation Strategies for First-Class Continuations
Scheme and Smalltalk continuations may have unlimited extent. This means that a purely stack-based implementation of continuations, as suffices for most languages, is inadequate. We review several implementation strategies for continuations and compare ...
Using a Continuation Twice and Its Implications for the Expressive Power of call/cc
We study the implications for the expressive power of call/cc of upward continuations, specifically the idiom of using a continuation twice. Although such control effects were known to Landin and Reynolds when they invented J and {\tt escape} , the ...
Comments