Skip to main content

Syntactic detection of single-threading using continuations

  • Conference paper
  • First Online:
Functional Programming Languages and Computer Architecture (FPCA 1991)

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

Abstract

We tackle the problem of detecting global variables in functional programs. We present syntactic criteria for single-threading which improves upon previous solutions (both syntactic and semantics-based) in that it applies to higher-order languages and to most sequential evaluation strategies. The main idea of our approach lies in the use of continuations. One advantage of continuation expressions is that evaluation ordering is made explicit in the syntax of expressions. So, syntactic detection of single-threading is simpler and more powerful on continuation expressions. We present the application of the analysis to the compilation of functional languages, semantics-directed compiler generation and globalization-directed transformations (i.e. transforming non-single-threaded expressions into single-threaded ones). Our results can also be turned to account to get single-threading criteria on regular λ-expressions for different sequential evaluation orders.

Part of this research was done during a visit to Kansas State University (thanks to David Schmidt).

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A.V.Aho, R. Sethi and J.D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986.

    Google Scholar 

  2. A. Bloss. Update analysis and the efficient implementation of functional aggregates. In FPCA'89, pp. 26–38, ACM Press, 1989.

    Google Scholar 

  3. M. Draghicescu and S. Purushothaman. A compositional analysis of evaluation order and its application. In Proc. of 1990 Conf. on Lisp and Func. Prog., ACM Press, pp. 242–250, 1990.

    Google Scholar 

  4. M. J. Fisher. Lambda-calculus schemata. In Proc. of the ACM Conf. on Proving Properties about Programs, Sigplan Notices, Vol. 7(1), pp. 104–109,1972.

    Google Scholar 

  5. P. Fradet and D. Le Métayer. Compilation of λ-calculus into functional machine code. In Proc. TAPSOFT'89, LNCS vol. 352, pp. 155–166, 1989.

    Google Scholar 

  6. P. Fradet and D. Le Métayer. Compilation of functional languages by program transformation. ACM Trans. on Prog. Lang. and Sys., 13(1), pp. 21–51, 1991.

    Google Scholar 

  7. C.K. Gomard and P. Sestoft. Globalization and live variables. In Proc. of ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, Yale, June 1991. (to appear in Sigplan Notices)

    Google Scholar 

  8. J.Guzmán and P. Hudak. Single-threaded polymorphic lambda-calculus. In IEEE Symposium on Logic in Computer Science, June 1990.

    Google Scholar 

  9. P. Hudak. A semantic model of reference counting and its abstraction. In Proc. of Conf. on Lisp and Func. Prog., ACM Press, pp. 351–363, 1986.

    Google Scholar 

  10. K. Inoue, H. Seki and H. Yagi. Analysis of functional programs to detect run-time garbage cells. ACM Trans. on Prog. Lang. and Sys., 10(4), 1988, 555–578.

    Google Scholar 

  11. N.D. Jones Ed. Semantics-Directed Compiler Generation. LNCS Vol. 94, 1980.

    Google Scholar 

  12. S.B. Jones and D. Le Métayer. Compile-time garbage collection by sharing analysis. In FPCA'89, pp.54–74, ACM Press, 1989.

    Google Scholar 

  13. U. Kastens and M. Schmidt. Lifetime analysis for procedure parameters. In ESOP 86, LNCS Vol. 213, pp.53–69, 1986.

    Google Scholar 

  14. D. Kranz, R. Kelsey, J. Rees, P. Hudak, J. Philbin and N. Adams. Orbit: An optimizing compiler for Scheme. In proc. of 1986 ACM SIGPLAN Symp. on Comp. Construction, 219–233, 1986.

    Google Scholar 

  15. D. Lass. Detection of single-threading properties in combinator notations. Ph.D. Thesis, Iowa State University, 1991.

    Google Scholar 

  16. G.D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science 1, pp. 125–159, 1975.

    Google Scholar 

  17. J.-C. Raoult and R. Sethi. The global storage needs of a subcomputation. In Proc. ACM Symp. on Princ. of Prog. Lang., 1984, 148–157.

    Google Scholar 

  18. P. Sestoft. Replacing function parameters by global variables. In FPCA'89, ACM Press, pp.39–53, 1989. (see also Tech. Report 88-7-2, University of Copenhagen, 1988.)

    Google Scholar 

  19. D.A. Schmidt. Detecting global variables in denotational specifications. ACM Trans. on Prog. Lang. and Sys., vol. 7, 1985, 299–310.

    Google Scholar 

  20. D.A. Schmidt. Detecting stack-based environments in denotational definitions. Science of Computer Programming, 11(2), 1988.

    Google Scholar 

  21. D.A. Schmidt. Denotational Semantics. A Methodology for Language Development. Allyn & Bacon, 1986.

    Google Scholar 

  22. J.E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory, MIT Press, Cambridge, Mass., 1977.

    Google Scholar 

  23. P. Wadler. Linear types can change the world! In IFIP Working Conf. on Programming Concepts and Methods, North Holland, 1990.

    Google Scholar 

  24. P. Wadler. Comprehending monads. In Proc. of 1990 Conf. on Lisp and Func. Prog., ACM Press, pp. 61–78, 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

John Hughes

Rights and permissions

Reprints and permissions

Copyright information

© 1991 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Fradet, P. (1991). Syntactic detection of single-threading using continuations. In: Hughes, J. (eds) Functional Programming Languages and Computer Architecture. FPCA 1991. Lecture Notes in Computer Science, vol 523. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3540543961_12

Download citation

  • DOI: https://doi.org/10.1007/3540543961_12

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-54396-1

  • Online ISBN: 978-3-540-47599-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics