skip to main content
research-article

Modular, higher-order cardinality analysis in theory and practice

Published:08 January 2014Publication History
Skip Abstract Section

Abstract

Since the mid '80s, compiler writers for functional languages (especially lazy ones) have been writing papers about identifying and exploiting thunks and lambdas that are used only once. However it has proved difficult to achieve both power and simplicity in practice. We describe a new, modular analysis for a higher-order language, which is both simple and effective, and present measurements of its use in a full-scale, state of the art optimising compiler. The analysis finds many single-entry thunks and one-shot lambdas and enables a number of program optimisations.

Skip Supplemental Material Section

Supplemental Material

d2_right_t4.mp4

References

  1. Erik Barendsen and Sjaak Smetsers. Uniqueness typing for functional languages with graph rewriting semantics. Mathematical Structures in Computer Science, 6(6):579--612, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  2. Andy Gill. Cheap Deforestation for Non-strict Functional Languages. PhD thesis, University of Glasgow, Department of Computer Schence, 1996.Google ScholarGoogle Scholar
  3. Andy Gill, John Launchbury, and Simon Peyton Jones. A Short Cut to Deforestation. In Proceedings of the Sixth ACM Conference on Functional Programming Languages and Computer Architecture, pages 223--232, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Jean-Yves Girard. Linear logic: its syntax and semantics. In Proceedings of the workshop on Advances in linear logic, pages 1--42. Cambridge University Press, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Benjamin Goldberg. Detecting sharing of partial applications in functional programs. In Functional Programming Languages and Computer Architecture, volume 274 of LNCS, pages 408--425. Springer-Verlag, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jörgen Gustavsson. A type based sharing analysis for update avoidance and optimisation. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (ICFP'98), pages 39--50. ACM, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jörgen Gustavsson and Josef Sveningsson. A usage analysis with bounded usage polymorphism and subtyping. In Implementation of Functional Languages (IFL 2000), Selected Papers, volume 2011 of LNCS, pages 140--157. Springer, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Jurriaan Hage, Stefan Holdermans, and Arie Middelkoop. A generic usage analysis with subeffect qualifiers. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming (ICFP'07), pages 235--246. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Ralf Hinze. Projection-based strictness analysis - theoretical and practical aspects. PhD thesis, Bonn University, 1995.Google ScholarGoogle Scholar
  10. Stefan Holdermans and Jurriaan Hage. Making "stricternes" more relevant. In PEPM'10: Proceedings of the 2010 ACM SIGPLAN workshop on Partial evaluation and program manipulation, pages 121--130. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Paul Hudak. A semantic model of reference counting and its abstraction. In Proceedings of the 1986 ACM Conference on Lisp and Functional Programming, pages 351--363. ACM, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Richard Jones. Tail recursion without space leaks. J. Funct. Program., 2 (1):73--79, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  13. John Launchbury, Andy Gill, John Hughes, Simon Marlow, Simon Peyton Jones, and PhilipWadler. Avoiding unnecessary updates. In Proceedings of the 1992 GlasgowWorkshop on Functional Programming,Workshops in Computing, pages 144--153. Springer, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Simon Marlow and Simon Peyton Jones. Making a fast curry: push/enter vs. eval/apply for higher-order languages. J. Funct. Program., 16(4-5): 415--449, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Matthew Might and Olin Shivers. Improving flow analyses via ΓCFA: abstract garbage collection and counting. In Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming (ICFP'06), pages 13--25. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Andrew Moran and David Sands. Improvement in a Lazy Context: An Operational Theory for Call-by-Need. In POPL'99: Proceedings of the 26th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 43--56. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Will Partain. The nofib benchmark suite of Haskell programs. In Proceedings of the 1992 Glasgow Workshop on Functional Programming, Workshops in Computing, pages 195--202. Springer, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Simon Peyton Jones. Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine. J. Funct. Program., 2(2): 127--202, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  19. Simon Peyton Jones andWill Partain. Measuring the effectiveness of a simple strictness analyser. In Proceedings of the 1993 Glasgow Workshop on Functional Programming, pages 201--220. Springer, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  20. Simon Peyton Jones and André Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32(1-3):3--47, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Simon Peyton Jones, Will Partain, and André Santos. Let-floating: Moving Bindings to Give Faster Programs. In Proceedings of the First ACM SIGPLAN International Conference on Functional Programming (ICFP'96), pages 1--12. ACM, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Amr Sabry and Matthias Felleisen. Reasoning about programs in continuation-passing style. In Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, pages 288--298. ACM, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ilya Sergey, Dimitrios Vytiniotis, and Simon Peyton Jones. Modular, Higher-Order Cardinality Analysis in Theory and Practice. Extended version. Technical Report MSR-TR-2013--112, Microsoft Research, 2013. Available at http://research.microsoft.com/apps/pubs/?id=204260.Google ScholarGoogle Scholar
  24. Peter Sestoft. Deriving a lazy abstract machine. J. Funct. Program., 7(3): 231--264, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. David N. Turner and Philip Wadler. Operational interpretations of linear logic. Theor. Comput. Sci., 227(1-2):231--248, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. David N. Turner, Philip Wadler, and Christian Mossin. Once upon a type. In Proceedings of the Seventh ACM Conference on Functional Programming Languages and Computer Architecture, pages 1--11. ACM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. David Van Horn and Matthew Might. Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming(ICFP'10), pages 51--62. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Philip Wadler and John Hughes. Projections for strictness analysis. In Functional Programming Languages and Computer Architecture, volume 274 of LNCS, pages 385--407. Springer-Verlag, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Keith Wansbrough. Simple Polymorphic Usage Analysis. PhD thesis, Computer Laboratory, University of Cambridge, 2002.Google ScholarGoogle Scholar
  30. Keith Wansbrough and Simon Peyton Jones. Once Upon a Polymorphic Type. In POPL'99: Proceedings of the 26th annual ACM SIGPLANSIGACT symposium on Principles of programming languages, pages 15--28. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Modular, higher-order cardinality analysis in theory and practice

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!