Correctness Proof on an Algorithm to Insert Memory Reuse Commands into ML-like

We present a static analysis that estimates reusable memory cells and a sourcelevel transformation that adds explicit memory-reuse commands into the program text. For benchmark ML programs, our analysis and transformation achieves the memory reuse ratio from 5.2% to 91.3% and reduces the memory peak from 0.0% to 71.9%. The small-ratio cases are for programs that have too prevalent sharings among memory cells. For other cases, our experimental results are encouraging in terms of accuracy and cost. Major features of our analysis are: (1) poly-variant analysis of functions by parameterization for the argument heap cells; (2) use of multiset formulas in expressing the sharings and partitionings of heap cells; (3) deallocations conditioned by dynamic flags that are passed as extra arguments to functions; (4) individual heap cell as the granularity of explicit memory-free. Our analysis and transformation is fully automatic.

[1]  Peter W. O'Hearn,et al.  BI as an assertion language for mutable data structures , 2001, POPL '01.

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

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

[4]  Xavier Leroy The objective caml system release 3 , 2001 .

[5]  David Walker,et al.  Alias Types for Recursive Data Structures , 2000, Types in Compilation.

[6]  Bruno Blanchet,et al.  Escape analysis: correctness proof, implementation and experimental results , 1998, POPL '98.

[7]  James Cheney,et al.  Region-based memory management in cyclone , 2002, PLDI '02.

[8]  David Walker,et al.  Typed memory management in a calculus of capabilities , 1999, POPL '99.

[9]  John C. Reynolds,et al.  Separation logic: a logic for shared mutable data structures , 2002, Proceedings 17th Annual IEEE Symposium on Logic in Computer Science.

[10]  Lars Birkedal,et al.  A region inference algorithm , 1998, TOPL.

[11]  Martin Elsman,et al.  Programming with regions in the ml kit (for version 4) , 1998 .

[12]  Martin Hofmann,et al.  Another Type System for In-Place Update , 2002, ESOP.

[13]  Erik Barendsen,et al.  Uniqueness Typing for Functional Languages with Graph Rewriting Semantics , 1996, Math. Struct. Comput. Sci..

[14]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[15]  Philip Wadler,et al.  Linear Types can Change the World! , 1990, Programming Concepts and Methods.

[16]  Naoki Kobayashi Quasi-linear types , 1999, POPL '99.

[17]  Mads Tofte,et al.  Region-based Memory Management , 1997, Inf. Comput..

[18]  David Gay,et al.  Language support for regions , 2001, PLDI '01.

[19]  David Walker,et al.  Alias Types , 2000, ESOP.

[20]  Peter W. O'Hearn,et al.  Local Reasoning about Programs that Alter Data Structures , 2001, CSL.

[21]  Robert Harper,et al.  Typed closure conversion , 1996, POPL '96.

[22]  Philip Wadler,et al.  Once upon a type , 1995, FPCA '95.

[23]  Williams Ludwell Harrison,et al.  The interprocedural analysis and automatic parallelization of Scheme programs , 1990, LISP Symb. Comput..

[24]  Martin C. Rinard,et al.  Interprocedural compatibility analysis for static object preallocation , 2003, POPL.