Abstract
Our research is concerned with compiler-independent, efficient and convenient garbage collection for C++. Most collectors proposed for C++ have either been implemented in a library or in a compiler. As an intermediate step between those two, this paper proposes using precompilation techniques to augment a C++ source program with code to allow mostly type-accurate garbage collection. There are two key precompiler transformations. The first is automatic generation of smart pointer classes. The precompiler defines the smart pointer classes and the user utilizes them instead of raw pointers. These smart pointers supply functionality that allows the collector to locate the root set for collection. The second transformation augments the C++ program with code that allows the garbage collector to locate internal pointers within objects. This paper describes the precompiler and the garbage collector. The paper includes a brief (1500 word) survey of related techniques.
Preview
Unable to display preview. Download preview PDF.
References
ACM. Proc. PLDI '91 (June 1991). SIGPLAN Not. 26(6).
Appel, A. W. Runtime tags aren't necessary. In Lisp and Symbolic Computation (1989), vol. 2, pp. 153–162.
Appel, A. W., and Li, K. Virtual memory primitives for user programs. In ASPLOS Inter. Conf. Architectural Support for Programming Languages and Operating Systems (Santa Clara, CA (USA), Apr. 1991), pp. 96–107. SIGPLAN Not. 26(4).
Bartlett, J. F. Compacting garbage collection with ambiguous roots. Tech. Rep. 88/2, Digital Equipment Corporation, Western Research Laboratory, Palo Alto, California, Feb. 1988.
Bartlett, J. F. Mostly copying garbage collection picks up generations and C++. Tech. Rep. TN-12, DEC WRL, Oct. 1989.
Boehm, H.-J. Simple gc-safe compilation. Workshop on GC in Object Oriented Systems at OOPSLA '91, 1991.
Boehm, H.-J., Demers, A. J., and Shenker, S. Mostly parallel garbage collection. In Proc. PLDI '91 [1], pp. 157–164. SIGPLAN Not. 26(6).
Boehm, H.-J., and Weiser, M. Garbage collection in an uncooperative environment. Soflw. — Pract. Exp. 18, 9 (Sept. 1988), 807–820.
Christopher, T. W. Reference count garbage collection. Softw. — Pract. Exp. 14, 6 (1984), 503–508.
Coplien, J. Advanced C++ Programming Styles and Idioms. Addison-Wesley, 1992.
Demers, A., Weiser, M., Hayes, B., Boehm, H., Bobrow, D., and Shenker, S. Combining generational and conservative garbage collection: Framework and implementations. In Proc. POPL '90 (Jan. 1990), ACM, ACM, pp. 261–269.
Detlefs, D. Concurrent garbage collection for C++. Tech. Rep. CMU-CS-90-119, Carnegie Mellon, 1990.
Dickman, P. Trading space for time in the garbage collection of actors. In unpublished form, 1992.
Dybvig, K. R.The SCHEME Programming Language. Prentice Hall, Englewood Cliffs, N.J., 1987.
Dykstra, D. Conventions on the use of ObjectStars, 1992. Private communication.
Edelson, D. R. Comparing two garbage collectors for C++. In unpublished form, 1992.
Edelson, D. R. Smart pointers: They're smart but they're not pointers. In Proc. Usenix C++ Technical Conference (Aug. 1992), Usenix Association, pp. 1–19.
Edelson, D. R., and Pohl, I. A copying collector for C++. In Proc. Usenix C++ Conference [40], pp. 85–102.
Ellis, J. Confirmation of unreachability after finalization, 1992. Private communication.
Ellis, M. A., and Stroustrup, B. The Annotated C++ Reference Manual. Addison-Wesley, Feb. 1990.
Ferreira, P. Garbage collection in C++. Workshop on GC in Object Oriented Systems at OOPSLA '91, July 1991.
Ginter, A. Cooperative garbage collectors using smart pointers in the C++ programming language. Master's thesis, Dept. of Computer Science, University of Calgary, Dec. 1991. Tech. Rpt. 91/451/45.
Goldberg, B. Tag-free garbage collection for strongly typed programming languages. In Proc. PLDI '91 [1], pp. 165–176. SIGPLAN Not. 26(6).
Grossman, E. Using smart pointers for transparent access to objects on disk or across a network, 1992. Private communication.
Kafura, D., Washabaugh, D., and Nelson, J. Garbage collection of actors. In Proc. OOPSLA/ECOOP (Oct. 1990), pp. 126–134. SIGPLAN Not. 25(10).
Karplus, K. Using if-then-else DAGs for multi-level logic minimization. In Advanced Research in VLSI: Proceedings of the Decennial Caltech Conference on VLSI (Pasadena, CA, 20–22 March 1989), C. L. Seitz, Ed., MIT Press, pp. 101–118.
Kennedy, B. The features of the object-oriented abstract type hierarchy (OATH). In Proc. Usenix C++ Conference [40], pp. 41–50.
Madany, P. W., Islam, N., Kougiouris, P., and Campbell, R. H. Reification and reflection in C++: An operating systems perspective. Tech. Rep. UIUCDCS-R-92-1736, Dept. of Computer Science, University of Illinois at Urbana-Champaign, Mar. 1992.
Maeder, R. E. A provably correct reference count scheme for a symbolic computation system. In unpublished form, 1992.
Miller, J. S. Multischeme: A Parallel Processing System Based on MIT Scheme. PhD thesis, MIT, 1987. MIT/LCS/Tech. Rep.-402.
Rovner, P. On adding garbage collection and runtime types to a strongly-typed, statically checked, concurrent language. Tech. Rep. CSL-84-7, Xerox PARC, 1984.
Russo, V. Garbage collecting an object-oriented operating system kernel. Workshop on GC in Object Oriented Systems at OOPSLA '91, 1991.
Russo, V. There's no free lunch in conservative garbage collection of an operating system, 1991. Private communication.
Russo, V. Using the parallel Boehm/Weiser/Demers collector in an operating system, 1991. Private communication.
Shapiro, M., Dickman, P., and Plainfossé, D. Robust, distributed references and acyclic garbage collection. In Symp. on Principles of Distributed Computing (Vancouver, Canada, Aug. 1992), ACM.
Shapiro, M., Gourhant, Y., Habert, S., Mosseri, L., Ruffin, M., and Valot, C. SOS: An object-oriented operating system—assessment and perspectives. Comput. Syst. 2, 4 (Dec. 1989), 287–338.
Shapiro, M., Maisonneuve, J., and Collet, P. Implementing references as chains of links. In Workshop on Object Orientation in Operating Systems (1992). To appear.
Stroustrup, B. The evolution of C++ 1985 to 1987. In Proc. Usenix C++ Workshop (Nov. 1987), Usenix Association, pp. 1–22.
Stroustrup, B. The C+ + Programming Language, 2nd ed. Addison-Wesley, 1991.
Usenix Association.Proc. Usenix C++ Conference (Apr. 1991).
Wentworth, E. P. An environment for investigating functional languages and implementations. PhD thesis, University of Port Elizabeth, 1988.
Wentworth, E. P. Pitfalls of conservative garbage collection. Softw. — Pract. Exp. (July 1990), 719–727.
Yasugi, M., and Yonezawa, A. Towards user (application) language-level garbage collection in object-oriented concurrent languages. Workshop on GC in Object Oriented Systems at OOPSLA '91, 1991.
Zorn, B. The measured cost of conservative garbage collection. Tech. Rep. CU-CS-573-92, University of Colorado at Boulder, 1992.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1992 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Edelson, D.R. (1992). Precompiling C++ for garbage collection. In: Bekkers, Y., Cohen, J. (eds) Memory Management. IWMM 1992. Lecture Notes in Computer Science, vol 637. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0017197
Download citation
DOI: https://doi.org/10.1007/BFb0017197
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-55940-5
Online ISBN: 978-3-540-47315-2
eBook Packages: Springer Book Archive