Skip to main content
×
Home
    • Aa
    • Aa

Modular, higher order cardinality analysis in theory and practice

  • ILYA SERGEY (a1), DIMITRIOS VYTINIOTIS (a2), SIMON L. PEYTON JONES (a2) and JOACHIM BREITNER (a3)
Abstract
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. 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.

Copyright
References
Hide All
BarendsenE. & SmetsersS. (1996) Uniqueness typing for functional languages with graph rewriting semantics. Math. Struct. Comput. Sci. 6 (6), 579612.
BreitnerJ. (2015a) Call arity. In Trends in functional programming. LNCS, vol. 8843. Springer, pp. 3450.
BreitnerJ. (2015b) Formally proving a compiler transformation safe. In Proceedings of the ACM SIGPLAN Workshop on Haskell. ACM, pp. 3546.
BreitnerJ. (2016) Lazy Evaluation: From Natural Semantics to a Machine-Checked Compiler Transformation. PhD Thesis, Karlsruhe Institute of Technology.
GillA. (1996) Cheap Deforestation for Non-Strict Functional Languages. PhD Thesis, University of Glasgow, Department of Computer Science.
GillA., LaunchburyJ. & Peyton JonesS. 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.
GirardJ.-Y. (1995) Linear logic: Its syntax and semantics. In Proceedings of the Workshop on Advances in Linear Logic. Cambridge University Press, pp. 142.
GoldbergB. (1987) Detecting sharing of partial applications in functional programs. In Functional Programming Languages and Ccomputer Architecture. LNCS, vol. 274. Springer-Verlag.
GustavssonJ. (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.
GustavssonJ. & SveningssonJ. (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.
HageJ., HoldermansS. & MiddelkoopA. (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.
HengleinF. (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.
HinzeR. (1995) Projection-Based Strictness Analysis - Theoretical and Practical Aspects. PhD Thesis, Bonn University.
HoldermansS. & HageJ. (2010) Making “stricternes” more relevant. In Proceedings of the 2010 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2010). ACM, pp. 121130.
HudakP. (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.
JonesR. (1992) Tail recursion without space leaks. J. Funct. Program. 2 (1), 7379.
Kahn. (1987) Functional Programming Languages and Ccomputer Architecture. LNCS, vol. 274. Springer-Verlag.
LaunchburyJ., GillA., HughesJ., MarlowS., Peyton JonesS. L. & WadlerP. (1993) Avoiding unnecessary updates. In Workshops in Computing, LaunchburyJ. & SansomP. M. (eds). Springer.
LaunchburyJ. & SansomP. M. (eds). (1993) Workshops in Computing. Springer.
MarlowS. & Peyton JonesS. L. (2006) Making a fast curry: Push/enter versus eval/apply for higher-order languages. J. Funct. Program. 16 (4–5), 415449.
MightM. & ShiversO. (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.
MoranA. & SandsD. (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.
PartainW. (1993) The nofib benchmark suite of Haskell programs. In Workshops in Computing. Springer.
Peyton JonesS. L. (1992) Implementing lazy functional languages on stock hardware: The spineless tagless G-machine. J. Funct. Program. 2 (2), 127202.
Peyton JonesS. L. & PartainW. (1994) Measuring the effectiveness of a simple strictness analyser. In Proceedings of the 1993 Glasgow Workshop on Functional Programming. Springer, pp. 201220.
Peyton JonesS. L., PartainW. & SantosA. (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.
Peyton JonesS. L. & SantosA. (1998) A transformation-based optimiser for Haskell. Sci. Comput. Program. 32 (1–3), 347.
SabryA. & FelleisenM. (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.
SergeyI., VytiniotisD. & Peyton JonesS. 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.
SestoftP. (1997) Deriving a lazy abstract machine. J. Funct. Program. 7 (3), 231264.
TurnerD. N. & WadlerP. (1999) Operational interpretations of linear logic. Theor. Comput. Sci. 227 (1–2), 231248.
TurnerD. N., WadlerP. & MossinC. (1995) Once upon a type. In Proceedings of the 7th ACP Conference on Functional Programming Languages and Computer Architecture. ACM, pp. 111.
Van HornD. & MightM. (2010) Abstracting abstract machines. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP 2010). ACM, pp. 5162.
VerstoepH. & HageJ. (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.
WadlerP. & HughesJ. (1987) Projections for strictness analysis. In Functional Programming Languages and Ccomputer Architecture, KahnG. (ed.). LNCS, vol. 274. Springer-Verlag, pp. 385407.
WansbroughK. (2002) Simple Polymorphic Usage Analysis. PhD Thesis, Computer Laboratory, University of Cambridge.
WansbroughK. & Peyton JonesS. 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.
XuD. & Peyton JonesS. L. (2005) Arity Analysis. Unpublished draft.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 33 *
Loading metrics...

Abstract views

Total abstract views: 272 *
Loading metrics...

* Views captured on Cambridge Core between 16th February 2017 - 23rd October 2017. This data will be updated every 24 hours.