skip to main content
research-article

A certified framework for compiling and executing garbage-collected languages

Published:27 September 2010Publication History
Skip Abstract Section

Abstract

We describe the design, implementation, and use of a machine-certified framework for correct compilation and execution of programs in garbage-collected languages. Our framework extends Leroy's Coq-certified Compcert compiler and Cminor intermediate language. We add: (i) a new intermediate language, GCminor, that includes primitives for allocating memory in a garbage-collected heap and for specifying GC roots; (ii) a precise, low-level specification for a Cminor library for garbage collection; and (iii) a proven semantics-preserving translation from GCminor to Cminor plus the GC library. GCminor neatly encapsulates the interface between mutator and collector code, while remaining simple and flexible enough to be used with a wide variety of source languages and collector styles. Front ends targeting GCminor can be implemented using any compiler technology and any desired degree of verification, including full semantics preservation, type preservation, or informal trust.

As an example application of our framework, we describe a compiler for Haskell that translates the Glasgow Haskell Compiler's Core intermediate language to GCminor. To support a simple but useful memory safety argument for this compiler, the front end uses a novel combination of type preservation and runtime checks, which is of independent interest.

Skip Supplemental Material Section

Supplemental Material

icfp-weds-1150-mccreight.mov

References

  1. }}H. Abelson and G. J. Sussman. Structure and Interpretation of Computer Programs. The MIT Press, FIrst edition, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}ADT Coq. The Coq proof assistant. http://coq.inria.fr.Google ScholarGoogle Scholar
  3. }}A. W. Appel and S. Blazy. Separation logic for small-step Cminor. In TPHOLs, volume 4732 of LNCS, pp. 5--21. Springer, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}A. W. Appel and T. Jim. Continuation-passing, closure-passing style. In POPL, pp. 293--302. ACM Press, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}A. Bloss, P. Hudak, and J. Young. Code optimizations for lazy evaluation. Lisp and Symbolic Computation, 1(2):147--164, 1988.Google ScholarGoogle ScholarCross RefCross Ref
  6. }}U. Boquist and T. Johnsson. The GRIN project: A highly optimising back end for lazy functional languages. In IFL '96, volume 1268 of LNCS, pp. 58--84. Springer, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}J. Chen, C. Hawblitzel, F. Perry, M. Emmi, J. Condit, D. Coetzee, and P. Pratikaki. Type-preserving compilation for large-scale optimizing object-oriented compilers. In PLDI, pp. 183--192, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}A. Chlipala. A certified type-preserving compiler from lambda calculus to assembly language. In PLDI, pp. 54--65. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}Z. Dargaye. MLCompCert Coq proofs.http://gallium.inria.fr/~dargaye/mlcompcert.html, 2009.Google ScholarGoogle Scholar
  10. }}Z. Dargaye. Vérification formelle d'un compilateur pour langages fonctionnels. PhD thesis, Université Paris 7 Denis Diderot, July 2009.Google ScholarGoogle Scholar
  11. }}A. Dijkstra, J. Fokker, and S. D. Swierstra. The architecture of the Utrecht Haskell Compiler. In Haskell Symp., pp. 93--104. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. }}K.-F. Faxèn. Analysing, Transforming and Compiling Lazy Functional Programs. PhD thesis, Royal Institute of Technology, June 1997.Google ScholarGoogle Scholar
  13. }}C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In PLDI, pp. 237--247. ACM, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}C. Hawblitzel and E. Petrank. Automated verification of practical garbage collectors. In POPL, pp. 441--453. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}F. Henderson. Accurate garbage collection in an uncooperative environment. In MSP/ISMM, pp. 256--263, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}X. Leroy. Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In POPL, pp. 42--54, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}X. Leroy. The Compcert verified compiler. http://compcert.inria.fr/doc/index.html, April 2009.Google ScholarGoogle Scholar
  18. }}X. Leroy. A formally verified compiler back-end. J. Autom. Reason., 43(4):363--446, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. }}X. Leroy and S. Blazy. Formal verification of a C-like memory model and its uses for verifying program transformations. J. Autom. Reason., 41(1):1--31, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}A. McCreight. The Mechanized Verification of Garbage Collector Implementations. PhD thesis, Yale University, New Haven, CT, USA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. }}A. McCreight. Practical tactics for separation logic. In TPHOLs, volume 5674 of LNCS, pp. 343--358. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. }}A. McCreight, Z. Shao, C. Lin, and L. Li. A general framework for certifying GCs and their mutators. In PLDI, pp. 468--479. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}G. Morrisett, D. Walker, K. Crary, and N. Glew. From System F to typed assembly language. TOPLAS, 21(3):527--568, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}M. O. Myreen. Formal verification of machine-code programs. PhD thesis, University of Cambridge, 2008.Google ScholarGoogle Scholar
  25. }}W. Partain. The nofib benchmark suite of Haskell programs. In Proc. 1992 Glasgow Workshop on FP, pp. 195--202. Springer, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}S. Peyton Jones, editor. Haskell 98 Language and Libraries - The Revised Report. Cambridge University Press, 2003.Google ScholarGoogle Scholar
  27. }}S. L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. JFP, 2(2):127--202, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  28. }}S. L. Peyton Jones. Compiling Haskell by program transformation: A report from the trenches. In ESOP, pp. 18--44, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. }}S. L. Peyton Jones, N. Ramsey, and F. Reig. C-: A portable assembly language that supports garbage collection. In PPDP '99, pp. 1--28, London, UK, 1999. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. }}M. Sulzmann, M. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In TLDI, pp. 53--66, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. }}The GHC Team. GHC. http://haskell.org/ghc, 2009.Google ScholarGoogle Scholar
  32. }}The GHC Team. Replacing GMP. http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes, April 2009.Google ScholarGoogle Scholar
  33. }}The HASP Project. http://hasp.cs.pdx.edu.Google ScholarGoogle Scholar
  34. }}The Ocaml Development Team. The Caml language. http://caml.inria.fr.Google ScholarGoogle Scholar
  35. }}A. Tolmach, T. Chevalier, and the GHC Team. An external representation for the GHC Core language. http://www.haskell.org/ghc/docs/6.10.4/html/ext-core/core.pdf, July 2009.Google ScholarGoogle Scholar
  36. }}N. Torp-Smith, L. Birkedal, and J. C. Reynolds. Local reasoning about a copying garbage collector. ACM TOPLAS, 30(4):1--58, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. }}J. C. Vanderwaart and K. Crary. A typed interface for garbage collection. In TLDI, pp. 109--122. ACM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A certified framework for compiling and executing garbage-collected languages

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        ePub

        View this article in ePub.

        View ePub
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!