Region-based memory management in cyclone

Cyclone is a type-safe programming language derived from C. The primary design goal of Cyclone is to let programmers control data representation and memory management without sacrificing type-safety. In this paper, we focus on the region-based memory management of Cyclone and its static typing discipline. The design incorporates several advancements, including support for region subtyping and a coherent integration with stack allocation and a garbage collector. To support separate compilation, Cyclone requires programmers to write some explicit region annotations, but a combination of default annotations, local type inference, and a novel treatment of region effects reduces this burden. As a result, we integrate C idioms in a region-based framework. In our experience, porting legacy C to Cyclone has required altering about 8% of the code; of the changes, only 6% (of the 8%) were region annotations.

[1]  Zhong Shao,et al.  Principled scavenging , 2001, PLDI '01.

[2]  Dan Grossman Existential Types for Imperative Languages , 2002, ESOP.

[3]  David E. Evans,et al.  Static detection of dynamic memory errors , 1996, PLDI '96.

[4]  David Gay,et al.  Memory management with explicit regions , 1998, PLDI.

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

[6]  Andrew D. Gordon,et al.  Typing a multi-language intermediate code , 2001, POPL '01.

[7]  Luca Cardelli,et al.  Comparing Object Encodings , 1997, Inf. Comput..

[8]  David Walker,et al.  Typed memory management via static capabilities , 2000, TOPL.

[9]  Peter Ross,et al.  Compiling Mercury to the .NET Common Language Runtime , 2001, Electron. Notes Theor. Comput. Sci..

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

[11]  David Walker,et al.  On regions and linear types (extended abstract) , 2001, ICFP '01.

[12]  Andrew W. Appel,et al.  Type-preserving garbage collectors , 2001, POPL '01.

[13]  Robert DeLine,et al.  Enforcing high-level protocols in low-level software , 2001, PLDI '01.

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

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

[16]  Fritz Henglein,et al.  A direct approach to control-flow sensitive region-based memory management , 2001, PPDP '01.

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

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

[19]  John C. Mitchell,et al.  Abstract types have existential type , 1988, TOPL.

[20]  Sriram K. Rajamani,et al.  Automatically validating temporal safety properties of interfaces , 2001, SPIN '01.

[21]  James Cheney,et al.  Formal Type Soundness for Cyclone''s Region System , 2001 .

[22]  Ray Jain,et al.  The art of computer systems performance analysis - techniques for experimental design, measurement, simulation, and modeling , 1991, Wiley professional computing.

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

[24]  Niels Hallenberg,et al.  Combining Garbage Collection and Region Inference in The ML Kit , 1999 .

[25]  David Walker,et al.  On Regions and Linear Types , 2001, ACM SIGPLAN International Conference on Functional Programming.

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

[27]  Todd M. Austin,et al.  Efficient detection of all pointer and array access errors , 1994, PLDI '94.

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

[29]  Hongwei Xi,et al.  Imperative programming with dependent types , 2000, Proceedings Fifteenth Annual IEEE Symposium on Logic in Computer Science (Cat. No.99CB36332).

[30]  George C. Necula,et al.  CCured: type-safe retrofitting of legacy code , 2002, POPL '02.

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

[32]  Martin Elsman,et al.  Combining region inference and garbage collection , 2002, PLDI '02.

[33]  James Cheney,et al.  Cyclone: A Safe Dialect of C , 2002, USENIX Annual Technical Conference, General Track.