Alias Types for Recursive Data Structures

Linear type systems permit programmers to deallocate or explicitly recycle memory, but are severely restricted by the fact that they admit no aliasing. This paper describes a pseudo-linear type system that allows a degree of aliasing and memory reuse as well as the ability to define complex recursive data structures. Our type system can encode conventional linear data structures such as linear lists and trees as well as more sophisticated data structures including cyclic and doubly-linked lists and trees. In the latter cases, our type system is expressive enough to represent pointer aliasing and yet safely permit destructive operations such as object deallocation. We demonstrate the flexibility of our type system by encoding two common space-conscious algorithms: destination-passing style and Deutsch-Schorr-Waite or "link-reversal" traversal algoithms.

[1]  Michael Benedikt,et al.  A Decidable Logic for Describing Linked Data Structures , 1999, ESOP.

[2]  Maarten M. Fokkinga,et al.  Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire , 1991, FPCA.

[3]  Alain Deutsch,et al.  Interprocedural may-alias analysis for pointers: beyond k-limiting , 1994, PLDI '94.

[4]  Frank Pfenning,et al.  Dependent types in practical programming , 1999, POPL '99.

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

[6]  George C. Necula,et al.  The design and implementation of a certifying compiler , 1998, PLDI.

[7]  James R. Larus,et al.  Restructuring symbolic programs for concurrent execution on multiprocessors , 1989 .

[8]  William M. Waite,et al.  An efficient machine-independent procedure for garbage collection in various list structures , 1967, CACM.

[9]  Daniel P. Friedman,et al.  Recycling continuations , 1998, ICFP '98.

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

[11]  Reinhard Wilhelm,et al.  Solving shape-analysis problems in languages with destructive updating , 1998, TOPL.

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

[13]  Greg Morrisett,et al.  Typed memory management , 2001 .

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

[15]  Erik Barendsen,et al.  Conventional and Uniqueness Typing in Graph Rewrite Systems , 1993, FSTTCS.

[16]  John C. Reynolds,et al.  Syntactic control of interference , 1978, POPL.

[17]  John C. Reynolds,et al.  Intuitionistic reasoning about shared mutable data structure , 1999 .

[18]  David Walker,et al.  Alias Types for Recursive Data Structures (Extended Version) , 2000 .

[19]  Neil D. Jones,et al.  Flow analysis and optimization of LISP-like structures , 1979, POPL.

[20]  Bernhard Möller Towards Pointer Algebra , 1993, Sci. Comput. Program..

[21]  Robert Harper,et al.  A Simplified Account of Polymorphic References , 1994, Inf. Process. Lett..

[22]  Alexander Aiken,et al.  Better static memory management: improving region-based analysis of higher-order languages , 1995, PLDI '95.

[23]  Reinhard Wilhelm,et al.  Parametric shape analysis via 3-valued logic , 1999, POPL '99.

[24]  Stephen A. Cook,et al.  An assertion language for data structures , 1975, POPL '75.

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

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

[27]  James R. Larus Restructuring Symbolic Programs for Concurrent Execution on , 1989 .

[28]  Samson Abramsky,et al.  Computational Interpretations of Linear Logic , 1993, Theor. Comput. Sci..

[29]  M. Nivat Fiftieth volume of theoretical computer science , 1988 .

[30]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[31]  James R. Larus,et al.  Detecting conflicts between structure accesses , 1988, PLDI '88.

[32]  Carl A. Gunter,et al.  Reference counting as a computational interpretation of linear logic , 1996, Journal of Functional Programming.

[33]  Paul Hudak,et al.  Single-threaded polymorphic lambda calculus , 1990, [1990] Proceedings. Fifth Annual IEEE Symposium on Logic in Computer Science.

[34]  Laurie J. Hendren,et al.  Is it a tree, a DAG, or a cyclic graph? A shape analysis for heap-directed pointers in C , 1996, POPL '96.

[35]  Thomas Reps,et al.  A decidable logic for linked data structures , 1999 .

[36]  Nils Klarlund,et al.  Graph types , 1993, POPL '93.

[37]  David Walker,et al.  Stack-based typed assembly language , 1998, Journal of Functional Programming.

[38]  Yves Lafont The Linear Abstract Machine (Corrigenda) , 1988, Theor. Comput. Sci..

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

[40]  Dan Grossman,et al.  Scalable Certification of Native Code: Experience from Compiling to TALx86 , 2000 .

[41]  Franklyn Turbak,et al.  Strongly Typed Flow-Directed Representation Transformations. , 1997, ICFP 1997.

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

[43]  Dan Grossman,et al.  Scalable Certification for Typed Assembly Language , 2000, Types in Compilation.

[44]  Yasuhiko Minamide,et al.  A functional representation of data structures with a hole , 1998, POPL '98.

[45]  Patrick Lincoln,et al.  Linear logic , 1992, SIGA.

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

[47]  Jean-Yves Girard,et al.  Linear Logic , 1987, Theor. Comput. Sci..

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