An Inference Algorithm for Guaranteeing Safe Destruction

  • Manuel Montenegro
  • Ricardo Peña
  • Clara Segura
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5438)

Abstract

Safe is a first-order eager functional language with destructive pattern matching controlled by the programmer. A previously presented type system is used to avoid dangling pointers arising from the inadequate usage of this facility. In this paper we present a type inference algorithm, prove its correctness w.r.t. the type system, describe its implementation and give a number of successfully typed examples.

Keywords

memory management type-based analysis type inference 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aiken, A., Fähndrich, M., Levien, R.: Better Static Memory Management: Improving Region-based Analysis of Higher-order Languages. In: PLDI 1995, pp. 174–185. ACM, New York (1995)Google Scholar
  2. 2.
    Aspinall, D., Hofmann, M., Konečný, M.: A Type System with Usage Aspects. Journal of Functional Programming 18(2), 141–178 (2008)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Birkedal, L., Tofte, M., Vejlstrup, M.: From Region Inference to von Neumann Machines via Region Representation Inference. In: POPL 1996, pp. 171–183. ACM, New York (1996)Google Scholar
  4. 4.
    Henglein, F., Makholm, H., Niss, H.: A Direct Approach to Control-flow Sensitive Region-based Memory Management. In: PPDP 2001, pp. 175–186. ACM, New York (2001)Google Scholar
  5. 5.
    Hofmann, M., Jost, S.: Static Prediction of Heap Space Usage for First-order Functional Programs. In: POPL 2003, pp. 185–197. ACM, New York (2003)Google Scholar
  6. 6.
    Hudak, P.: A Semantic Model of Reference Counting and its Abstraction. In: Lisp and Functional Programming Conference, pp. 351–363. ACM Press, New York (1986)Google Scholar
  7. 7.
    Inoue, K., Seki, H., Yagi, H.: Analysis of Functional Programs to Detect Run-Time Garbage Cells. ACM TOPLAS 10(4), 555–578 (1988)CrossRefMATHGoogle Scholar
  8. 8.
    Jones, S.B., Le Metayer, D.: Compile Time Garbage Collection by Sharing Analysis. In: FPCA 1989, pp. 54–74. ACM Press, New York (1989)Google Scholar
  9. 9.
    Kobayashi, N.: Quasi-linear Types. In: POPL 1999, pp. 29–42. ACM Press, New York (1999)Google Scholar
  10. 10.
    Montenegro, M., Peña, R., Segura, C.: A Simple Region Inference Algorithm for a First-Order Functional Language. In: TFP 2008, pp. 194–208 (2008)Google Scholar
  11. 11.
    Montenegro, M., Peña, R., Segura, C.: A Type System for Safe Memory Management and its Proof of Correctness. In: PPDP 2008, pp. 152–162. ACM, New York (2008)Google Scholar
  12. 12.
    Montenegro, M., Peña, R., Segura, C.: An Inference Algorithm for Guaranteeing Safe Destruction (extended version). Technical report, SIC-8-08. UCM (2008), http://federwin.sip.ucm.es/sic/investigacion/publicaciones/pdfs/SIC-8-08.pdf
  13. 13.
    Odersky, M.: Observers for Linear Types. In: Krieg-Brückner, B. (ed.) ESOP 1992. LNCS, vol. 582, pp. 390–407. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  14. 14.
    Peña, R., Segura, C.: Formally Deriving a Compiler for SAFE. In: Horváth, Z., Zsók, V. (eds.) Preliminary proceedings of IFL 2006, pp. 429–426. Technical Report, 2006-S01. Eötvös Loránd University (2006)Google Scholar
  15. 15.
    Peña, R., Segura, C., Montenegro, M.: A Sharing Analysis for Safe. In: Trends in Functional Programming, vol. 7, pp. 109–128 (2007)Google Scholar
  16. 16.
    Tofte, M., Birkedal, L., Elsman, M., Hallenberg, N., Olesen, T.H., Sestoft, P.: Programming with regions in the MLKit (revised for version 4.3.0). Technical report, IT University of Copenhagen, Denmark (2006)Google Scholar
  17. 17.
    Tofte, M., Talpin, J.-P.: Region-based memory management. Information and Computation 132(2), 109–176 (1997)MathSciNetCrossRefMATHGoogle Scholar
  18. 18.
    Wadler, P.: Linear types can change the world! In: IFIP TC 2 Working Conference on Programming Concepts and Methods, pp. 561–581. North-Holland, Amsterdam (1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Manuel Montenegro
    • 1
  • Ricardo Peña
    • 1
  • Clara Segura
    • 1
  1. 1.Universidad Complutense de MadridMadridSpain

Personalised recommendations