Skip to main content

Path analysis for lazy data structures

  • Conference paper
  • First Online:
Programming Language Implementation and Logic Programming (PLILP 1992)

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

  • 174 Accesses

Abstract

We present a method to statically infer evaluation order information for data structures in typed lazy functional programs. Our goal is to determine in what order and to what extent variables and data structures are evaluated. This subsumes backwards data structure strictness analysis and can be used to optimize the implementation of suspensions (or “thunks”) in lazy languages.

The order of evaluation of the variables in an expression is described by variable paths, which are sequences of variables. The evaluation order of a data structure is described by a context. This is the type of the data structure together with path sets describing the order of evaluation of its components. Thus for the type natlist:≔ Nil ¦ Cons nat natlist we record the order in which the nat and natlist fields of Cons are evaluated (if at all).

To obtain a terminating analysis, only uniform contexts are allowed for recursively defined types such as natlist: all the recursive components (those of type natlist) must have the same description.

Contexts seem to be natural tools for describing and reasoning with data structure strictness. In particular, one can characterize head strictness also in the absence of tail strictness.

The main advantage of this work over previous work [2] [4] is the handling of data structures.

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. Bloss. Path Analysis and the Optimization of Non-Strict Functional Languages. PhD thesis, Computer Science Department, Yale University, New Haven, Connecticut, USA, May 1989. Also: Research Report YALEU/DCS/RR-704. 129 pages.

    Google Scholar 

  2. A. Bloss and P. Hudak. Path semantics. In M. Main et al., editors, Mathematical Foundations of Programming Language Semantics, 3rd Workshop, New Orleans, Louisiana. (Lecture Notes in Computer Science, vol. 298), pages 476–489. Springer-Verlag, 1988.

    Google Scholar 

  3. A. Bloss, P. Hudak, and J. Young. Code optimizations for lazy evaluation. Lisp and Symbolic Computation, 1(2):147–164, September 1988.

    Google Scholar 

  4. M. Draghicescu and S. Purushothaman. A compositional analysis of evaluation-order and its application. In 1990 ACM Conference on Lisp and Functional Programming, Nice, France, pages 242–250. ACM Press, 1990.

    Google Scholar 

  5. M. Draghicescu and S. Purushothaman. Static analysis of lazy functional languages. University of Massachusetts at Boston. 28 pages. Submitted to Theoretical Computer Science, 1991.

    Google Scholar 

  6. C.K. Gomard. Program Analysis Matters. PhD thesis, DIKU, University of Copenhagen, Denmark, November 1991. Also DIKU Report 91/17.

    Google Scholar 

  7. C.K. Gomard and P. Sestoft. Evaluation order analysis for lazy data structures. In Preliminary Proceedings, Fifth Glasgow Functional Programming Workshop, Isle of Skye, Scotland, August 1991, pages 125–149. Department of Computing Science, University of Glasgow, Scotland, 1991.

    Google Scholar 

  8. P. Hudak and J. Young. Higher-order strictness analysis in untyped lambda calculus. In Thirteenth ACM Symp. Principles of Programming Languages, St. Petersburg, Florida, 1986, pages 97–109, 1986

    Google Scholar 

  9. P. Sestoft. Analysis and Efficient Implementation of Functional Programs. PhD thesis, DIKU, University of Copenhagen, Denmark, October 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Maurice Bruynooghe Martin Wirsing

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gomard, C.K., Sestoft, P. (1992). Path analysis for lazy data structures. In: Bruynooghe, M., Wirsing, M. (eds) Programming Language Implementation and Logic Programming. PLILP 1992. Lecture Notes in Computer Science, vol 631. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55844-6_127

Download citation

  • DOI: https://doi.org/10.1007/3-540-55844-6_127

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55844-6

  • Online ISBN: 978-3-540-47297-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics