Skip to main content

Static Region Analysis for Mercury

  • Conference paper
Book cover Logic Programming (ICLP 2007)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4670))

Included in the following conference series:

Abstract

Region-based memory management is a form of compile-time memory management, well-known from the functional programming world. This paper describes a static region analysis for the logic programming language Mercury. We use region points-to graphs to model the partitioning of the memory used by a program into separate regions. The algorithm starts with a region points-to analysis that determines the different regions in the program. We then compute the liveness of the regions by using an extended live variable analysis. Finally, a program transformation adds region annotations to the program for region support. These annotations generate data for a region simulator that generates reports on the memory behaviour of region-annotated programs. Our approach obtains good memory consumption for several benchmark programs; for some of them it achieves optimal memory management.

This work is supported by the project GOA/2003/08 and by FWO Vlaanderen.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aiken, A., Fähndrich, M., Levien, R.: Better static memory management: Improving region-based analysis of higher-order languages. In: Proceedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, pp. 174–185. ACM Press, New York (1995)

    Chapter  Google Scholar 

  2. Cherem, S., Rugina, R.: Region analysis and transformation for Java programs. In: Proceedings of the 4th International Symposium on Memory Management, pp. 85–96. ACM Press, New York (2004)

    Chapter  Google Scholar 

  3. Grossman, D., Morrisett, G., Jim, T., Hicks, M., Wang, Y., Cheney, J.: Region-based memory management in Cyclone. In: Proceedings of the ACM Conference on Programming Language Design and Implementation, pp. 282–293. ACM Press, New York (2002)

    Google Scholar 

  4. Henglein, F., Makholm, H., Niss, H.: A direct approach to control-flow sensitive region-based memory management. In: Principles and Practice of Declarative Programming, pp. 175–186. ACM Press, New York (2001)

    Chapter  Google Scholar 

  5. Makholm, H.: A region-based memory manager for Prolog. In: Proceedings of the 2nd International Symposium on Memory Management, pp. 25–34. ACM Press, New York (2000)

    Chapter  Google Scholar 

  6. Makholm, H.: Region-based memory management in Prolog. Master’s thesis, University of Copenhagen (2000)

    Google Scholar 

  7. Makholm, H., Sagonas, K.: On enabling the WAM with region support. In: Stuckey, P.J. (ed.) ICLP 2002. LNCS, vol. 2401, Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  8. Mazur, N.: Compile-time garbage collection for the declarative language Mercury. PhD thesis, Department of Computer Science, Katholieke Universiteit Leuven (May 2004)

    Google Scholar 

  9. Mazur, N., Janssens, G., Bruynooghe, M.: A module based analysis for memory reuse in Mercury. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1255–1269. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  10. Mazur, N., Ross, P., Janssens, G., Bruynooghe, M.: Practical aspects for a working compile time garbage collection system for Mercury. In: Codognet, P. (ed.) ICLP 2001. LNCS, vol. 2237, pp. 105–119. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  11. Nielson, F., Nielson, H.R., Hankin, C.: The Principles of Program Analysis. Springer, Heidelberg (1999)

    Google Scholar 

  12. Phan, Q., Janssens, G.: Towards region-based memory management for Mercury programs. In: CICLOPS (2006)

    Google Scholar 

  13. Phan, Q., Janssens, G.: A proposal for runtime region support for Mercury programs. Technical Report CW482, Department of Computer Science, Katholieke Universiteit Leuven (2007)

    Google Scholar 

  14. Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury, an efficient purely declarative logic programming language. The Journal of Logic Programming 29(1-3), 17–64 (1996)

    Article  MATH  Google Scholar 

  15. Tofte, M., Birkedal, L., Elsman, M., Hallenberg, N.: A retrospective on region-based memory management. Higher-Order and Symbolic Computation 17, 245–265 (2004)

    Article  MATH  Google Scholar 

  16. Tofte, M., Talpin, J.-P.: Region-based memory management. Information and Computation. 132(2), 109–176 (1997)

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Véronica Dahl Ilkka Niemelä

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Phan, Q., Janssens, G. (2007). Static Region Analysis for Mercury. In: Dahl, V., Niemelä, I. (eds) Logic Programming. ICLP 2007. Lecture Notes in Computer Science, vol 4670. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74610-2_22

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-74610-2_22

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-74608-9

  • Online ISBN: 978-3-540-74610-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics