Skip to main content

Lazy Stack Copying and Stack Copy Sharing for the Efficient Implementation of Continuations

  • Conference paper
Programming Languages and Systems (APLAS 2003)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2895))

Included in the following conference series:

Abstract

In order to capture first-class continuations, most stack-based implementations copy contents of the stack to the heap. While various implementation strategies for copying have been proposed, many implementations employ the stack strategy. With this strategy, the entire stack contents is copied to the heap whenever a continuation is captured. This simple strategy is easy to implement and can be used for implementations with foreign language interface. However, this strategy requires a lot of time and memory for creation and invocation of continuations. We propose a lazy stack copying technique. The contents of the stack to copy are preserved on the stack until the function returns that has captured the continuation. So we delay stack copying for the continuation until the function returns. We can avoid stack copying if it is detected that the continuation has become garbage before the function returns. In addition, we propose stack copy sharing, which is realized by using lazy stack copying. We present three models for stack copy sharing. We applied these techniques to Scheme systems and found that the proposed techniques improve runtime and memory efficiency of programs that use first-class continuations.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. IEEE-1178-1990: IEEE Standard for the Scheme Programming Language. IEEE (1991)

    Google Scholar 

  2. Revised5 Report on the Algorithmic Language Scheme. In: Kelsey, R., Clinger, W., Rees, J. (eds.) Higher-Order and Symbolic Computation, vol. 11, Kluwer Academic Publishers, Dordrecht (1998)

    Google Scholar 

  3. Clinger, W.D., Hartheimer, A.H., Ost, E.M.: Implementation strategies for firstclass continuations. In: Higher-Order and Symbolic Computation, vol. 12, pp. 7–45. Kluwer Academic Publishers, Dordrecht (1999)

    Google Scholar 

  4. Jones, R., Lins, R.: Garbage Collection. John Wiley & Sons, Chichester (1996)

    MATH  Google Scholar 

  5. Yuasa, T., Nakagawa, Y., Komiya, T., Yasugi, M.: Return barrier. In: Proceedings International Lisp Conference, San Francisco (2002) (to appear)

    Google Scholar 

  6. Ugawa, T., Komiya, T., Yasugi, M., Yuasa, T.: Lazy stack copying for efficient implementation of continuations. In: Nineteenth Conference Proceedings Japan Society for Software Science and Technology, Japan Society for Software Science and Technology (2002) (in Japanese)

    Google Scholar 

  7. Jaffer, A.: SCM Manual (2003)

    Google Scholar 

  8. Appel, A.W., MacQueen, D.B.: Standard ML of New Jersey. In: Wirsing, M. (ed.) Third Int’l Symp. on Prog. Lang. Implementation and Logic Programming, pp. 1–13. Springer, New York (1991)

    Google Scholar 

  9. Appel, A.W.: Compiling with Continuations. Cambridge University Press, Cambridge (1992)

    Google Scholar 

  10. Flatt, M.: PLT MzScheme: Langurage manual (2000)

    Google Scholar 

  11. Gabriel, R.: Performance and Evaluation of Lisp Systems. MIT Press, Cambridge (1985)

    Google Scholar 

  12. Baker, H.G.: CONS should not CONS its arguments, or, a lazy alloc is a smart alloc. ACM SIGPLAN Notices 27, 24–34 (1992)

    Article  Google Scholar 

  13. Kelsey, R.A., Rees, J.A.: A tractable Scheme implementation. Lisp and Symbolic Computation 7, 315–335 (1994)

    Article  Google Scholar 

  14. Clinger, W.D., Hansen, L.T.: Lambda, the ultimate label or a simple optimizing compiler for scheme. In: Proceedings 1994 ACM Conference on Lisp and Functional Programming, pp. 128–139. ACM Press, New York (1994)

    Chapter  Google Scholar 

  15. Samples, A.D., Ungar, D., Hilfinger, P.: SOAR: Smalltalk without bytecodes. In: Proceedings OOPSLA 1986. ACM SIGPLAN Notices, vol. 21, pp. 107–118 (1986)

    Google Scholar 

  16. Goldberg, A., Robson, D.: Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading (1983)

    MATH  Google Scholar 

  17. Friedman, D.P., Wise, D.S.: The one-bit reference count. BIT 17, 351–359 (1977)

    Article  Google Scholar 

  18. Mohr, E., Kranz, D.A., Halstead, J. R.H.: Lazy task creation: a technique for increasing the granularity of parallel programs. In: Proceedings of the 1990 ACM conference on LISP and functional programming, pp. 185–197. ACM Press, New York (1990)

    Chapter  Google Scholar 

  19. Goldstein, S.C., Schauser, K.E., Culler, D.E.: Enabling Primitives for Compiling Parallel Languages. In: Third Workshop on Languages, Compilers, and Run-Time Systems for Scalable Computers (1995)

    Google Scholar 

  20. Taura, K., Yonezawa, A.: Fine-grain multithreading with minimal compiler support - a cost effective approach to implementing efficient multithreading languages. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 320–333 (1997)

    Google Scholar 

  21. Chakravarty, M.M.T.: Lazy thread and task creation in parallel graph reduction. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, p. 231. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Ugawa, T., Minagawa, N., Komiya, T., Yasugi, M., Yuasa, T. (2003). Lazy Stack Copying and Stack Copy Sharing for the Efficient Implementation of Continuations. In: Ohori, A. (eds) Programming Languages and Systems. APLAS 2003. Lecture Notes in Computer Science, vol 2895. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-40018-9_27

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-40018-9_27

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20536-4

  • Online ISBN: 978-3-540-40018-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics