Abstract
A conservative garbage collector can typically be used with conventionally compiled programs written in C or C++. But two safety issues must be considered. First, the source code must not hide pointers from the garbage collector. This primarily requires stricter adherence to existing restrictions in the language definition. Second, we must ensure that the compiler will not perform transformations that invalidate this requirement.We argue that the same technique can be used to address both issues. We present an algorithm for annotating source or intermediate code to either check the validity of pointer arithmetic in the source, or to guarantee that under minimal, clearly defined assumptions about the compiler, the optimizer cannot "disguise" pointers. We discuss an implementation based on a preprocessor for the GNU C compiler (gcc), and give some measurements of program slow down.
References
- ANSI89 Standard)(3.159-1989, American National Standard for Information Systems- Programming Language- C, American National Standards Institute, Inc.Google Scholar
- AtkinsonEtAl89 Atkinson, Russ, Alan Demers, Carl Hauser, Christian Jacobi, Peter Kessler, and Mark Weiser, "Experiences Creating a Portable Cedar", Proceedings of the ACM SiGPLAN '89 Conference on Programming Language Design and Implementation, SIGPLAN Notices 24, 7 (July 1989), pp. 322-329. Google Scholar
Digital Library
- AustinBreachSohi94 Austin, Todd M., Scott E. Breach, and Gurindar S. Sohi, "Efficient Detection of all Pointer and Array Access Errors", Proceedings of the ACM SiGPLAN 94 Conference on Programming Language Design and Implementation, SIGPLAN Notices 29, 6 (June 1994), pp. 290-301. Google Scholar
Digital Library
- Bartlett88 Bartlett, Joel F. "Compacting garbage collection with ambiguous roots", Lisp Pointers 1, 6 (April-June 1988), lap. 3-12.Google Scholar
- Bartlett89 Bartlett, Joel F., Scheme-O C a Portable Scheme to-C Compiler, WRL Research Report 89/1, Digital Equipment Corporation Western Research Laboratory, January 1989.Google Scholar
- Boehm93 Boehm, Hans-J., "Space Efficient Conservative Garbage Collection", Proceedings of the ACM SiGPLAN ~93 Conference on Programming Language Design and Implementation, SiGPLAN Notices 28, 6 (June 1993), pp. 197-206. Google Scholar
Digital Library
- Boehm94 The SPARC scheduler is available from parcf~p.xerox.com:pub/gc/sched.tar. Z. It also operates in a GC-safe mode, along the lines of {BoehmChase92}.Google Scholar
- Boehm95 An overview of our conservative garbage collector along with the source code can be accessed from ilia://parcftp.xerox.com/p u b / gc/gc.html.Google Scholar
- BoehmChase92 Boehm, Hans-J, and David Chase, A Proposal for GC-Safe C Compilation, The Journal of C Language Translation 4, 2 (December, 1992), pp. 126-141. Also available (with the publishers permission) from parcftp.xerox.com:pub/gc/boecha, ps.Z.Google Scholar
- BoehmDemersShenker91 Boehm, H., A. Demers, and S. Shenker,"Mostly Parallel Garbage Collection", Proceedings of the ACM SIGPLAN ~1 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164. Google Scholar
Digital Library
- BoehmWeiser88 Boehm, Hans-J. and Mark Weiser, "Garbage collection in an uncooperative environment", Software Practice & Experience 18, 9 (Sept. 1988), pp. 807-820. Google Scholar
Digital Library
- DiwanMossHudson92 Diwan, Amer, Eliot Moss, Richard Hudson, "Compiler Support for Garbage Collection in a Static~y Typed Language", ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, SIGPLAN Notices 27, 7 (July 1992), pp. 273-282. Google Scholar
Digital Library
- DetlefsDosserZorn93 Detlefs, David, A1 Dosser, and Benjamin Zorn, "Memory Allocation Costs in Large C and C + + Programs", University of Colorado, Boulder Technical Report CU-CS-665-93. Available for ftp from cs.colorado.edu:pub/techreports/zom/CU- CS-665-93.ps.Z.Google Scholar
- Edelson91 Edelson, Daniel, "A Mark-and-Sweep Collector for C + + ", Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albuquerque, New Mexico, January 1992, pp. 51-58. Google Scholar
Digital Library
- EllisDetlefs93 Ellis, John R., and David L. Detlefs, "Safe Efficient Garbage Collection for C + +", Xerox PARC Technical Report CSL-93-4, September 1993. Also available from parcftp.xerox.com:pub/ellis/gc/gc, ps.Google Scholar
- Fradet94 Fradet, Pascal, "Collecting More Garbage", Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pp. 24-33. Google Scholar
Digital Library
- Goldberg91 Goldberg, Benjamin, 'Wag-Free Garbage Collection for Strongly Typed Programming Languages", ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 165-176. Google Scholar
Digital Library
- HastingsJoyce92 Hastings, Reed, and Bob Joyce, "Fast Detection of Memory Leaks and Access Errors", Proceedings of the Winter 92 USENIX conference, pp. 125-136.Google Scholar
- JonesKelly95 Jones, Richard, and Paul Kelly, "Bounds Checking for C", http://wwwala. doc. ic.ac.uk/~ phjk/BoundsChecking.html.Google Scholar
- Omohundro91 Omohundro, Stephen M., The Sather Language, ICSI, Berkeley, 1991.Google Scholar
- OTooleNettles94 O'Toole, James, and Scott Nettles, "Concurrent Replicating Garbage Collection", Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pp. 34-42. Google Scholar
Digital Library
- RoseMuller92 Rose, John R., and Hans Muller, "Integrating the Scheme and C languages", Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, pp. 247-259. Google Scholar
Digital Library
- Rovner85 Rovner, Paul, "On Adding Garbage Collection and Runtime Types to a Strongly-Typed Statically Checked, Concurrent Language", Technical Report CSL-84-7, Xerox Palo Alto Research Center, Palo Alto, CA, July 1985.Google Scholar
- SchelterBallantyne88 Schelter, W. F., and M. Ballantyne, "Kyoto Common Lisp", AI Expert 3, 3 (1988), pp. 75-77. Google Scholar
Digital Library
Index Terms
Simple garbage-collector-safety






Comments