Abstract
This paper describes a compile-time garbage collection (ct-gc) method in the setting of a first-order functional language with data structures. The aim is to obtain information on positions in a program where certain heap cells will become obsolete during execution. Therefore we develop an abstract interpretation for the detection of inheritance information which allows us to detect whether the heap cells of an argument will be propagated to the result of a function call. The abstract interpretation itself is independent of the evaluation strategy of the underlying language. However, since the actual deallocations take place after termination of functions, the information obtained by the abstract interpretation can only be applied in an eager context, which may be detected using strictness analysis in a lazy language. In order to increase efficiency we show how the number of recomputations can be decreased by using only parts of the abstract domains. The worst case time complexity is essentially quadratic in the size of the program. We illustrate the method developed in this paper with several examples and we demonstrate how to use the results in an eager implementation. Correctness of the analysis is considered, using a modified denotational semantics as reference point. Experimental results demonstrate the practicability of our method. A main goal of our work is to keep both the run-time and the compile-time overhead as small as possible.
Preview
Unable to display preview. Download preview PDF.
References
S. Abramsky. Strictness analysis and polymorphic invariance. In G. Goos and J. Hartmanis, editors, Workshop on Programs as Data Objects, number 217 in LNCS, pages 1–24, 1986.
G. Baraki and J. Hughes. Abstract interpretation of polymorphic functions. In K. Davis and J. Hughes, editors, Functional Programming, Glasgow, 1989.
H. Boehm. Space efficient conservative garbage collection. In Proc. of the ACM SIGPLAN '91 Conference, number 28 in SIGPLAN Notices, 1991.
H. Boehm and M. Weiser. Garbage collection in an uncooperative environment. Software Practice & Experience, pages 807–820, September 1988.
A. Gill, J. Launchbury, and S. L. Peyton Jones. A short cut to deforestation. In Proc. of FPCA, 1993.
G. W. Hamilton and S. B. Jones. Compile-time garbage collection by necessity analysis. In S. L. Peyton Jones, G. Hutton, and C. Kehler Holst, editors, Functional Programming, Glasgow, 1990.
S. Hughes. Compile-time garbage collection for higher-order functional languages. Journal of Logic and Computation, 2(4):483–509, 1992.
S. B. Jones and D. Le Métayer. Compile-time garbage collection by sharing analysis. In Proceedings of FPCA, 1989.
T. P. Jensen and T. A. E. Mogensen. A backward analysis for compile-time garbage collection. In G. Goos and J. Hartmanis, editors, Proceedings of ESOP 90, number 432 in LNCS, pages 227–239, 1990.
M. Mohnen. Efficient closure utilisation by higher-order inheritance analysis. To appear in Proceedings of SAS 95 (LNCS), 1995.
M. Mohnen. Functional specification of imperative programs: An alternative point of view of functional languages. Technical Report 95-9, RWTH Aachen, 1995.
A. Mycroft. Theory and practice of transforming call-by-need into call-by-value. In Proceedings of the International Symposium on Programming, number 83 in LNCS, pages 269–281, 1980.
Y. G. Park and B. Goldberg. Escape analysis on lists. In PLDI 92, ACM SIGPLAN, pages 116–127, 1992.
K. Inoue, H. Seki and H. Yagi. Analysis of functional programs to detect run-time garbage cells. TOPLAS, 10(4):555–578, October 1988.
P. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 1(73):231–248, 1990.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1995 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Mohneu, M. (1995). Efficient compile-time garbage collection for arbitrary data structures. In: Hermenegildo, M., Swierstra, S.D. (eds) Programming Languages: Implementations, Logics and Programs. PLILP 1995. Lecture Notes in Computer Science, vol 982. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0026824
Download citation
DOI: https://doi.org/10.1007/BFb0026824
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-60359-7
Online ISBN: 978-3-540-45048-1
eBook Packages: Springer Book Archive