A resource semantics and abstract machine for Safe: A functional language with regions and explicit deallocation

In this paper we summarise Safe, a first-order functional language for programming small devices and embedded systems with strict memory requirements, which has been introduced elsewhere. It has some unusual memory management features such as heap regions and explicit cell deallocation. It is targeted at a Proof Carrying Code environment, and consistently with this aim the Safe compiler provides machine checkable certificates about important safety properties such as the absence of dangling pointers and bounded memory consumption. The kernel of the paper is devoted to developing part of the Safe compiler's back-end, by deriving an appropriate abstract machine from the language semantics, by providing the code generation functions, and by formally proving that the translation is sound, both in the semantic and in the memory consumption senses.

[1]  Martin Hofmann,et al.  A program logic for resources , 2007, Theor. Comput. Sci..

[2]  Ricardo Peña-Marí,et al.  Formal Certification of a Resource-Aware Language Implementation , 2009, TPHOLs.

[3]  Clara Segura,et al.  An Inference Algorithm for Guaranteeing Safe Destruction , 2008, LOPSTR.

[4]  Axel Dold,et al.  A Mechanically Verified Compiling Specification for a Lisp Compiler , 2001, FSTTCS.

[5]  Dale Miller,et al.  From Operational Semantics to Abstract Machines MS-CIS-92-46 LINC , 2014 .

[6]  Clara Segura,et al.  A Resource-Aware Semantics and Abstract Machine for a Functional Language with Explicit Deallocation , 2009, Electron. Notes Theor. Comput. Sci..

[7]  Clara Segura,et al.  A sharing analysis for SAFE , 2006, Trends in Functional Programming.

[8]  Ricardo Peña-Marí,et al.  Certification of Safe Polynomial Memory Bounds , 2011, FM.

[9]  Tobias Nipkow Verified Bytecode Verifiers , 2001, FoSSaCS.

[10]  Marko C. J. D. van Eekelen,et al.  Polynomial Size Analysis of First-Order Shapely Functions , 2009, Log. Methods Comput. Sci..

[11]  Olivier Danvy,et al.  A Functional Correspondence between Evaluators and Abstract Machines , 2003 .

[12]  Clara Segura,et al.  A type system for safe memory management and its proof of correctness , 2008, PPDP.

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

[14]  Ricardo Peña-Marí,et al.  From natural semantics to C: A formal derivation of two STG machines , 2009, J. Funct. Program..

[15]  Xavier Leroy,et al.  A Formally Verified Compiler Back-end , 2009, Journal of Automated Reasoning.

[16]  Xavier Leroy,et al.  Formal Verification of a C Compiler Front-End , 2006, FM.

[17]  Clara Segura,et al.  A Simple Region Inference Algorithm for a First-Order Functional Language , 2009, WFLP.

[18]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[19]  J. Gregory Morrisett,et al.  Linear Regions Are All You Need , 2006, ESOP.

[20]  Ricardo Peña-Marí,et al.  A Space Consumption Analysis by Abstract Interpretation , 2009, FOPARA.

[21]  Tobias Nipkow,et al.  Isabelle/HOL , 2002, Lecture Notes in Computer Science.

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

[23]  Ricardo Peña Marí,et al.  Safety properties and memory bound analysis in a functional language without a garbage collector , 2011 .

[24]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[25]  George C. Necula,et al.  Proof-Carrying Code , 2011, Encyclopedia of Cryptography and Security.

[26]  Martin Strecker,et al.  Formal Verification of a Java Compiler in Isabelle , 2002, CADE.

[27]  Ricardo Peña-Marí,et al.  A Certified Implementation on Top of the Java Virtual Machine , 2009, FMICS.

[28]  Xavier Leroy,et al.  Formal certification of a compiler back - end , 2005 .

[29]  Maulik A. Dave,et al.  Compiler verification: a bibliography , 2003, SOEN.

[30]  Martin Hofmann,et al.  Static prediction of heap space usage for first-order functional programs , 2003, POPL '03.

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

[32]  Werner E. Kluge Abstract Computing Machines - A Lambda Calculus Perspective , 2005, Texts in Theoretical Computer Science. An EATCS Series.

[33]  Martin Hofmann,et al.  Static determination of quantitative resource usage for higher-order programs , 2010, POPL '10.

[34]  Stefan Berghofer,et al.  Extracting a formally verified, fully executable compiler from a proof assistant , 2004, COCV@ETAPS.

[35]  Peter Sestoft,et al.  Deriving a lazy abstract machine , 1997, Journal of Functional Programming.

[36]  Dietmar Gärtner,et al.  π-RED+ An interactive compiling graph reduction system for an applied λ-calculus , 1996, Journal of Functional Programming.

[37]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[38]  Lawrence Charles Paulson,et al.  Isabelle/HOL: A Proof Assistant for Higher-Order Logic , 2002 .

[39]  Martin Hofmann,et al.  Amortized Resource Analysis with Polynomial Potential , 2010, ESOP.

[40]  Tobias Nipkow,et al.  A machine-checked model for a Java-like language, virtual machine, and compiler , 2006, TOPL.

[41]  Xavier Leroy,et al.  Formal certification of a compiler back-end or: programming a compiler with a proof assistant , 2006, POPL '06.

[42]  Ricardo Peña-Marí,et al.  Certified Absence of Dangling Pointers in a Language with Explicit Deallocation , 2010, IFM.

[43]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..