home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / SYSTEM / GC / README < prev    next >
Text File  |  1994-12-22  |  50KB  |  992 lines

  1. Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
  2. Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
  3.  
  4. THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
  5. OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
  6.  
  7. Permission is hereby granted to use or copy this program
  8. for any purpose,  provided the above notices are retained on all copies.
  9. Permission to modify the code and to distribute modified code is granted,
  10. provided the above notices are retained, and a notice that the code was
  11. modified is included with the above copyright notice.
  12.  
  13. This is version 4.3 of a conservative garbage collector for C and C++.
  14.  
  15. HISTORY -
  16.  
  17.   Early versions of this collector were developed as a part of research
  18. projects supported in part by the National Science Foundation
  19. and the Defense Advance Research Projects Agency.
  20. Much of the code was rewritten by Hans-J. Boehm at Xerox PARC.
  21. The SPARC specific code was contributed by Mark Weiser
  22. (weiser@parc.xerox.com).  The Encore Multimax modifications were supplied by
  23. Kevin Kenny (kenny@m.cs.uiuc.edu).  The adaptation to the RT is largely due
  24. to Vernon Lee (scorpion@rice.edu), on machines made available by IBM.
  25. Much of the HP specific code and a number of good suggestions for improving the
  26. generic code are due to Walter Underwood (wunder@hp-ses.sde.hp.com).
  27. Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code.
  28. Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk)
  29. subsequently provided updates and information on variation between ULTRIX
  30. systems.  Parag Patel (parag@netcom.com) supplied the A/UX code.
  31. Jesper Peterson(jep@mtiame.mtia.oz.au) and
  32. Michel Schinz supplied the Amiga port.
  33. Thomas Funke (thf@zelator.in-berlin.de(?)) and
  34. Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports.
  35. Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code.
  36. Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader
  37. specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and
  38. Sony News specific code.  Al Dosser provided Alpha/OSF/1 code.  He and
  39. Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes.
  40. Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports.
  41. Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port.
  42. Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to
  43. a Motorola 88K processor running CX/UX (Harris NightHawk).
  44. Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to
  45. nonIBM development environments (a nontrivial task).
  46. Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port.
  47. David Chase, then at Olivetti Research, suggested several improvements.
  48. Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the
  49. code to save and print call stacks for leak detection on a SPARC.
  50. Jesse Hull and John Ellis supplied the C++ interface code.
  51. Zhong Shao performed much of the experimentation that led to the
  52. current typed allocation facility.  (His dynamic type inference code hasn't
  53. made it into the released version of the collector, yet.)
  54. (Blame for misinstallation of these modifications goes to the first author,
  55. however.)
  56.  
  57.     This is intended to be a general purpose, garbage collecting storage
  58. allocator.  The algorithms used are described in:
  59.  
  60. Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
  61. Software Practice & Experience, September 1988, pp. 807-820.
  62.  
  63. Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
  64. Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
  65. and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
  66.  
  67. Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
  68. of the ACM SIGPLAN '91 Conference on Programming Language Design and
  69. Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
  70.  
  71.   Possible interactions between the collector and optimizing compilers are
  72. discussed in
  73.  
  74. Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
  75. The Journal of C Language Translation 4, 2 (December 1992).
  76. (Also available from parcftp.xerox.com:pub/gc, among other places.)
  77.  
  78.   Unlike the collector described in the second reference, this collector
  79. operates either with the mutator stopped during the entire collection
  80. (default) or incrementally during allocations.  (The latter is supported
  81. on only a few machines.)  It does not rely on threads, but is intended
  82. to be thread-safe.
  83.  
  84.   Some of the ideas underlying the collector have previously been explored
  85. by others.  (Doug McIlroy wrote a vaguely similar collector that is part of
  86. version 8 UNIX (tm).)  However none of this work appears to have been widely
  87. disseminated.
  88.  
  89.   Rudimentary tools for use of the collector as a leak detector are included, as
  90. is a fairly sophisticated string package "cord" that makes use of the collector.
  91. (See cord/README.)
  92.  
  93.  
  94. GENERAL DESCRIPTION
  95.  
  96.   This is a garbage colecting storage allocator that is intended to be
  97. used as a plug-in replacement for C's malloc.
  98.  
  99.   Since the collector does not require pointers to be tagged, it does not
  100. attempt to ensure that all inaccessible storage is reclaimed.  However,
  101. in our experience, it is typically more successful at reclaiming unused
  102. memory than most C programs using explicit deallocation.  Unlike manually
  103. introduced leaks, the amount of unreclaimed memory typically stays
  104. bounded.
  105.  
  106.   In the following, an "object" is defined to be a region of memory allocated
  107. by the routines described below.  
  108.  
  109.   Any objects not intended to be collected must be pointed to either
  110. from other such accessible objects, or from the registers,
  111. stack, data, or statically allocated bss segments.  Pointers from
  112. the stack or registers may point to anywhere inside an object.
  113. However, it is usually assumed that all pointers originating in the
  114. heap point to the beginning of an object.  (This does
  115. not disallow interior pointers; it simply requires that there must be a
  116. pointer to the beginning of every accessible object, in addition to any
  117. interior pointers.)  There are two facilities for altering this behavior.
  118. The macro ALL_INTERIOR_POINTERS may be defined in gc_private.h to
  119. cause any pointer into an object (or one past the end) to retain the
  120. object.  A routine GC_register_displacement is provided to allow for
  121. more controlled interior pointer use in the heap.  Defining
  122. ALL_INTERIOR_POINTERS is somewhat dangerous, in that it can result
  123. in unnecessary memroy retention.  However this is much less of a
  124. problem than with older collector versions.  The routine
  125. GC_register_displacement is described in gc.h.
  126.  
  127.   Note that pointers inside memory allocated by the standard "malloc" are not
  128. seen by the garbage collector.  Thus objects pointed to only from such a
  129. region may be prematurely deallocated.  It is thus suggested that the
  130. standard "malloc" be used only for memory regions, such as I/O buffers, that
  131. are guaranteed not to contain pointers.  Pointers in C language automatic,
  132. static, or register variables, are correctly recognized.  (Note that
  133. GC_malloc_uncollectable has semantics similar to standard malloc,
  134. but allocates objects that are traced by the collector.)
  135.  
  136.   The collector does not generally know how to find pointers in data
  137. areas that are associated with dynamic libraries.  This is easy to
  138. remedy IF you know how to find those data areas on your operating
  139. system (see GC_add_roots).  Code for doing this under SunOS and IRIX 5.X is
  140. included (see dynamic_load.c).
  141.  
  142.   Note that the garbage collector does not need to be informed of shared
  143. read-only data.  However if the shared library mechanism can introduce
  144. discontiguous data areas that may contain pointers, then the collector does
  145. need to be informed.
  146.  
  147.   Signal processing for most signals is normally deferred during collection,
  148. and during uninterruptible parts of the allocation process.  Unlike
  149. standard ANSI C mallocs, it is intended to be safe to invoke malloc
  150. from a signal handler while another malloc is in progress, provided
  151. the original malloc is not restarted.  (Empirically, many UNIX
  152. applications already asssume this.)  Even this modest level of signal-
  153. safety may be too expensive on some systems.  If so, ENABLE_SIGNALS
  154. and DISABLE_SIGNALS may be redefined to the empty statement in gc_private.h.
  155.  
  156.   The allocator/collector can also be configured for thread-safe operation.
  157. (Full signal safety can also be acheived, but only at the cost of two system
  158. calls per malloc, which is usually unacceptable.)
  159.  
  160. INSTALLATION AND PORTABILITY
  161.  
  162.   As distributed, the macro SILENT is defined in Makefile.
  163. In the event of problems, this can be removed to obtain a moderate
  164. amount of descriptive output for each collection.
  165. (The given statistics exhibit a few peculiarities.
  166. Things don't appear to add up for a variety of reasons, most notably
  167. fragmentation losses.  These are probably much more significant for the
  168. contrived program "test.c" than for your application.)
  169.  
  170.   Note that typing "make test" will automatically build the collector
  171. and then run setjmp_test and gctest. Setjmp_test will give you information
  172. about configuring the collector, which is useful primarily if you have
  173. a machine that's not already supported.  Gctest is a somewhat superficial
  174. test of collector functionality.  Failure is indicated by a core dump or
  175. a message to the effect that the collector is broken.  Gctest takes about 
  176. 35 seconds to run on a SPARCstation 2. On a slower machine,
  177. expect it to take a while.  It may use up to 8 MB of memory.  (The
  178. multi-threaded version will use more.)  "Make test" will also, as
  179. its last step, attempt to build and test the "cord" string library.
  180. This will fail without an ANSI C compiler.
  181.  
  182.   The Makefile will generate a library gc.a which you should link against.
  183. Typing "make cords" will add the cord library to gc.a.
  184. Note that this requires an ANSI C compiler.
  185.  
  186.   It is suggested that if you need to replace a piece of the collector
  187. (e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
  188. ld command line, rather than replacing the one in gc.a.  (This will
  189. generate numerous warnings under some versions of AIX, but it still
  190. works.)
  191.  
  192.   All include files that need to be used by clients will be put in the
  193. include subdirectory.  (Normally this is just gc.h.  "Make cords" adds
  194. "cord.h" and "ec.h".)
  195.  
  196.   The collector currently is designed to run essentially unmodified on
  197. the following machines (most of the operating systems mentioned are
  198. trademarks of their respective holders):
  199.  
  200.         Sun 3
  201.         Sun 4 under SunOS 4.X or Solaris2.X (with or without threads)
  202.         Vax under 4.3BSD, Ultrix
  203.         Intel 386 or 486 under most operating systems, but not MSDOS.
  204.             (Win32S is somewhat supported, so it is possible to
  205.             build applications for Windows 3.1.  There exists a port
  206.             to DOS + 32 bit extender for at least one 32 bit extender.
  207.             However, I don't have source for this.)
  208.         Sequent Symmetry  (single threaded)
  209.         Encore Multimax   (single threaded)
  210.         MIPS M/120 (and presumably M/2000) (RISC/os 4.0 with BSD libraries)
  211.         IBM PC/RT  (Berkeley UNIX)
  212.         IBM RS/6000
  213.         HP9000/300
  214.         HP9000/700
  215.         DECstations under Ultrix
  216.         DEC Alpha running OSF/1
  217.         SGI workstations under IRIX 4 & 5
  218.         Sony News
  219.         Apple MacIntosh under A/UX or MacOS
  220.         Commodore Amiga (see README.amiga)
  221.         NeXT machines
  222.  
  223.   In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
  224. or equivalent is supplied.
  225.  
  226.   Dynamic libraries are completely supported only under SunOS
  227. (and even that support is not functional on the last Sun 3 release),
  228. IRIX 5, Win32 (not Win32S) and OSF/1 on DEC AXP machines.
  229. On other machines we recommend that you do one of the following:
  230.  
  231.   1) Add dynamic library support (and send us the code).
  232.   2) Use static versions of the libraries.
  233.   3) Arrange for dynamic libraries to use the standard malloc.
  234.      This is still dangerous if the library stores a pointer to a
  235.      garbage collected object.  But nearly all standard interfaces
  236.      prohibit this, because they deal correctly with pointers
  237.      to stack allocated objects.  (Strtok is an exception.  Don't
  238.      use it.)
  239.  
  240.   In all cases we assume that pointer alignment is consistent with that
  241. enforced by the standard C compilers.  If you use a nonstandard compiler
  242. you may have to adjust the alignment parameters defined in gc_private.h.
  243.  
  244.   A port to a machine that is not byte addressed, or does not use 32 bit
  245. or 64 bit addresses will require a major effort.  A port to MSDOS is hard,
  246. unless you are willing to assume an 80386 or better, and that only flat
  247. 32 bit pointers will ever need to be seen by the collector.
  248.  
  249.   For machines not already mentioned, or for nonstandard compilers, the
  250. following are likely to require change:
  251.  
  252. 1.  The parameters in config.h.
  253.       The parameters that will usually require adjustment are
  254.    STACKBOTTOM,  ALIGNMENT and DATASTART.  Setjmp_test
  255.    prints its guesses of the first two.
  256.       DATASTART should be an expression for computing the
  257.    address of the beginning of the data segment.  This can often be
  258.    &etext.  But some memory management units require that there be
  259.    some unmapped space between the text and the data segment.  Thus
  260.    it may be more complicated.   On UNIX systems, this is rarely
  261.    documented.  But the adb "$m" command may be helpful.  (Note
  262.    that DATASTART will usually be a function of &etext.  Thus a
  263.    single experiment is usually insufficient.)
  264.      STACKBOTTOM is used to initialize GC_stackbottom, which
  265.    should be a sufficient approximation to the coldest stack address.
  266.    On some machines, it is difficult to obtain such a value that is
  267.    valid across a variety of MMUs, OS releases, etc.  A number of
  268.    alternatives exist for using the collector in spite of this.  See the
  269.    discussion in config.h.h immediately preceding the various
  270.    definitions of STACKBOTTOM.
  271.    
  272. 2.  mach_dep.c.
  273.       The most important routine here is one to mark from registers.
  274.     The distributed file includes a generic hack (based on setjmp) that
  275.     happens to work on many machines, and may work on yours.  Try
  276.     compiling and running setjmp_test.c to see whether it has a chance of
  277.     working.  (This is not correct C, so don't blame your compiler if it
  278.     doesn't work.  Based on limited experience, register window machines
  279.     are likely to cause trouble.  If your version of setjmp claims that
  280.     all accessible variables, including registers, have the value they
  281.     had at the time of the longjmp, it also will not work.  Vanilla 4.2 BSD
  282.     makes such a claim.  SunOS does not.)
  283.       If your compiler does not allow in-line assembly code, or if you prefer
  284.     not to use such a facility, mach_dep.c may be replaced by a .s file
  285.     (as we did for the MIPS machine and the PC/RT).
  286.       At this point enough architectures are supported by mach_dep.c
  287.     that you will rarely need to do more than adjust for assembler
  288.     syntax.
  289.  
  290. 3.  os_dep.c (and gc_priv.h).
  291.         Several kinds of operating system dependent routines reside here.
  292.       Many are optional.  Several are invoked only through corresponding
  293.       macros in gc_priv.h, which may also be redefined as appropriate.
  294.       The routine GC_register_data_segments is crucial.  It registers static
  295.     data areas that must be traversed by the collector. (User calls to
  296.     GC_add_roots may sometimes be used for similar effect.)
  297.       Routines to obtain memory from the OS also reside here.
  298.     Alternatively this can be done entirely by the macro GET_MEM
  299.     defined in gc_priv.h.  Routines to disable and reenable signals
  300.     also reside here if they are need by the macros DISABLE_SIGNALS
  301.     and ENABLE_SIGNALS defined in gc_priv.h.
  302.       In a multithreaded environment, the macros LOCK and UNLOCK
  303.     in gc_priv.h will need to be suitably redefined.
  304.       The incremental collector requires page dirty information, which
  305.     is acquired through routines defined in os_dep.c.  Unless directed
  306.     otherwise by config.h, these are implemented as stubs that simply
  307.     treat all pages as dirty.  (This of course makes the incremental
  308.     collector much less useful.)
  309.  
  310. 4.  dyn_load.c
  311.     This provides a routine that allows the collector to scan data
  312.     segments associated with dynamic libraries.  Often it is not
  313.     necessary to provide this routine unless user-written dynamic
  314.     libraries are used.
  315.  
  316.   For a different version of UN*X or different machines using the
  317. Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
  318. it should frequently suffice to change definitions in config.h.
  319.  
  320.  
  321. THE C INTERFACE TO THE ALLOCATOR
  322.  
  323.   The following routines are intended to be directly called by the user.
  324. Note that usually only GC_malloc is necessary.  GC_clear_roots and GC_add_roots
  325. calls may be required if the collector has to trace from nonstandard places
  326. (e.g. from dynamic library data areas on a machine on which the 
  327. collector doesn't already understand them.)  On some machines, it may
  328. be desirable to set GC_stacktop to a good approximation of the stack base. 
  329. (This enhances code portability on HP PA machines, since there is no
  330. good way for the collector to compute this value.)  Client code may include
  331. "gc.h", which defines all of the following, plus a few others.
  332.  
  333. 1)  GC_malloc(nbytes)
  334.     - allocate an object of size nbytes.  Unlike malloc, the object is
  335.       cleared before being returned to the user.  Gc_malloc will
  336.       invoke the garbage collector when it determines this to be appropriate.
  337.       GC_malloc may return 0 if it is unable to acquire sufficient
  338.       space from the operating system.  This is the most probable
  339.       consequence of running out of space.  Other possible consequences
  340.       are that a function call will fail due to lack of stack space,
  341.       or that the collector will fail in other ways because it cannot
  342.       maintain its internal data structures, or that a crucial system
  343.       process will fail and take down the machine.  Most of these
  344.       possibilities are independent of the malloc implementation.
  345.  
  346. 2)  GC_malloc_atomic(nbytes)
  347.     - allocate an object of size nbytes that is guaranteed not to contain any
  348.       pointers.  The returned object is not guaranteed to be cleeared.
  349.       (Can always be replaced by GC_malloc, but results in faster collection
  350.       times.  The collector will probably run faster if large character
  351.       arrays, etc. are allocated with GC_malloc_atomic than if they are
  352.       statically allocated.)
  353.  
  354. 3)  GC_realloc(object, new_size)
  355.     - change the size of object to be new_size.  Returns a pointer to the
  356.       new object, which may, or may not, be the same as the pointer to
  357.       the old object.  The new object is taken to be atomic iff the old one
  358.       was.  If the new object is composite and larger than the original object,
  359.       then the newly added bytes are cleared (we hope).  This is very likely
  360.       to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
  361.       Even then, it is likely to recycle the old object only if the object
  362.       is grown in small additive increments (which, we claim, is generally bad
  363.       coding practice.)
  364.  
  365. 4)  GC_free(object)
  366.     - explicitly deallocate an object returned by GC_malloc or
  367.       GC_malloc_atomic.  Not necessary, but can be used to minimize
  368.       collections if performance is critical.  Probably a performance
  369.       loss for very small objects (<= 8 bytes).
  370.  
  371. 5)  GC_expand_hp(bytes)
  372.     - Explicitly increase the heap size.  (This is normally done automatically
  373.       if a garbage collection failed to GC_reclaim enough memory.  Explicit
  374.       calls to GC_expand_hp may prevent unnecessarily frequent collections at
  375.       program startup.)
  376.       
  377. 6)  GC_clear_roots()
  378.     - Reset the collectors idea of where static variables containing pointers
  379.       may be located to the empty set of locations.  No statically allocated
  380.       variables will be traced from after this call, unless there are
  381.       intervening GC_add_roots calls.  The collector will still trace from
  382.       registers and the program stack.
  383.       
  384. 7)  GC_add_roots(low_address, high_address_plus_1)
  385.     - Add [low_address, high_address) as an area that may contain root pointers
  386.       and should be traced by the collector.  The static data and bss segments
  387.       are considered by default, and should not be added unless GC_clear_roots
  388.       has been called.  The number of root areas is currently limited to 50.
  389.       This is intended as a way to register data areas for dynamic libraries,
  390.       or to replace the entire data ans bss segments by smaller areas that are
  391.       known to contain all the roots. 
  392.       
  393. 8) GC_enable_incremental()
  394.     - Enables generational and incremental collection.  Useful for large
  395.       heaps on machines that provide access to page dirty information.
  396.       Some dirty bit implementations may interfere with debugging
  397.       (by catching address faults) and place restrictions on heap arguments
  398.       to system calls (since write faults inside a system call may not be
  399.       handled well).
  400.  
  401. 9) Several routines to allow for registration of finalization code.
  402.    User supplied finalization code may be invoked when an object becomes
  403.    unreachable.  To call (*f)(obj, x) when obj becomes inaccessible, use
  404.     GC_register_finalizer(obj, f, x, 0, 0);
  405.    For more sophisticated uses, and for finalization ordering issues,
  406.    see gc.h.
  407.  
  408.   The global variable GC_free_space_divisor may be adjusted up from its
  409. default value of 4 to use less space and more collection time, or down for
  410. the opposite effect.  Setting it to 1 or 0 will effectively disable collections
  411. and cause all allocations to simply grow the heap.
  412.  
  413.   The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
  414. the amount of memory allocated by the above routines that should not be
  415. considered as a candidate for collection.  Careless use may, of course, result
  416. in excessive memory consumption.
  417.  
  418.   Some additional tuning is possible through the parameters defined
  419. near the top of gc_private.h.
  420.   
  421.   If only GC_malloc is intended to be used, it might be appropriate to define:
  422.  
  423. #define malloc(n) GC_malloc(n)
  424. #define calloc(m,n) GC_malloc((m)*(n))
  425.  
  426.   For small pieces of VERY allocation intensive code, gc_inl.h
  427. includes some allocation macros that may be used in place of GC_malloc
  428. and friends.
  429.  
  430.   All externally visible names in the garbage collector start with "GC_".
  431. To avoid name conflicts, client code should avoid this prefix, except when
  432. accessing garbage collector routines or variables.
  433.  
  434.   There are provisions for allocation with explicit type information.
  435. This is rarely necessary.  Details can be found in gc_typed.h.
  436.  
  437. THE C++ INTERFACE TO THE ALLOCATOR:
  438.  
  439.   The Ellis-Hull C++ interface to the collector is included in
  440. the collector distribution.  If you intend to use this, type
  441. "make c++" after the initial build of the collector is complete.
  442. See gc_c++.h for the difinition of the interface.  This interface
  443. tries to approximate the Ellis-Detlefs C++ garbage collection
  444. proposal without compiler changes.
  445.  
  446. Cautions:
  447. 1. Arrays allocated without new placement syntax are
  448. allocated as uncollectable objects.  They are traced by the
  449. collector, but will not be reclaimed.
  450.  
  451. 2. Failure to use "make c++" in combination with (1) will
  452. result in arrays allocated using the default new operator.
  453. This is likely to result in disaster without linker warnings.
  454.  
  455. 3. If your compiler supports an overloaded new[] operator,
  456. then gc_c++.cc and gc_c++.h should be suitably modified.
  457.  
  458.  
  459. USE AS LEAK DETECTOR:
  460.  
  461.   The collector may be used to track down leaks in C programs that are
  462. intended to run with malloc/free (e.g. code with extreme real-time or
  463. portability constraints).  To do so define FIND_LEAK somewhere in
  464. gc_priv.h.  This will cause the collector to invoke the report_leak
  465. routine defined near the top of reclaim.c whenever an inaccessible
  466. object is found that has not been explicitly freed.
  467.   Productive use of this facility normally involves redefining report_leak
  468. to do something more intelligent.  This typically requires annotating
  469. objects with additional information (e.g. creation time stack trace) that
  470. identifies their origin.  Such code is typically not very portable, and is
  471. not included here, except on SPARC machines.
  472.   If all objects are allocated with GC_DEBUG_MALLOC (see next section),
  473. then the default version of report_leak will report the source file
  474. and line number at which the leaked object was allocated.  This may
  475. sometimes be sufficient.  (On SPARC/SUNOS4 machines, it will also report
  476. a cryptic stack trace.  This can often be turned into a sympolic stack
  477. trace by invoking program "foo" with "callprocs foo".  Callprocs is
  478. a short shell script that invokes adb to expand program counter values
  479. to symbolic addresses.  It was largely supplied by Scott Schwartz.)
  480.   Note that the debugging facilities described in the next section can
  481. sometimes be slightly LESS effective in leak finding mode, since in
  482. leak finding mode, GC_debug_free actually results in reuse of the object.
  483. (Otherwise the object is simply marked invalid.)
  484.  
  485. DEBUGGING FACILITIES:
  486.  
  487.   The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
  488. and GC_debug_free provide an alternate interface to the collector, which
  489. provides some help with memory overwrite errors, and the like.
  490. Objects allocated in this way are annotated with additional
  491. information.  Some of this information is checked during garbage
  492. collections, and detected inconsistencies are reported to stderr.
  493.  
  494.   Simple cases of writing past the end of an allocated object should
  495. be caught if the object is explicitly deallocated, or if the
  496. collector is invoked while the object is live.  The first deallocation
  497. of an object will clear the debugging info associated with an
  498. object, so accidentally repeated calls to GC_debug_free will report the
  499. deallocation of an object without debugging information.  Out of
  500. memory errors will be reported to stderr, in addition to returning
  501. NIL.
  502.  
  503.   GC_debug_malloc checking  during garbage collection is enabled
  504. with the first call to GC_debug_malloc.  This will result in some
  505. slowdown during collections.  If frequent heap checks are desired,
  506. this can be acheived by explicitly invoking GC_gcollect, e.g. from
  507. the debugger.
  508.  
  509.   GC_debug_malloc allocated objects should not be passed to GC_realloc
  510. or GC_free, and conversely.  It is however acceptable to allocate only
  511. some objects with GC_debug_malloc, and to use GC_malloc for other objects,
  512. provided the two pools are kept distinct.  In this case, there is a very
  513. low probablility that GC_malloc allocated objects may be misidentified as
  514. having been overwritten.  This should happen with probability at most
  515. one in 2**32.  This probability is zero if GC_debug_malloc is never called.
  516.  
  517.   GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
  518. additional trailing arguments, a string and an integer.  These are not
  519. interpreted by the allocator.  They are stored in the object (the string is
  520. not copied).  If an error involving the object is detected, they are printed.
  521.  
  522.   The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
  523. GC_REGISTER_FINALIZER are also provided.  These require the same arguments
  524. as the corresponding (nondebugging) routines.  If gc.h is included
  525. with GC_DEBUG defined, they call the debugging versions of these
  526. functions, passing the current file name and line number as the two
  527. extra arguments, where appropriate.  If gc.h is included without GC_DEBUG
  528. defined, then all these macros will instead be defined to their nondebugging
  529. equivalents.  (GC_REGISTER_FINALIZER is necessary, since pointers to
  530. objects with debugging information are really pointers to a displacement
  531. of 16 bytes form the object beginning, and some translation is necessary
  532. when finalization routines are invoked.  For details, about what's stored
  533. in the header, see the definition of the type oh in debug_malloc.c)
  534.  
  535. INCREMENTAL/GENERATIONAL COLLECTION:
  536.  
  537. The collector normally interrupts client code for the duration of 
  538. a garbage collection mark phase.  This may be unacceptable if interactive
  539. response is needed for programs with large heaps.  The collector
  540. can also run in a "generational" mode, in which it usually attempts to
  541. collect only objects allocated since the last garbage collection.
  542. Furthermore, in this mode, garbage collections run mostly incrementally,
  543. with a small amount of work performed in response to each of a large number of
  544. GC_malloc requests.
  545.  
  546. This mode is enabled by a call to GC_enable_incremental().
  547.  
  548. Incremental and generational collection is effective in reducing
  549. pause times only if the collector has some way to tell which objects
  550. or pages have been recently modified.  The collector uses two sources
  551. of information:
  552.  
  553. 1. Information provided by the VM system.  This may be provided in
  554. one of several forms.  Under Solaris 2.X (and potentially under other
  555. similar systems) information on dirty pages can be read from the
  556. /proc file system.  Under other systems (currently SunOS4.X) it is
  557. possible to write-protect the heap, and catch the resulting faults.
  558. On these systems we require that system calls writing to the heap
  559. (other than read) be handled specially by client code.
  560. See os_dep.c for details.
  561.  
  562. 2. Information supplied by the programmer.  We define "stubborn"
  563. objects to be objects that are rarely changed.  Such an object
  564. can be allocated (and enabled for writing) with GC_malloc_stubborn.
  565. Once it has been initialized, the collector should be informed with
  566. a call to GC_end_stubborn_change.  Subsequent writes that store
  567. pointers into the object must be preceded by a call to
  568. GC_change_stubborn.
  569.  
  570. This mechanism performs best for objects that are written only for
  571. initialization, and such that only one stubborn object is writable
  572. at once.  It is typically not worth using for short-lived
  573. objects.  Stubborn objects are treated less efficiently than pointerfree
  574. (atomic) objects.
  575.  
  576. A rough rule of thumb is that, in the absence of VM information, garbage
  577. collection pauses are proportional to the amount of pointerful storage
  578. plus the amount of modified "stubborn" storage that is reachable during
  579. the collection.  
  580.  
  581. Initial allocation of stubborn objects takes longer than allocation
  582. of other objects, since other data structures need to be maintained.
  583.  
  584. We recommend against random use of stubborn objects in client
  585. code, since bugs caused by inappropriate writes to stubborn objects
  586. are likely to be very infrequently observed and hard to trace.  
  587. However, their use may be appropriate in a few carefully written
  588. library routines that do not make the objects themselves available
  589. for writing by client code.
  590.  
  591.  
  592. BUGS:
  593.  
  594.   Any memory that does not have a recognizable pointer to it will be
  595. reclaimed.  Exclusive-or'ing forward and backward links in a list
  596. doesn't cut it.
  597.   Some C optimizers may lose the last undisguised pointer to a memory
  598. object as a consequence of clever optimizations.  This has almost
  599. never been observed in practice.  Send mail to boehm@parc.xerox.com
  600. for suggestions on how to fix your compiler.
  601.   This is not a real-time collector.  In the standard configuration,
  602. percentage of time required for collection should be constant across
  603. heap sizes.  But collection pauses will increase for larger heaps.
  604. (On SPARCstation 2s collection times will be on the order of 300 msecs
  605. per MB of accessible memory that needs to be scanned.  Your mileage
  606. may vary.)  The incremental/generational collection facility helps,
  607. but is portable only if "stubborn" allocation is used.
  608.   Please address bug reports to boehm@parc.xerox.com.  If you are
  609. contemplating a major addition, you might also send mail to ask whether
  610. it's already been done (or whether we tried and discarded it).
  611.  
  612. RECENT VERSIONS:
  613.  
  614.   Version 1.3 and immediately preceding versions contained spurious
  615. assembly language assignments to TMP_SP.  Only the assignment in the PC/RT
  616. code is necessary.  On other machines, with certain compiler options,
  617. the assignments can lead to an unsaved register being overwritten.
  618. Known to cause problems under SunOS 3.5 WITHOUT the -O option.  (With
  619. -O the compiler recognizes it as dead code.  It probably shouldn't,
  620. but that's another story.)
  621.  
  622.   Version 1.4 and earlier versions used compile time determined values
  623. for the stack base.  This no longer works on Sun 3s, since Sun 3/80s use
  624. a different stack base.  We now use a straightforward heuristic on all
  625. machines on which it is known to work (incl. Sun 3s) and compile-time
  626. determined values for the rest.  There should really be library calls
  627. to determine such values.
  628.  
  629.   Version 1.5 and earlier did not ensure 8 byte alignment for objects
  630. allocated on a sparc based machine.
  631.  
  632.   Version 1.8 added ULTRIX support in gc_private.h.
  633.   
  634.   Version 1.9 fixed a major bug in gc_realloc.
  635.   
  636.   Version 2.0 introduced a consistent naming convention for collector
  637. routines and added support for registering dynamic library data segments
  638. in the standard mark_roots.c.  Most of the data structures were revamped.
  639. The treatment of interior pointers was completely changed.  Finalization
  640. was added.  Support for locking was added.  Object kinds were added.
  641. We added a black listing facility to avoid allocating at addresses known
  642. to occur as integers somewhere in the address space.  Much of this
  643. was accomplished by adapting ideas and code from the PCR collector.
  644. The test program was changed and expanded.
  645.  
  646.   Version 2.1 was the first stable version since 1.9, and added support
  647. for PPCR.
  648.  
  649.   Version 2.2 added debugging allocation, and fixed various bugs.  Among them:
  650. - GC_realloc could fail to extend the size of the object for certain large object sizes.
  651. - A blatant subscript range error in GC_printf, which unfortunately
  652.   wasn't excercised on machines with sufficient stack alignment constraints.
  653. - GC_register_displacement did the wrong thing if it was called after
  654.   any allocation had taken place.
  655. - The leak finding code would eventually break after 2048 byte
  656.   byte objects leaked.
  657. - interface.c didn't compile.
  658. - The heap size remained much too small for large stacks.
  659. - The stack clearing code behaved badly for large stacks, and perhaps
  660.   on HP/PA machines.
  661.  
  662.   Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs:
  663. - Missing declaration of etext in the A/UX version.
  664. - Some PCR root-finding problems.
  665. - Blacklisting was not 100% effective, because the plausible future
  666.   heap bounds were being miscalculated.
  667. - GC_realloc didn't handle out-of-memory correctly.
  668. - GC_base could return a nonzero value for addresses inside free blocks.
  669. - test.c wasn't really thread safe, and could erroneously report failure
  670.   in a multithreaded environment.  (The locking primitives need to be
  671.   replaced for other threads packages.)
  672. - GC_CONS was thoroughly broken.
  673. - On a SPARC with dynamic linking, signals stayed diabled while the
  674.   client code was running.
  675.   (Thanks to Manuel Serrano at INRIA for reporting the last two.)
  676.   
  677.   Version 2.4 added GC_free_space_divisor as a tuning knob, added
  678.   support for OS/2 and linux, and fixed the following bugs:
  679. - On machines with unaligned pointers (e.g. Sun 3), every 128th word could
  680.   fail to be considered for marking.
  681. - Dynamic_load.c erroneously added 4 bytes to the length of the data and
  682.   bss sections of the dynamic library.  This could result in a bad memory
  683.   reference if the actual length was a multiple of a page.  (Observed on
  684.   Sun 3.  Can probably also happen on a Sun 4.)
  685.   (Thanks to Robert Brazile for pointing out that the Sun 3 version
  686.   was broken.  Dynamic library handling is still broken on Sun 3s
  687.   under 4.1.1U1, but apparently not 4.1.1.  If you have such a machine,
  688.   use -Bstatic.)
  689.   
  690.   Version 2.5 fixed the following bugs:
  691. - Removed an explicit call to exit(1)
  692. - Fixed calls to GC_printf and GC_err_printf, so the correct number of
  693.   arguments are always supplied.  The OS/2 C compiler gets confused if
  694.   the number of actuals and the number of formals differ.  (ANSI C
  695.   doesn't require this to work.  The ANSI sanctioned way of doing things
  696.   causes too many compatibility problems.)
  697.   
  698.   Version 3.0  added generational/incremental collection and stubborn
  699.   objects.
  700.  
  701.   Version 3.1 added the following features:
  702. - A workaround for a SunOS 4.X SPARC C compiler
  703.   misfeature that caused problems when the collector was turned into
  704.   a dynamic library.  
  705. - A fix for a bug in GC_base that could result in a memory fault.
  706. - A fix for a performance bug (and several other misfeatures) pointed
  707.   out by Dave Detelfs and Al Dosser.
  708. - Use of dirty bit information for static data under Solaris 2.X.
  709. - DEC Alpha/OSF1 support (thanks to Al Dosser).
  710. - Incremental collection on more platforms.
  711. - A more refined heap expansion policy.  Less space usage by default.
  712. - Various minor enhancements to reduce space usage, and to reduce
  713.   the amount of memory scanned by the collector.
  714. - Uncollectable allocation without per object overhead.
  715. - More conscientious handling of out-of-memory conditions.
  716. - Fixed a bug in debugging stubborn allocation.
  717. - Fixed a bug that resulted in occasional erroneous reporting of smashed
  718.   objects with debugging allocation.
  719. - Fixed bogus leak reports of size 4096 blocks with FIND_LEAK.
  720.  
  721.   Version 3.2 fixed a serious and not entirely repeatable bug in
  722.   the incremental collector.  It appeared only when dirty bit info
  723.   on the roots was available, which is normally only under Solaris.
  724.   It also added GC_general_register_disappearing_link, and some
  725.   testing code.  Interface.c disappeared.
  726.  
  727.   Version 3.3 fixes several bugs and adds new ports:
  728. - PCR-specific bugs.
  729. - Missing locking in GC_free, redundant FASTUNLOCK
  730.   in GC_malloc_stubborn, and 2 bugs in
  731.   GC_unregister_disappearing_link.
  732.   All of the above were pointed out by Neil Sharman
  733.   (neil@cs.mu.oz.au).
  734. - Common symbols allocated by the SunOS4.X dynamic loader
  735.   were not included in the root set.
  736. - Bug in GC_finalize (reported by Brian Beuning and Al Dosser)
  737. - Merged Amiga port from Jesper Peterson (untested)
  738. - Merged NeXT port from Thomas Funke (significantly
  739.   modified and untested)
  740.  
  741.   Version 3.4:
  742. - Fixed a performance bug in GC_realloc.
  743. - Updated the amiga port.
  744. - Added NetBSD and 386BSD ports.
  745. - Added cord library.
  746. - Added trivial performance enhancement for
  747.   ALL_INTERIOR_POINTERS.  (Don't scan last word.)
  748.   
  749.   Version 3.5
  750. - Minor collections now mark from roots only once, if that
  751.   doesn't cause an excessive pause.
  752. - The stack clearing heuristic was refined to prevent anomalies
  753.   with very heavily recursive programs and sparse stacks.
  754. - Fixed a bug that prevented mark stack growth in some cases.
  755.   GC_objects_are_marked should be set to TRUE after a call
  756.   to GC_push_roots and as part of GC_push_marked, since
  757.   both can now set mark bits.  I think this is only a performance
  758.   bug, but I wouldn't bet on it.  It's certainly very hard to argue
  759.   that the old version was correct.
  760. - Fixed an incremental collection bug that prevented it from
  761.   working at all when HBLKSIZE != getpagesize()
  762. - Changed dynamic_loading.c to include gc_private.h before testing
  763.   DYNAMIC_LOADING.  SunOS dynamic library scanning
  764.   must have been broken in 3.4.
  765. - Object size rounding now adapts to program behavior.
  766. - Added a workaround (provided by Manuel Serrano and
  767.   colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug
  768.   that I had incorrectly assumed to have been squished.
  769.   The collector was broken if the text segment size was within
  770.   32 bytes of a multiple of 8K bytes, and if the beginning of
  771.   the data segment contained interesting roots.  The workaround
  772.   assumes a demand-loadable executable.  The original may have
  773.   have "worked" in some other cases.
  774. - Added dynamic library support under IRIX5.
  775. - Added support for EMX under OS/2 (thanks to Ari Huttunen).
  776.   
  777. Version 3.6:
  778. - fixed a bug in the mark stack growth code that was introduced
  779.   in 3.4.
  780. - fixed Makefile to work around DEC AXP compiler tail recursion
  781.   bug.
  782.  
  783. Version 3.7:
  784. - Added a workaround for an HP/UX compiler bug.
  785. - Fixed another stack clearing performance bug.  Reworked
  786.   that code once more.
  787.   
  788. Version 4.0:
  789. - Added support for Solaris threads (which was possible
  790.   only by reimplementing some fraction of Solaris threads,
  791.   since Sun doesn't currently make the thread debugging
  792.   interface available).
  793. - Added non-threads win32 and win32S support.
  794. - (Grudgingly, with suitable muttering of obscenities) renamed
  795.   files so that the collector distribution could live on a FAT
  796.   file system.  Files that are guaranteed to be useless on
  797.   a PC still have long names.  Gc_inline.h and gc_private.h
  798.   still exist, but now just include  gc_inl.h and gc_priv.h.
  799. - Fixed a really obscure bug in finalization that could cause
  800.   undetected mark stack overflows.  (I would be surprised if
  801.   any real code ever tickled this one.)
  802. - Changed finalization code to dynamically resize the hash
  803.   tables it maintains.  (This probably does not matter for well-
  804.   -written code.  It no doubt does for C++ code that overuses
  805.   destructors.)
  806. - Added typed allocation primitives.  Rewrote the marker to
  807.   accommodate them with more reasonable efficiency.  This
  808.   change should also speed up marking for GC_malloc allocated
  809.   objects a little.  See gc_typed.h for new primitives.
  810. - Improved debugging facilities slightly.  Allocation time
  811.   stack traces are now kept by default on SPARC/SUNOS4.
  812.   (Thanks to Scott Schwartz.)
  813. - Added better support for small heap applications.
  814. - Significantly extended cord package.  Fixed a bug in the
  815.   implementation of lazily read files.  Printf and friends now
  816.   have cord variants.  Cord traversals are a bit faster.
  817. - Made ALL_INTERIOR_POINTERS recognition the default.
  818. - Fixed de so that it can run in constant space, independent
  819.   of file size.  Added simple string searching to cords and de.
  820. - Added the Hull-Ellis C++ interface.
  821. - Added dynamic library support for OSF/1.
  822.   (Thanks to Al Dosser and Tim Bingham at DEC.)
  823. - Changed argument to GC_expand_hp to be expressed
  824.   in units of bytes instead of heap blocks.  (Necessary
  825.   since the heap block size now varies depending on
  826.   configuration.  The old version was never very clean.)
  827. - Added GC_get_heap_size().  The previous "equivalent"
  828.   was broken.
  829. - Restructured the Makefile a bit.  
  830.  
  831. Since version 4.0:
  832. - Changed finalization implementation to guarantee that
  833.   finalization procedures are called outside of the allocation
  834.   lock, making direct use of the interface a little less dangerous.
  835.   MAY BREAK EXISTING CLIENTS that assume finalizers
  836.   are protected by a lock.  Since there seem to be few multithreaded
  837.   clients that use finalization, this is hopefully not much of
  838.   a problem.
  839. - Fixed a gross bug in CORD_prev.
  840. - Fixed a bug in blacklst.c that could result in unbounded
  841.   heap growth during startup on machines that do not clear
  842.   memory obtained from the OS (e.g. win32S).
  843. - Ported de editor to win32/win32S.  (This is now the only
  844.   version with a mouse-sensitive UI.)
  845. - Added GC_malloc_ignore_off_page to allocate large arrays
  846.   in the presence of ALL_INTERIOR_POINTERS.
  847. - Changed GC_call_with_alloc_lock to not disable signals in
  848.   the single-threaded case.
  849. - Reduced retry count in GC_collect_or_expand for garbage
  850.   collecting when out of memory.
  851. - Made uncollectable allocations bypass black-listing, as they
  852.   should.
  853. - Fixed a bug in typed_test in test.c that could cause (legitimate)
  854.   GC crashes.
  855. - Fixed some potential synchronization problems in finalize.c
  856. - Fixed a real locking problem in typd_mlc.c.
  857. - Worked around an AIX 3.2 compiler feature that results in
  858.   out of bounds memory references.
  859. - Partially worked around an IRIX5.2 beta problem (which may
  860.   or may not persist to the final release).
  861. - Fixed a bug in the heap integrity checking code that could
  862.   result in explicitly deallocated objects being identified as
  863.   smashed.  Fixed a bug in the dbg_mlc stack saving code
  864.   that caused old argument pointers to be considered live.
  865. - Fixed a bug in CORD_ncmp (and hence CORD_str).
  866. - Repaired the OS2 port, which had suffered from bit rot
  867.   in 4.0.  Worked around what appears to be CSet/2 V1.0
  868.   optimizer bug.
  869. - Fixed a Makefile bug for target "c++".
  870.  
  871. Since version 4.1:
  872. - Multiple bug fixes/workarounds in the Solaris threads version.
  873.   (It occasionally failed to locate some register contents for
  874.   marking.  It also turns out that thr_suspend and friends are
  875.   unreliable in Solaris 2.3.  Dirty bit reads appear
  876.   to be unreliable under some weird 
  877.   circumstances.  My stack marking code
  878.   contained a serious performance bug.  The new code is
  879.   extremely defensive, and has not failed in several cpu
  880.   hours of testing.  But  no guarantees ...)
  881. - Added MacOS support (thanks to Patrick Beard.)
  882. - Fixed several syntactic bugs in gc_c++.h and friends.  (These
  883.   didn't bother g++, but did bother most other compilers.)
  884.   Fixed gc_c++.h finalization interface.  (It didn't.)
  885. - 64 bit alignment for allocated objects was not guaranteed in a
  886.   few cases in which it should have been.
  887. - Added GC_malloc_atomic_ignore_off_page.
  888. - Added GC_collect_a_little.
  889. - Added some prototypes to gc.h.
  890. - Some other minor bug fixes (notably in Makefile).
  891. - Fixed OS/2 / EMX port (thanks to Ari Huttunen).
  892. - Fixed AmigaDOS port. (thanks to Michel Schinz).
  893. - Fixed the DATASTART definition under Solaris.  There
  894.   was a 1 in 16K chance of the collector missing the first
  895.   64K of static data (and thus crashing).
  896. - Fixed some blatant anachronisms in the README file.
  897. - Fixed PCR-Makefile for upcoming PPCR release.
  898.  
  899. Since version 4.2:
  900. - Fixed SPARC alignment problem with GC_DEBUG.
  901. - Fixed Solaris threads /proc workaround.  The real
  902.   problem was an interaction with mprotect.
  903. - Incorporated fix from Patrick Beard for gc_c++.h.
  904. - Slightly improved allocator space utilization by
  905.   fixing the GC_size_map mechanism.
  906. - Integrated some Sony News and MIPS RISCos 4.51
  907.   patches.  (Thanks to Nobuyuki Hikichi of
  908.   Software Research Associates, Inc. Japan)
  909. - Fixed HP_PA alignment problem.  (Thanks to
  910.   xjam@cork.cs.berkeley.edu.)
  911. - Added GC_same_obj and friends.  Changed GC_base
  912.   to return 0 for pointers past the end of large objects.
  913.   Improved GC_base performance with ALL_INTERIOR_POINTERS
  914.   on machines with a slow integer mod operation.
  915.   Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare
  916.   for preprocessor.
  917. - changed the default on most UNIX machines to be that
  918.   signals are not disabled during critical GC operations.
  919.   This is still ANSI-conforming, though somewhat dangerous
  920.   in the presence of signal handlers. But the performance
  921.   cost of the alternative is sometimes problematic.
  922.   Can be changed back with a minor Makefile edit.
  923. - renamed IS_STRING in gc.h, to CORD_IS_STRING, thus
  924.   following my own naming convention.  Added the function
  925.   CORD_to_const_char_star.
  926. - Fixed a gross bug in GC_finalize.  Symptom: occasional
  927.   address faults in that function.  (Thanks to Anselm
  928.   Baird-Smith (Anselm.BairdSmith@inria.fr)
  929. - Added port to ICL DRS6000 running DRS/NX.  Restructured
  930.   things a bit to factor out common code, and remove obsolete
  931.   code.  Collector should now run under SUNOS5 with either
  932.   mprotect or /proc dirty bits.  (Thanks to Douglas Steel
  933.   (doug@wg.icl.co.uk)).
  934. - More bug fixes and workarounds for Solaris 2.X.  (These were
  935.   mostly related to putting the collector in a dynamic library,
  936.   which didn't really work before.  Also SOLARIS_THREADS
  937.   didn't interact well with dl_open.)  Thanks to btlewis@eng.sun.com.
  938. - Fixed a serious performance bug on the DEC Alpha.  The text
  939.   segment was getting registered as part of the root set.
  940.   (Amazingly, the result was still fast enough that the bug
  941.   was not conspicuous.) The fix works on OSF/1, version 1.3.
  942.   Hopefully it also works on other versions of OSF/1 ...
  943. - Fixed a bug in GC_clear_roots.
  944. - Fixed a bug in GC_generic_malloc_words_small that broke
  945.   gc_inl.h.  (Reported by Antoine de Maricourt.  I broke it
  946.   in trying to tweak the Mac port.) 
  947. - Fixed some problems with cord/de under Linux.
  948. - Fixed some cord problems, notably with CORD_riter4.
  949. - Added DG/UX port.
  950.   Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov)
  951. - Added finalization registration routines with weaker ordering
  952.   constraints.  (This is necessary for C++ finalization with
  953.   multiple inheritance, since the compiler often adds self-cycles.)
  954. - Filled the holes in the SCO port. (Thanks to Michael Arnoldus
  955.   <chime@proinf.dk>.)
  956. - John Ellis' additions to the C++ support:  From John:
  957.  
  958. * I completely rewrote the documentation in the interface gc_c++.h.
  959. I've tried to make it both clearer and more precise.
  960.  
  961. * The definition of accessibility now ignores pointers from an
  962. finalizable object (an object with a clean-up function) to itself.
  963. This allows objects with virtual base classes to be finalizable by the
  964. collector.  Compilers typically implement virtual base classes using
  965. pointers from an object to itself, which under the old definition of
  966. accessibility prevented objects with virtual base classes from ever
  967. being collected or finalized.
  968.  
  969. * gc_cleanup now includes gc as a virtual base.  This was enabled by
  970. the change in the definition of accessibility.
  971.  
  972. * I added support for operator new[].  Since most (all?) compilers
  973. don't yet support operator new[], it is conditionalized on
  974. -DOPERATOR_NEW_ARRAY.  The code is untested, but its trivial and looks
  975. correct.
  976.  
  977. * The test program test_gc_c++ tries to test for the C++-specific
  978. functionality not tested by the other programs.
  979. - Added <unistd.h> include to misc.c.  (Needed for ppcr.)
  980. - Added PowerMac port. (Thanks to Patrick Beard again.)
  981. - Fixed "srcdir"-related Makefile problems.  Changed things so
  982.   that all externally visible include files always appear in the
  983.   include subdirectory of the source.  Made gc.h directly
  984.   includable from C++ code.  (These were at Per
  985.   Bothner's suggestion.)
  986. - Changed Intel code to also mark from ebp (Kevin Warne's
  987.   suggestion).
  988. - Renamed C++ related files so they could live in a FAT
  989.   file system. (Charles Fiterman's suggestion.)
  990. - Changed Windoes NT Makefile to include C++ support in
  991.   gc.lib.  Added C++ test as Makefile target.
  992.