Hostname: page-component-586b7cd67f-t7fkt Total loading time: 0 Render date: 2024-12-04T08:23:35.880Z Has data issue: false hasContentIssue false

Modular, higher order cardinality analysis in theory and practice

Published online by Cambridge University Press:  16 February 2017

ILYA SERGEY
Affiliation:
University College London, London, UK (e-mail: i.sergey@ucl.ac.uk)
DIMITRIOS VYTINIOTIS
Affiliation:
Microsoft Research, Cambridge, UK (e-mail: dimitris@microsoft.com, simonpj@microsoft.com)
SIMON L. PEYTON JONES
Affiliation:
Microsoft Research, Cambridge, UK (e-mail: dimitris@microsoft.com, simonpj@microsoft.com)
JOACHIM BREITNER
Affiliation:
University of Pennsylvania, Pennsylvania, USA (e-mail: joachim@cis.upenn.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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. In this paper, we describe a new, modular analysis for a higher order language, which is both simple and effective. We prove the analysis sound with respect to a standard call-by-need semantics, 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. This paper extends our preceding conference publication (Sergey et al. 2014 Proceedings of the 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2014). ACM, pp. 335–348) with proofs, expanded report on evaluation and a detailed examination of the factors causing the loss of precision in the analysis.

Type
Articles
Copyright
Copyright © Cambridge University Press 2017 

References

Barendsen, E. & Smetsers, S. (1996) Uniqueness typing for functional languages with graph rewriting semantics. Math. Struct. Comput. Sci. 6 (6), 579612.CrossRefGoogle Scholar
Breitner, J. (2015a) Call arity. In Trends in functional programming. LNCS, vol. 8843. Springer, pp. 3450.CrossRefGoogle Scholar
Breitner, J. (2015b) Formally proving a compiler transformation safe. In Proceedings of the ACM SIGPLAN Workshop on Haskell. ACM, pp. 3546.Google Scholar
Breitner, J. (2016) Lazy Evaluation: From Natural Semantics to a Machine-Checked Compiler Transformation. PhD Thesis, Karlsruhe Institute of Technology.Google Scholar
Gill, A. (1996) Cheap Deforestation for Non-Strict Functional Languages. PhD Thesis, University of Glasgow, Department of Computer Science.Google Scholar
Gill, A., Launchbury, J. & Peyton Jones, S. L. (1993) A short cut to deforestation. In Proceedings of the 6th ACM Conference on Functional Programming Languages and Computer Architecture. ACM Press, pp. 223232.Google Scholar
Girard, J.-Y. (1995) Linear logic: Its syntax and semantics. In Proceedings of the Workshop on Advances in Linear Logic. Cambridge University Press, pp. 142.Google Scholar
Goldberg, B. (1987) Detecting sharing of partial applications in functional programs. In Functional Programming Languages and Ccomputer Architecture. LNCS, vol. 274. Springer-Verlag.Google Scholar
Gustavsson, J. (1998) A type based sharing analysis for update avoidance and optimisation. In Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming (ICFP'98). ACM, pp. 3950.Google Scholar
Gustavsson, J. & Sveningsson, J. (2001) A usage analysis with bounded usage polymorphism and subtyping. In Implementation of Functional Languages (IFL 2000), Selected Papers. LNCS, vol. 2011. Springer, pp. 140157.Google Scholar
Hage, J., Holdermans, S. & Middelkoop, A. (2007) A generic usage analysis with subeffect qualifiers. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming (ICFP 2007). ACM, pp. 235246.Google Scholar
Henglein, F. (1994) Iterative fixed point computation for type-based strictness analysis. In Proceedings of the 1st International Static Analysis Symposium (SAS'94). LNCS, vol. 864. Springer-Verlag, pp. 395407.Google Scholar
Hinze, R. (1995) Projection-Based Strictness Analysis - Theoretical and Practical Aspects. PhD Thesis, Bonn University.Google Scholar
Holdermans, S. & Hage, J. (2010) Making “stricternes” more relevant. In Proceedings of the 2010 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2010). ACM, pp. 121130.CrossRefGoogle Scholar
Hudak, P. (1986) A semantic model of reference counting and its abstraction. In Proceedings of the 1986 ACM Conference on Lisp and Functional Programming. ACM, pp. 351363.Google Scholar
Jones, R. (1992) Tail recursion without space leaks. J. Funct. Program. 2 (1), 7379.Google Scholar
Kahn, . (1987) Functional Programming Languages and Ccomputer Architecture. LNCS, vol. 274. Springer-Verlag.CrossRefGoogle Scholar
Launchbury, J., Gill, A., Hughes, J., Marlow, S., Peyton Jones, S. L. & Wadler, P. (1993) Avoiding unnecessary updates. In Workshops in Computing, Launchbury, J. & Sansom, P. M. (eds). Springer.Google Scholar
Launchbury, J. & Sansom, P. M. (eds). (1993) Workshops in Computing. Springer.Google Scholar
Marlow, S. & Peyton Jones, S. L. (2006) Making a fast curry: Push/enter versus eval/apply for higher-order languages. J. Funct. Program. 16 (4–5), 415449.Google Scholar
Might, M. & Shivers, O. (2006) Improving flow analyses via ΓCFA: Abstract garbage collection and counting. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming (ICFP 2006). ACM.Google Scholar
Moran, A. & Sands, D. (1999) 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. ACM, pp. 4356.Google Scholar
Partain, W. (1993) The nofib benchmark suite of Haskell programs. In Workshops in Computing. Springer.Google Scholar
Peyton Jones, S. L. (1992) Implementing lazy functional languages on stock hardware: The spineless tagless G-machine. J. Funct. Program. 2 (2), 127202.Google Scholar
Peyton Jones, S. L. & Partain, W. (1994) Measuring the effectiveness of a simple strictness analyser. In Proceedings of the 1993 Glasgow Workshop on Functional Programming. Springer, pp. 201220.CrossRefGoogle Scholar
Peyton Jones, S. L., Partain, W. & Santos, A. (1996) Let-floating: Moving bindings to give faster programs. In Proceedings of the 1st ACM SIGPLAN International Conference on Functional Programming (ICFP'96). ACM, pp. 112.Google Scholar
Peyton Jones, S. L. & Santos, A. (1998) A transformation-based optimiser for Haskell. Sci. Comput. Program. 32 (1–3), 347.CrossRefGoogle Scholar
Sabry, A. & Felleisen, M. (1992) Reasoning about programs in continuation-passing style. In Proceedings of the 1992 ACM Conference on Lisp and Functional Programming. LISP Pointers, vol. V, no. 1. ACM, pp. 288298.CrossRefGoogle Scholar
Sergey, I., Vytiniotis, D. & Peyton Jones, S. L. (2014) Modular, higher-order cardinality analysis in theory and practice. In Proceedings of the 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2014). ACM, pp. 335348.Google Scholar
Sestoft, P. (1997) Deriving a lazy abstract machine. J. Funct. Program. 7 (3), 231264.Google Scholar
Turner, D. N. & Wadler, P. (1999) Operational interpretations of linear logic. Theor. Comput. Sci. 227 (1–2), 231248.Google Scholar
Turner, D. N., Wadler, P. & Mossin, C. (1995) Once upon a type. In Proceedings of the 7th ACP Conference on Functional Programming Languages and Computer Architecture. ACM, pp. 111.Google Scholar
Van Horn, D. & Might, M. (2010) Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP 2010). ACM, pp. 5162.CrossRefGoogle Scholar
Verstoep, H. & Hage, J. (2015) Polyvariant cardinality analysis for non-strict higher-order functional languages: Brief announcement. In Proceedings of the 2015 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2015). ACM, pp. 139142.Google Scholar
Wadler, P. & Hughes, J. (1987) Projections for strictness analysis. In Functional Programming Languages and Ccomputer Architecture, Kahn, G. (ed.). LNCS, vol. 274. Springer-Verlag, pp. 385407.Google Scholar
Wansbrough, K. (2002) Simple Polymorphic Usage Analysis. PhD Thesis, Computer Laboratory, University of Cambridge.Google Scholar
Wansbrough, K. & Peyton Jones, S. L. (1999) Once upon a polymorphic type. In Popl'99: Proceedings of the 26th Annual ACM sigplan-sigact Symposium on Principles of Programming Languages. ACM, pp. 1528.Google Scholar
Xu, D. & Peyton Jones, S. L. (2005) Arity Analysis. Unpublished draft.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.