Optimising the memory management of higher order functional programs

Set of all subsets of A P fin (A) Set of all finite subsets of A A B Disjoint union of sets A and B A i | i ∈ I Family of sets A i with index set I (see Appendix A) f : A B Partial function Dom(f) Domain of partial function f f ∪ g Union of functions f and g with Dom(f) ∩ Dom(g) = ∅: (f ∪ g)(a) := f (a) if a ∈ Dom(f) g(a) if a ∈ Dom(g) id Identity function undef Function with empty domain, i.e. Dom(undef) = ∅ f [a/b] Function g resulting from modification of f at a: g(a) := b if a = a f (a) otherwise f [a 1 /b 1 ,. .. , a n , b n ] Short form of f [a 1 /b 1 ]. .. [a n /b n ] [a 1 /b 1 ,. .. , a n , b n ] Short form of undef[a 1 /b 1 ,. .. , a n , b n ] [A 1 × · · · × A n → B] Set of all functions f : A 1 × · · · × A n → B (a) i Selection of the i–th component a i of vector a = (a 1 ,. .. , a n) A, ≤ Partially ordered set (pos) (see Appendix A) A 1 , ≤ 1 × A 2 , ≤ 2 Product of pos (see Appendix A) [A 1 , ≤≤ → A 2 , ≤ 2 ] Function space of pos (see Appendix A) 1. Introduction In traditional programming languages like Pascal, C, or Ada recursive dynamic data structures like lists or trees are available by explicit access to the heap of the runtime system. Commands like C's malloc or Ada's new allocate memory in the heap and provide subsequent access to the allocated memory by pointers. As execution of the program proceeds, allocated memory may become obsolete and therefore the explicit deallocation of memory is possible by commands like free or UNCHECKED DEALLOCATION. Explicit deallocation of heap allocated objects is a very dangerous concept. If a heap object is deallocated too early, then subsequent access may result in runtime errors. Even if the variable containing the pointer is not used after the deallocation, such runtime errors cannot be avoided: Before the deallocation the pointer to …

[1]  Peter Sestoft,et al.  Analysis and efficient implementation of functional programs , 1991 .

[2]  J. W. de Bakker,et al.  Processes and the Denotational Semantics of Concurrency , 1982, Inf. Control..

[3]  Hans-Juergen Boehm,et al.  Garbage collection in an uncooperative environment , 1988, Softw. Pract. Exp..

[4]  Morten Heine Sørensen,et al.  Grammar-Based Data-Flow Analysis to Stop Deforestation , 1994, CAAP.

[5]  Torben Æ. Mogensen,et al.  A Backwards Analysis for Compile-time Garbage Collection , 1990, ESOP.

[6]  Samson Abramsky,et al.  Strictness analysis and polymorphic invariance , 1985, Programs as Data Objects.

[7]  Daniel Le Métayer,et al.  A new method for strictness analysis on non-flat domains , 1989, Fourth IEEE Region 10 International Conference TENCON.

[8]  Akihiko Takano,et al.  Shortcut deforestation in calculational form , 1995, FPCA '95.

[9]  Alain Deutsch,et al.  On the complexity of escape analysis , 1997, POPL '97.

[10]  Marko C. J. D. van Eekelen,et al.  Guaranteeing Safe Destructive Updates Through a Type System with Uniqueness Information for Graphs , 1993, Dagstuhl Seminar on Graph Transformations in Computer Science.

[11]  Masato Takeichi,et al.  Deriving structural hylomorphisms from recursive definitions , 1996, ICFP '96.

[12]  Joseph E. Stoy,et al.  Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory , 1981 .

[13]  Simon Peyton Jones,et al.  Measuring the effectiveness of a simple strictness analyser , 1993, Functional Programming.

[14]  Wolfgang Wechler,et al.  Universal Algebra for Computer Scientists , 1992, EATCS Monographs on Theoretical Computer Science.

[15]  Flemming Nielson,et al.  Bounded fixed point iteration , 1991, POPL '92.

[16]  Geoffrey L. Burn,et al.  Assessing the evaluation transformer model of reduction on the spineless G-machine , 1993, FPCA '93.

[17]  Jan Willem Klop,et al.  Term Graph Rewriting , 1995, HOA.

[18]  Christel Baier,et al.  Metric Completion versus Ideal Completion , 1996, Theor. Comput. Sci..

[19]  Patrick Cousot,et al.  Introduction to abstract interpretation , 1998 .

[20]  Marinus J. Plasmeijer,et al.  The Ins and Outs of Clean I/O , 1995, J. Funct. Program..

[21]  Patrick Cousot,et al.  Types as abstract interpretations , 1997, POPL '97.

[22]  Helmut Seidl Integer Constraints to Stop Deforestation , 1996, ESOP.

[23]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[24]  Daniel Le Métayer,et al.  Computer-Time Garbage Collection by Sharing Analysis , 1989, FPCA.

[25]  Peter Thiemann Grundlagen der funktionalen Programmierung , 1994, Leitfäden der Informatik.

[26]  Fritz Henglein,et al.  A Semantic Model of Binding Times for Safe Partial Evaluation , 1995, PLILP.

[27]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

[28]  Marko C. J. D. van Eekelen,et al.  CLEAN: A language for functional graph writing , 1987, FPCA.

[29]  Simon L. Peyton Jones,et al.  The spineless tagless G-machine , 1989, FPCA.

[30]  Simon L. Peyton Jones,et al.  The Implementation of Functional Programming Languages , 1987 .

[31]  Simon Hughes,et al.  Compile-Time Garbage Collection for Higher-Order Functional Languages , 1992, J. Log. Comput..

[32]  Karl-Filip Faxén Optimizing Lazy Functional Programs Using Flow Inference , 1995, SAS.

[33]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[34]  André L. M. Santos,et al.  Compilation by transformation in non-strict functional languages , 1995 .

[35]  Flemming Nielson,et al.  Finiteness conditions for fixed point iteration , 1992, LFP '92.

[36]  Michael White,et al.  Is Compile Time Garbage Collection Worth the Effort? , 1990, Functional Programming.

[37]  Neil D. Jones,et al.  Complexity of flow analysis, inductive assertion synthesis and a language due to Dijkstra , 1980, 21st Annual Symposium on Foundations of Computer Science (sfcs 1980).

[38]  Markus Mohnen,et al.  Using Quasi Ordered Sets to Model Program Properties Denotationally , 1997, GI Jahrestagung.

[39]  Geoff W. Hamilton,et al.  Compile-Time Garbage Collection for Lazy Functional Languages , 1995, IWMM.

[40]  Philip Wadler,et al.  Deforestation: Transforming Programs to Eliminate Trees , 1990, Theor. Comput. Sci..

[41]  Katsuro Inoue,et al.  Analysis of functional programs to detect run-time garbage cells , 1988, TOPL.

[42]  Will Partain,et al.  The nofib Benchmark Suite of Haskell Programs , 1992, Functional Programming.

[43]  Jon Fairbairn,et al.  TIM: A simple, lazy abstract machine to execute supercombinatorics , 1987, FPCA.

[44]  Guy Argo Improving the three instruction machine , 1989, FPCA.

[45]  Marko C. J. D. van Eekelen,et al.  Functional Programming and Parallel Graph Rewriting , 1993 .

[46]  Erik Barendsen,et al.  Uniqueness Type Inference , 1995, PLILP.

[47]  David Flanagan,et al.  Java in a Nutshell , 1996 .

[48]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[49]  R. A. G. Seely,et al.  Categorical semantics for higher order polymorphic lambda calculus , 1987, Journal of Symbolic Logic.

[50]  Lyn Dupre,et al.  BUGS in Writing: A Guide to Debugging Your Prose , 1995, IEEE Software.

[51]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[52]  Carl A. Gunter The semantics of types in programming languages , 1995, LICS 1995.

[53]  J. Boehm Space Eecient Conservative Garbage Collection , 1993 .

[54]  Chris Hankin,et al.  The theory of strictness analysis for higher order functions , 1985, Programs as Data Objects.

[55]  Philip Wadler,et al.  Deforestation for Higher-Order Functions , 1992, Functional Programming.

[56]  Markus Mohnen Efficient Compile-Time Garbage Collection for Arbitrary Data Structures , 1995, PLILP.

[57]  Mads Tofte,et al.  Implementation of the typed call-by-value λ-calculus using a stack of regions , 1994, POPL '94.

[58]  Markus Mohnen,et al.  Efficient Closure Utilisation by Higher-Order Inheritance Analysis , 1995, SAS.

[59]  Uday S. Reddy,et al.  Imperative functional programming , 1996, CSUR.

[60]  Mads Tofte Region Inference for Higher-Order Functional Languages , 1995, SAS.

[61]  Flemming Nielson,et al.  Bounded fixed point iteration , 1992, POPL '92.

[62]  Wei-Ngan Chin,et al.  Safe fusion of functional expressions II: Further improvements , 1994, Journal of Functional Programming.

[63]  Chris Hankin,et al.  Strictness Analysis for Higher-Order Functions , 1986, Sci. Comput. Program..

[64]  Lars Birkedal,et al.  From region inference to von Neumann machines via region representation inference , 1996, POPL '96.

[65]  Simon L. Peyton Jones,et al.  Unboxed Values as First Class Citizens in a Non-Strict Functional Language , 1991, FPCA.

[66]  Terry A. Welch,et al.  A Technique for High-Performance Data Compression , 1984, Computer.

[67]  Anindya Banerjee A modular, polyvariant and type-based closure analysis , 1997, ICFP '97.

[68]  Geoff W. Hamilton,et al.  Compile-Time Garbage Collection by Necessity Analysis , 1990, Functional Programming.

[69]  Christel Baier,et al.  Metric completion versus ideal completion , 1996 .

[70]  Neil D. Jones Proceedings of the 3rd European Symposium on Programming , 1990 .

[71]  Simon L. Peyton Jones,et al.  A short cut to deforestation , 1993, FPCA '93.

[72]  Christel Baier,et al.  Denotational Semantics in the CPO and Metric Approach , 1994, Theor. Comput. Sci..

[73]  Alan Mycroft,et al.  The Theory and Practice of Transforming Call-by-need into Call-by-value , 1980, Symposium on Programming.

[74]  Johan Lewi,et al.  Efficient FixPoint Computation , 1994, SAS.

[75]  Helmut Seidl,et al.  Constraints to stop higher-order deforestation , 1997, POPL '97.

[76]  John C. Reynolds,et al.  On Functors Expressible in the Polymorphic Typed Lambda Calculus , 1993, Inf. Comput..

[77]  Benjamin Goldberg,et al.  Higher Order Escape Analysis: Optimizing Stack Allocation in Functional Program Implementations , 1990, ESOP.

[78]  G. Grätzer,et al.  Lattice Theory: First Concepts and Distributive Lattices , 1971 .

[79]  Donald E. Knuth,et al.  A Generalization of Dijkstra's Algorithm , 1977, Inf. Process. Lett..

[80]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[81]  Philip Wadler Listlessness is better than laziness II: composing listless functions , 1985, Programs as Data Objects.

[82]  Chris Hankin,et al.  Abstract Interpretation of Declarative Languages , 1987 .

[83]  Benjamin Goldberg,et al.  Escape analysis on lists , 1992, PLDI '92.