Abstract
A non-algorithmic approach to garbage collection for the WAM heap is developed. A set of garbage collections compatible with the WAM is specified in two steps: the first step makes the useful data for each continuation private and ensures that only useful terms survive garbage collection. The second step completes garbage collection by extending the intuitive notion of folding of identical structures. The role of the trail in the folding process is crucial and it is shown for the ordinary WAM trail as well as for a value trail. New and unexpected opportunities for recovering memory are discovered to be compatible with this view of garbage collection. This approach leads to better understanding of the usefulness logic in the WAM, it is a good start for the formal specification of the garbage collection process and it shows a potential for new compile time analyses that can improve run time memory management. Choice point trimming is used as a vehicle to show selective liveness of data, so its relation to the more common stack maps is established.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
H. Ait-Kaci. The WAM: a (real) tutorial. Technical Report 5, DEC Paris Research Report, 1990 See also: http://www.isg.sfu.ca/~hak/documents/wam.html.
A. W. Appel and M. J. R. Goncalves. Hash-consing garbage collection. Technical Report CS-TR-412-93, Princeton University, Feb. 1993.
K. Appleby, M. Carlsson, S. Haridi, and D. Sahlin. Garbage collection for Prolog based on WAM. Communications of the ACM, 31(6):719–741, June 1988.
Y. Bekkers, O. Ridoux, and L. Ungaro. Dynamic memory management for sequential logic programming languages. In Y. Bekkers and J. Cohen, editors, Proceedings of IWMM’92: International Workshop on Memory Management, number 637 in Lecture Notes in Computer Science, pages 82–102. Springer-Verlag, Sept. 1992.
J. Bevemyr and T. Lindgren. A simple and efficient copying garbage collector for Prolog. In M. Hermenegildo and J. Penjam, editors, Proceedings of the Sixth International Symposium on Programming Language Implementation and Logic Programming, number 844 in Lecture Notes in Computer Science, pages 88–101. Springer-Verlag, Sept. 1994.
L. F. Castro and V. S. Costa. Understanding Memory Management in Prolog Systems. In P. Codognet, editor, Proceedings of the 17th International Conference on Logic Programming, ICLP’2001, number 2237 in Lecture Notes in Computer Science, pages 11–26. Springer-Verlag, nov 2001.
B. Demoen. Early reset and reference counting improve variable shunting in the WAM. Report CW 298, Dept. of Comp. Sc., K. U. Leuven, Belgium, Aug. 2000.
B. Demoen. Marking in the presence of destructive assignment is suboptimal. Report CW 302, Dept. of Computer Science, K. U. Leuven, Belgium, Oct. 2000.
B. Demoen. Prolog and abduction 4 writing garbage collectors. In K.-K. Lau, editor, Pre-Proceedings of Tenth International Workshop on Logic-based Program Syntthesis and Transformation, 2000, pages 128–135. University of Manchester, 2000. Technical Report Series, Department of Computer Science, University of Manchester, ISSN 1361-6161. Report number UMCS-00-6-1.
B. Demoen. A fresh look at garbage collection for Prolog. Report CW 330, Dept. of Computer Science, K. U. Leuven, Belgium, Jan. 2002.
B. Demoen, G. Engels, and P. Tarau. Segment order preserving copying garbage collection for WAM based Prolog. In Proceedings of the 1996 ACM Symposium on Applied Computing, pages 380–386. ACM Press, Feb. 1996.
R. Jones and R. Lins. Garbage Collection: Algorithms for automatic memory management. John Wiley, 1996 See also http://www.cs.ukc.ac.uk/people/staff/rej/gcbook/gcbook.html.
X. Li. Efficient memory management in a merged heap/stack Prolog machine. In Proceedings of the 2nd ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP’00), pages 245–256. ACM Press, 2000.
E. Lusk, R. Butler, et. al. The aurora or-parallel prolog system. New Generation Computing, 7(2,3):243–271, 1990.
F. L. Morris. A time-and space-efficient garbage compaction algorithm. Communications of the ACM, 21(8):662–665, Aug. 1978.
J. Noyé. Elagage de contexte, retour arrière superficiel, modifications réversibles et autres: une étude approfondie de la WAM. PhD thesis, Universite de Rennes I, Nov. 1994.
K. Sagonas, T. Swift, and D. S. Warren. XSB as an efficient deductive database engine. In Proc. of SIGMOD 1994 Conference. ACM, 1994.
D. Sahlin and M. Carlsson. Variable Shunting for the WAM. Technical Report SICS/R-91/9107, SICS, 1991.
P. Tarau. Program transformations and wam-support for the compilation of definite metaprograms. In A. Voronkov, editor, Russian Conference on Logic Programming, number 592 in Lecture Notes in Artificial Intelligence, pages 462–473, Berlin, Heidelberg, 1992. Springer-Verlag.
D. H. D. Warren. An abstract Prolog instruction set. Tech. Report 309, SRI, 1983.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Demoen, B. (2002). A Different Look at Garbage Collection for the WAM. In: Stuckey, P.J. (eds) Logic Programming. ICLP 2002. Lecture Notes in Computer Science, vol 2401. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45619-8_13
Download citation
DOI: https://doi.org/10.1007/3-540-45619-8_13
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43930-1
Online ISBN: 978-3-540-45619-3
eBook Packages: Springer Book Archive