Skip to main content Accessibility help
×
Home
Hostname: page-component-768ffcd9cc-s8fcc Total loading time: 0.326 Render date: 2022-12-05T19:30:14.076Z Has data issue: true Feature Flags: { "useRatesEcommerce": false } hasContentIssue true

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

HTML view is 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.Google Scholar
Breitner, J. (2015a) Call arity. In Trends in functional programming. LNCS, vol. 8843. Springer, pp. 3450.Google 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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle Scholar
Jones, R. (1992) Tail recursion without space leaks. J. Funct. Program. 2 (1), 7379.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle Scholar
Sestoft, P. (1997) Deriving a lazy abstract machine. J. Funct. Program. 7 (3), 231264.CrossRefGoogle Scholar
Turner, D. N. & Wadler, P. (1999) Operational interpretations of linear logic. Theor. Comput. Sci. 227 (1–2), 231248.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle 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.
You have Access
2
Cited by

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Modular, higher order cardinality analysis in theory and practice
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

Modular, higher order cardinality analysis in theory and practice
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

Modular, higher order cardinality analysis in theory and practice
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *