Advertisement

An efficient implementation for coroutines

  • Luis Mateu
Functional Languages
Part of the Lecture Notes in Computer Science book series (LNCS, volume 637)

Abstract

Emulating coroutines with first-class continuations imposes an unacceptable overhead in managing function frames when there is an intensive exchange of control. This paper presents a high-performance implementation for a restricted class of continuations. These continuations are exploited in a simple coroutine mechanism, reaching a rate of 430,000 control exchanges per second on a modern RISC processor. As an extra feature, first-class continuations are recovered from the restricted class.

Keywords

coroutines continuations garbage collection dynamic variables shallow binding 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Appel 87]
    Andrew W. Appel: “Garbage Collection Can Be Faster Than Stack Allocation,” Information Processing Letters 25, 1987, 275–279.CrossRefGoogle Scholar
  2. [Appel 89]
    Andrew W. Appel: “Simple Generational Garbage Collection and Fast Allocation”, Software-Practice and Experience, 19(2), February 1989, 171–183.Google Scholar
  3. [Bobrow & Wegbreit 73]
    Daniel G. Bobrow and Ben Wegbreit: “A Model and Stack Implementation of Multiple Environments,” Communications of the ACM, 16(10), October 1973, 591–603.CrossRefGoogle Scholar
  4. [Clinger et al 88]
    William D. Clinger, Anne H. Hartheimer and Eric M. Ost: “Implementation Strategies for Continuations,” Proceedings of the 1988 ACM Conference on Lisp and Functional Programming, July 1988, 124–131.Google Scholar
  5. [Gabriel 85]
    Richard P. Gabriel: Performance and Evaluation of Lisp Systems, the MIT Press, 1985.Google Scholar
  6. [Haynes et al 86]
    Christopher T. Haynes, Daniel P. Friedman and Mitchell Wand: “Obtaining Coroutines with Continuations”, Computer Languages, 11(3/4), 1986, 143–153.CrossRefGoogle Scholar
  7. [Hieb et al 90]
    Robert Hieb, R. Kent Dybvig and Carl Bruggeman: “Representing Control in Presence of First-Class Continuations,” Proceedings of the ACM SIGPLAN'90 Conference on Programming Language Design and Implementation, White Plains, New York, June 20–22, 1990, 66–77.Google Scholar
  8. [Lieberman &: Hewitt 83]
    Henry Lieberman and Carl Hewitt: “A Real-Time Garbage Collector Based on the Lifetimes of Objects,” Communications of the ACM, 26(6), June 1983, 419–429.CrossRefGoogle Scholar
  9. [Nakajima 88]
    Katsuto Nakajima: “Piling GC — Efficient Garbage Collection for AI Languages —,” Parallel Processing, M. Cosnard, M. H. Barton and M. Vanneschi (Editors), Elsevier Science Publishers B.V. (North Holland), IFIP, 1988, 201–204.Google Scholar
  10. [Rees & Clinger 86]
    Jonathan A. Rees and William Clinger, eds.: “The Revised3 Report on the Algorithmic Language Scheme,” SIGPLAN Notices, 21(12), December 1986.Google Scholar
  11. [Seniak 91]
    Nitsan Séniak: Théorie et pratique de Sqil, un langage intermédiaire pour la compilation des langages fonctionnels, Thèse de Doctorat de l'Université Paris 6, October 1991.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1992

Authors and Affiliations

  • Luis Mateu
    • 1
    • 2
  1. 1.INRIALe Chesnay CedexFrance
  2. 2.Universidad de ChileChile

Personalised recommendations