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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
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)
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)
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)
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)
Makholm, H.: Region-based memory management in Prolog. Master’s thesis, University of Copenhagen (2000)
Makholm, H., Sagonas, K.: On enabling the WAM with region support. In: Stuckey, P.J. (ed.) ICLP 2002. LNCS, vol. 2401, Springer, Heidelberg (2002)
Mazur, N.: Compile-time garbage collection for the declarative language Mercury. PhD thesis, Department of Computer Science, Katholieke Universiteit Leuven (May 2004)
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)
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)
Nielson, F., Nielson, H.R., Hankin, C.: The Principles of Program Analysis. Springer, Heidelberg (1999)
Phan, Q., Janssens, G.: Towards region-based memory management for Mercury programs. In: CICLOPS (2006)
Phan, Q., Janssens, G.: A proposal for runtime region support for Mercury programs. Technical Report CW482, Department of Computer Science, Katholieke Universiteit Leuven (2007)
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)
Tofte, M., Birkedal, L., Elsman, M., Hallenberg, N.: A retrospective on region-based memory management. Higher-Order and Symbolic Computation 17, 245–265 (2004)
Tofte, M., Talpin, J.-P.: Region-based memory management. Information and Computation. 132(2), 109–176 (1997)
Author information
Authors and Affiliations
Editor information
Rights 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)