[BACK]Return to README CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc5.3

Annotation of OpenXM_contrib2/asir2000/gc5.3/README, Revision 1.1.1.1

1.1       noro        1: Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
                      2: Copyright (c) 1991-1996 by Xerox Corporation.  All rights reserved.
                      3: Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
                      4: Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
                      5:
                      6: THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
                      7: OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
                      8:
                      9: Permission is hereby granted to use or copy this program
                     10: for any purpose,  provided the above notices are retained on all copies.
                     11: Permission to modify the code and to distribute modified code is granted,
                     12: provided the above notices are retained, and a notice that the code was
                     13: modified is included with the above copyright notice.
                     14:
                     15: This is version 5.3 of a conservative garbage collector for C and C++.
                     16:
                     17: You might find a more recent version of this at
                     18:
                     19: http://www.hpl.hp.com/personal/Hans_Boehm/gc
                     20:
                     21: HISTORY -
                     22:
                     23:   Early versions of this collector were developed as a part of research
                     24: projects supported in part by the National Science Foundation
                     25: and the Defense Advance Research Projects Agency.
                     26: Much of the code was rewritten by Hans-J. Boehm (boehm@acm.org) at Xerox PARC,
                     27: SGI, and HP Labs.
                     28:
                     29: Some other contributors:
                     30:
                     31: More recent contributors are mentioned in the modification history at the
                     32: end of this file.  My apologies for any omissions.
                     33:
                     34: The SPARC specific code was contributed by Mark Weiser
                     35: (weiser@parc.xerox.com).  The Encore Multimax modifications were supplied by
                     36: Kevin Kenny (kenny@m.cs.uiuc.edu).  The adaptation to the RT is largely due
                     37: to Vernon Lee (scorpion@rice.edu), on machines made available by IBM.
                     38: Much of the HP specific code and a number of good suggestions for improving the
                     39: generic code are due to Walter Underwood (wunder@hp-ses.sde.hp.com).
                     40: Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code.
                     41: Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk)
                     42: subsequently provided updates and information on variation between ULTRIX
                     43: systems.  Parag Patel (parag@netcom.com) supplied the A/UX code.
                     44: Jesper Peterson(jep@mtiame.mtia.oz.au), Michel Schinz, and
                     45: Martin Tauchmann (martintauchmann@bigfoot.com) supplied the Amiga port.
                     46: Thomas Funke (thf@zelator.in-berlin.de(?)) and
                     47: Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports.
                     48: Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code.
                     49: Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader
                     50: specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and
                     51: Sony News specific code.  Al Dosser provided Alpha/OSF/1 code.  He and
                     52: Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes.
                     53: Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports.
                     54: Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port.
                     55: Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to
                     56: a Motorola 88K processor running CX/UX (Harris NightHawk).
                     57: Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to
                     58: nonIBM development environments (a nontrivial task).
                     59: Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port.
                     60: David Chase, then at Olivetti Research, suggested several improvements.
                     61: Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the
                     62: code to save and print call stacks for leak detection on a SPARC.
                     63: Jesse Hull and John Ellis supplied the C++ interface code.
                     64: Zhong Shao performed much of the experimentation that led to the
                     65: current typed allocation facility.  (His dynamic type inference code hasn't
                     66: made it into the released version of the collector, yet.)
                     67: (Blame for misinstallation of these modifications goes to the first author,
                     68: however.)
                     69:
                     70: OVERVIEW
                     71:
                     72:     This is intended to be a general purpose, garbage collecting storage
                     73: allocator.  The algorithms used are described in:
                     74:
                     75: Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
                     76: Software Practice & Experience, September 1988, pp. 807-820.
                     77:
                     78: Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
                     79: Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
                     80: and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
                     81:
                     82: Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
                     83: of the ACM SIGPLAN '91 Conference on Programming Language Design and
                     84: Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
                     85:
                     86:   Possible interactions between the collector and optimizing compilers are
                     87: discussed in
                     88:
                     89: Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
                     90: The Journal of C Language Translation 4, 2 (December 1992).
                     91:
                     92: and
                     93:
                     94: Boehm H., "Simple GC-safe Compilation", Proceedings
                     95: of the ACM SIGPLAN '96 Conference on Programming Language Design and
                     96: Implementation.
                     97:
                     98: (Both are also available from
                     99: http://reality.sgi.com/boehm/papers/, among other places.)
                    100:
                    101:   Unlike the collector described in the second reference, this collector
                    102: operates either with the mutator stopped during the entire collection
                    103: (default) or incrementally during allocations.  (The latter is supported
                    104: on only a few machines.)  It does not rely on threads, but is intended
                    105: to be thread-safe.
                    106:
                    107:   Some of the ideas underlying the collector have previously been explored
                    108: by others.  (Doug McIlroy wrote a vaguely similar collector that is part of
                    109: version 8 UNIX (tm).)  However none of this work appears to have been widely
                    110: disseminated.
                    111:
                    112:   Rudimentary tools for use of the collector as a leak detector are included, as
                    113: is a fairly sophisticated string package "cord" that makes use of the collector.
                    114: (See cord/README.)
                    115:
                    116:
                    117: GENERAL DESCRIPTION
                    118:
                    119:   This is a garbage collecting storage allocator that is intended to be
                    120: used as a plug-in replacement for C's malloc.
                    121:
                    122:   Since the collector does not require pointers to be tagged, it does not
                    123: attempt to ensure that all inaccessible storage is reclaimed.  However,
                    124: in our experience, it is typically more successful at reclaiming unused
                    125: memory than most C programs using explicit deallocation.  Unlike manually
                    126: introduced leaks, the amount of unreclaimed memory typically stays
                    127: bounded.
                    128:
                    129:   In the following, an "object" is defined to be a region of memory allocated
                    130: by the routines described below.
                    131:
                    132:   Any objects not intended to be collected must be pointed to either
                    133: from other such accessible objects, or from the registers,
                    134: stack, data, or statically allocated bss segments.  Pointers from
                    135: the stack or registers may point to anywhere inside an object.
                    136: The same is true for heap pointers if the collector is compiled with
                    137:  ALL_INTERIOR_POINTERS defined, as is now the default.
                    138:
                    139: Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
                    140: of garbage objects, by requiring pointers from the heap to to the beginning
                    141: of an object.  But this no longer appears to be a significant
                    142: issue for most programs.
                    143:
                    144: There are a number of routines which modify the pointer recognition
                    145: algorithm.  GC_register_displacement allows certain interior pointers
                    146: to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
                    147: GC_malloc_ignore_off_page allows some pointers into the middle of large objects
                    148: to be disregarded, greatly reducing the probablility of accidental
                    149: retention of large objects.  For most purposes it seems best to compile
                    150: with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
                    151: you get collector warnings from allocations of very large objects.
                    152: See README.debugging for details.
                    153:
                    154:   Note that pointers inside memory allocated by the standard "malloc" are not
                    155: seen by the garbage collector.  Thus objects pointed to only from such a
                    156: region may be prematurely deallocated.  It is thus suggested that the
                    157: standard "malloc" be used only for memory regions, such as I/O buffers, that
                    158: are guaranteed not to contain pointers to garbage collectable memory.
                    159: Pointers in C language automatic, static, or register variables,
                    160: are correctly recognized.  (Note that GC_malloc_uncollectable has semantics
                    161: similar to standard malloc, but allocates objects that are traced by the
                    162: collector.)
                    163:
                    164:   The collector does not always know how to find pointers in data
                    165: areas that are associated with dynamic libraries.  This is easy to
                    166: remedy IF you know how to find those data areas on your operating
                    167: system (see GC_add_roots).  Code for doing this under SunOS, IRIX 5.X and 6.X,
                    168: HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default.  (See
                    169: README.win32 for win32 details.)  On other systems pointers from dynamic
                    170: library data areas may not be considered by the collector.
                    171:
                    172:   Note that the garbage collector does not need to be informed of shared
                    173: read-only data.  However if the shared library mechanism can introduce
                    174: discontiguous data areas that may contain pointers, then the collector does
                    175: need to be informed.
                    176:
                    177:   Signal processing for most signals may be deferred during collection,
                    178: and during uninterruptible parts of the allocation process.  Unlike
                    179: standard ANSI C mallocs, it can be safe to invoke malloc
                    180: from a signal handler while another malloc is in progress, provided
                    181: the original malloc is not restarted.  (Empirically, many UNIX
                    182: applications already assume this.)  To obtain this level  of signal
                    183: safety, remove the definition of -DNO_SIGNALS in Makefile.  This incurs
                    184: a minor performance penalty, and hence is no longer the default.
                    185:
                    186:   The allocator/collector can also be configured for thread-safe operation.
                    187: (Full signal safety can also be achieved, but only at the cost of two system
                    188: calls per malloc, which is usually unacceptable.)
                    189:
                    190: INSTALLATION AND PORTABILITY
                    191:
                    192:   As distributed, the macro SILENT is defined in Makefile.
                    193: In the event of problems, this can be removed to obtain a moderate
                    194: amount of descriptive output for each collection.
                    195: (The given statistics exhibit a few peculiarities.
                    196: Things don't appear to add up for a variety of reasons, most notably
                    197: fragmentation losses.  These are probably much more significant for the
                    198: contrived program "test.c" than for your application.)
                    199:
                    200:   Note that typing "make test" will automatically build the collector
                    201: and then run setjmp_test and gctest. Setjmp_test will give you information
                    202: about configuring the collector, which is useful primarily if you have
                    203: a machine that's not already supported.  Gctest is a somewhat superficial
                    204: test of collector functionality.  Failure is indicated by a core dump or
                    205: a message to the effect that the collector is broken.  Gctest takes about
                    206: 35 seconds to run on a SPARCstation 2. On a slower machine,
                    207: expect it to take a while.  It may use up to 8 MB of memory.  (The
                    208: multi-threaded version will use more.)  "Make test" will also, as
                    209: its last step, attempt to build and test the "cord" string library.
                    210: This will fail without an ANSI C compiler.
                    211:
                    212:   The Makefile will generate a library gc.a which you should link against.
                    213: Typing "make cords" will add the cord library to gc.a.
                    214: Note that this requires an ANSI C compiler.
                    215:
                    216:   It is suggested that if you need to replace a piece of the collector
                    217: (e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
                    218:                work.)
                    219: ld command line, rather than replacing the one in gc.a.  (This will
                    220: generate numerous warnings under some versions of AIX, but it still
                    221: works.)
                    222:
                    223:   All include files that need to be used by clients will be put in the
                    224: include subdirectory.  (Normally this is just gc.h.  "Make cords" adds
                    225: "cord.h" and "ec.h".)
                    226:
                    227:   The collector currently is designed to run essentially unmodified on
                    228: machines that use a flat 32-bit or 64-bit address space.
                    229: That includes the vast majority of Workstations and X86 (X >= 3) PCs.
                    230: (The list here was deleted because it was getting too long and constantly
                    231: out of date.)
                    232:   It does NOT run under plain 16-bit DOS or Windows 3.X.  There are however
                    233: various packages (e.g. win32s, djgpp) that allow flat 32-bit address
                    234: applications to run under those systemsif the have at least an 80386 processor,
                    235: and several of those are compatible with the collector.
                    236:
                    237:   In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
                    238: or equivalent is supplied.  Many of these have separate README.system
                    239: files.
                    240:
                    241:   Dynamic libraries are completely supported only under SunOS
                    242: (and even that support is not functional on the last Sun 3 release),
                    243: IRIX 5&6, HP-PA, Win32 (not Win32S) and OSF/1 on DEC AXP machines.
                    244: On other machines we recommend that you do one of the following:
                    245:
                    246:   1) Add dynamic library support (and send us the code).
                    247:   2) Use static versions of the libraries.
                    248:   3) Arrange for dynamic libraries to use the standard malloc.
                    249:      This is still dangerous if the library stores a pointer to a
                    250:      garbage collected object.  But nearly all standard interfaces
                    251:      prohibit this, because they deal correctly with pointers
                    252:      to stack allocated objects.  (Strtok is an exception.  Don't
                    253:      use it.)
                    254:
                    255:   In all cases we assume that pointer alignment is consistent with that
                    256: enforced by the standard C compilers.  If you use a nonstandard compiler
                    257: you may have to adjust the alignment parameters defined in gc_priv.h.
                    258:
                    259:   A port to a machine that is not byte addressed, or does not use 32 bit
                    260: or 64 bit addresses will require a major effort.  A port to plain MSDOS
                    261: or win16 is hard.
                    262:
                    263:   For machines not already mentioned, or for nonstandard compilers, the
                    264: following are likely to require change:
                    265:
                    266: 1.  The parameters in gcconfig.h.
                    267:       The parameters that will usually require adjustment are
                    268:    STACKBOTTOM,  ALIGNMENT and DATASTART.  Setjmp_test
                    269:    prints its guesses of the first two.
                    270:       DATASTART should be an expression for computing the
                    271:    address of the beginning of the data segment.  This can often be
                    272:    &etext.  But some memory management units require that there be
                    273:    some unmapped space between the text and the data segment.  Thus
                    274:    it may be more complicated.   On UNIX systems, this is rarely
                    275:    documented.  But the adb "$m" command may be helpful.  (Note
                    276:    that DATASTART will usually be a function of &etext.  Thus a
                    277:    single experiment is usually insufficient.)
                    278:      STACKBOTTOM is used to initialize GC_stackbottom, which
                    279:    should be a sufficient approximation to the coldest stack address.
                    280:    On some machines, it is difficult to obtain such a value that is
                    281:    valid across a variety of MMUs, OS releases, etc.  A number of
                    282:    alternatives exist for using the collector in spite of this.  See the
                    283:    discussion in gcconfig.h immediately preceding the various
                    284:    definitions of STACKBOTTOM.
                    285:
                    286: 2.  mach_dep.c.
                    287:       The most important routine here is one to mark from registers.
                    288:     The distributed file includes a generic hack (based on setjmp) that
                    289:     happens to work on many machines, and may work on yours.  Try
                    290:     compiling and running setjmp_t.c to see whether it has a chance of
                    291:     working.  (This is not correct C, so don't blame your compiler if it
                    292:     doesn't work.  Based on limited experience, register window machines
                    293:     are likely to cause trouble.  If your version of setjmp claims that
                    294:     all accessible variables, including registers, have the value they
                    295:     had at the time of the longjmp, it also will not work.  Vanilla 4.2 BSD
                    296:     on Vaxen makes such a claim.  SunOS does not.)
                    297:       If your compiler does not allow in-line assembly code, or if you prefer
                    298:     not to use such a facility, mach_dep.c may be replaced by a .s file
                    299:     (as we did for the MIPS machine and the PC/RT).
                    300:       At this point enough architectures are supported by mach_dep.c
                    301:     that you will rarely need to do more than adjust for assembler
                    302:     syntax.
                    303:
                    304: 3.  os_dep.c (and gc_priv.h).
                    305:          Several kinds of operating system dependent routines reside here.
                    306:        Many are optional.  Several are invoked only through corresponding
                    307:        macros in gc_priv.h, which may also be redefined as appropriate.
                    308:       The routine GC_register_data_segments is crucial.  It registers static
                    309:     data areas that must be traversed by the collector. (User calls to
                    310:     GC_add_roots may sometimes be used for similar effect.)
                    311:       Routines to obtain memory from the OS also reside here.
                    312:     Alternatively this can be done entirely by the macro GET_MEM
                    313:     defined in gc_priv.h.  Routines to disable and reenable signals
                    314:     also reside here if they are need by the macros DISABLE_SIGNALS
                    315:     and ENABLE_SIGNALS defined in gc_priv.h.
                    316:       In a multithreaded environment, the macros LOCK and UNLOCK
                    317:     in gc_priv.h will need to be suitably redefined.
                    318:       The incremental collector requires page dirty information, which
                    319:     is acquired through routines defined in os_dep.c.  Unless directed
                    320:     otherwise by gcconfig.h, these are implemented as stubs that simply
                    321:     treat all pages as dirty.  (This of course makes the incremental
                    322:     collector much less useful.)
                    323:
                    324: 4.  dyn_load.c
                    325:        This provides a routine that allows the collector to scan data
                    326:        segments associated with dynamic libraries.  Often it is not
                    327:        necessary to provide this routine unless user-written dynamic
                    328:        libraries are used.
                    329:
                    330:   For a different version of UN*X or different machines using the
                    331: Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
                    332: it should frequently suffice to change definitions in gcconfig.h.
                    333:
                    334:
                    335: THE C INTERFACE TO THE ALLOCATOR
                    336:
                    337:   The following routines are intended to be directly called by the user.
                    338: Note that usually only GC_malloc is necessary.  GC_clear_roots and GC_add_roots
                    339: calls may be required if the collector has to trace from nonstandard places
                    340: (e.g. from dynamic library data areas on a machine on which the
                    341: collector doesn't already understand them.)  On some machines, it may
                    342: be desirable to set GC_stacktop to a good approximation of the stack base.
                    343: (This enhances code portability on HP PA machines, since there is no
                    344: good way for the collector to compute this value.)  Client code may include
                    345: "gc.h", which defines all of the following, plus many others.
                    346:
                    347: 1)  GC_malloc(nbytes)
                    348:     - allocate an object of size nbytes.  Unlike malloc, the object is
                    349:       cleared before being returned to the user.  Gc_malloc will
                    350:       invoke the garbage collector when it determines this to be appropriate.
                    351:       GC_malloc may return 0 if it is unable to acquire sufficient
                    352:       space from the operating system.  This is the most probable
                    353:       consequence of running out of space.  Other possible consequences
                    354:       are that a function call will fail due to lack of stack space,
                    355:       or that the collector will fail in other ways because it cannot
                    356:       maintain its internal data structures, or that a crucial system
                    357:       process will fail and take down the machine.  Most of these
                    358:       possibilities are independent of the malloc implementation.
                    359:
                    360: 2)  GC_malloc_atomic(nbytes)
                    361:     - allocate an object of size nbytes that is guaranteed not to contain any
                    362:       pointers.  The returned object is not guaranteed to be cleared.
                    363:       (Can always be replaced by GC_malloc, but results in faster collection
                    364:       times.  The collector will probably run faster if large character
                    365:       arrays, etc. are allocated with GC_malloc_atomic than if they are
                    366:       statically allocated.)
                    367:
                    368: 3)  GC_realloc(object, new_size)
                    369:     - change the size of object to be new_size.  Returns a pointer to the
                    370:       new object, which may, or may not, be the same as the pointer to
                    371:       the old object.  The new object is taken to be atomic iff the old one
                    372:       was.  If the new object is composite and larger than the original object,
                    373:       then the newly added bytes are cleared (we hope).  This is very likely
                    374:       to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
                    375:       Even then, it is likely to recycle the old object only if the object
                    376:       is grown in small additive increments (which, we claim, is generally bad
                    377:       coding practice.)
                    378:
                    379: 4)  GC_free(object)
                    380:     - explicitly deallocate an object returned by GC_malloc or
                    381:       GC_malloc_atomic.  Not necessary, but can be used to minimize
                    382:       collections if performance is critical.  Probably a performance
                    383:       loss for very small objects (<= 8 bytes).
                    384:
                    385: 5)  GC_expand_hp(bytes)
                    386:     - Explicitly increase the heap size.  (This is normally done automatically
                    387:       if a garbage collection failed to GC_reclaim enough memory.  Explicit
                    388:       calls to GC_expand_hp may prevent unnecessarily frequent collections at
                    389:       program startup.)
                    390:
                    391: 6)  GC_malloc_ignore_off_page(bytes)
                    392:        - identical to GC_malloc, but the client promises to keep a pointer to
                    393:          the somewhere within the first 256 bytes of the object while it is
                    394:          live.  (This pointer should nortmally be declared volatile to prevent
                    395:          interference from compiler optimizations.)  This is the recommended
                    396:          way to allocate anything that is likely to be larger than 100Kbytes
                    397:          or so.  (GC_malloc may result in failure to reclaim such objects.)
                    398:
                    399: 7)  GC_set_warn_proc(proc)
                    400:        - Can be used to redirect warnings from the collector.  Such warnings
                    401:          should be rare, and should not be ignored during code development.
                    402:
                    403: 8) GC_enable_incremental()
                    404:     - Enables generational and incremental collection.  Useful for large
                    405:       heaps on machines that provide access to page dirty information.
                    406:       Some dirty bit implementations may interfere with debugging
                    407:       (by catching address faults) and place restrictions on heap arguments
                    408:       to system calls (since write faults inside a system call may not be
                    409:       handled well).
                    410:
                    411: 9) Several routines to allow for registration of finalization code.
                    412:    User supplied finalization code may be invoked when an object becomes
                    413:    unreachable.  To call (*f)(obj, x) when obj becomes inaccessible, use
                    414:        GC_register_finalizer(obj, f, x, 0, 0);
                    415:    For more sophisticated uses, and for finalization ordering issues,
                    416:    see gc.h.
                    417:
                    418:   The global variable GC_free_space_divisor may be adjusted up from its
                    419: default value of 4 to use less space and more collection time, or down for
                    420: the opposite effect.  Setting it to 1 or 0 will effectively disable collections
                    421: and cause all allocations to simply grow the heap.
                    422:
                    423:   The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
                    424: the amount of memory allocated by the above routines that should not be
                    425: considered as a candidate for collection.  Careless use may, of course, result
                    426: in excessive memory consumption.
                    427:
                    428:   Some additional tuning is possible through the parameters defined
                    429: near the top of gc_priv.h.
                    430:
                    431:   If only GC_malloc is intended to be used, it might be appropriate to define:
                    432:
                    433: #define malloc(n) GC_malloc(n)
                    434: #define calloc(m,n) GC_malloc((m)*(n))
                    435:
                    436:   For small pieces of VERY allocation intensive code, gc_inl.h
                    437: includes some allocation macros that may be used in place of GC_malloc
                    438: and friends.
                    439:
                    440:   All externally visible names in the garbage collector start with "GC_".
                    441: To avoid name conflicts, client code should avoid this prefix, except when
                    442: accessing garbage collector routines or variables.
                    443:
                    444:   There are provisions for allocation with explicit type information.
                    445: This is rarely necessary.  Details can be found in gc_typed.h.
                    446:
                    447: THE C++ INTERFACE TO THE ALLOCATOR:
                    448:
                    449:   The Ellis-Hull C++ interface to the collector is included in
                    450: the collector distribution.  If you intend to use this, type
                    451: "make c++" after the initial build of the collector is complete.
                    452: See gc_cpp.h for the definition of the interface.  This interface
                    453: tries to approximate the Ellis-Detlefs C++ garbage collection
                    454: proposal without compiler changes.
                    455:
                    456: Cautions:
                    457: 1. Arrays allocated without new placement syntax are
                    458: allocated as uncollectable objects.  They are traced by the
                    459: collector, but will not be reclaimed.
                    460:
                    461: 2. Failure to use "make c++" in combination with (1) will
                    462: result in arrays allocated using the default new operator.
                    463: This is likely to result in disaster without linker warnings.
                    464:
                    465: 3. If your compiler supports an overloaded new[] operator,
                    466: then gc_cpp.cc and gc_cpp.h should be suitably modified.
                    467:
                    468: 4. Many current C++ compilers have deficiencies that
                    469: break some of the functionality.  See the comments in gc_cpp.h
                    470: for suggested workarounds.
                    471:
                    472: USE AS LEAK DETECTOR:
                    473:
                    474:   The collector may be used to track down leaks in C programs that are
                    475: intended to run with malloc/free (e.g. code with extreme real-time or
                    476: portability constraints).  To do so define FIND_LEAK in Makefile
                    477: This will cause the collector to invoke the report_leak
                    478: routine defined near the top of reclaim.c whenever an inaccessible
                    479: object is found that has not been explicitly freed.  Such objects will
                    480: also be automatically reclaimed.
                    481:   Productive use of this facility normally involves redefining report_leak
                    482: to do something more intelligent.  This typically requires annotating
                    483: objects with additional information (e.g. creation time stack trace) that
                    484: identifies their origin.  Such code is typically not very portable, and is
                    485: not included here, except on SPARC machines.
                    486:   If all objects are allocated with GC_DEBUG_MALLOC (see next section),
                    487: then the default version of report_leak will report the source file
                    488: and line number at which the leaked object was allocated.  This may
                    489: sometimes be sufficient.  (On SPARC/SUNOS4 machines, it will also report
                    490: a cryptic stack trace.  This can often be turned into a sympolic stack
                    491: trace by invoking program "foo" with "callprocs foo".  Callprocs is
                    492: a short shell script that invokes adb to expand program counter values
                    493: to symbolic addresses.  It was largely supplied by Scott Schwartz.)
                    494:   Note that the debugging facilities described in the next section can
                    495: sometimes be slightly LESS effective in leak finding mode, since in
                    496: leak finding mode, GC_debug_free actually results in reuse of the object.
                    497: (Otherwise the object is simply marked invalid.)  Also note that the test
                    498: program is not designed to run meaningfully in FIND_LEAK mode.
                    499: Use "make gc.a" to build the collector.
                    500:
                    501: DEBUGGING FACILITIES:
                    502:
                    503:   The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
                    504: and GC_debug_free provide an alternate interface to the collector, which
                    505: provides some help with memory overwrite errors, and the like.
                    506: Objects allocated in this way are annotated with additional
                    507: information.  Some of this information is checked during garbage
                    508: collections, and detected inconsistencies are reported to stderr.
                    509:
                    510:   Simple cases of writing past the end of an allocated object should
                    511: be caught if the object is explicitly deallocated, or if the
                    512: collector is invoked while the object is live.  The first deallocation
                    513: of an object will clear the debugging info associated with an
                    514: object, so accidentally repeated calls to GC_debug_free will report the
                    515: deallocation of an object without debugging information.  Out of
                    516: memory errors will be reported to stderr, in addition to returning
                    517: NIL.
                    518:
                    519:   GC_debug_malloc checking  during garbage collection is enabled
                    520: with the first call to GC_debug_malloc.  This will result in some
                    521: slowdown during collections.  If frequent heap checks are desired,
                    522: this can be achieved by explicitly invoking GC_gcollect, e.g. from
                    523: the debugger.
                    524:
                    525:   GC_debug_malloc allocated objects should not be passed to GC_realloc
                    526: or GC_free, and conversely.  It is however acceptable to allocate only
                    527: some objects with GC_debug_malloc, and to use GC_malloc for other objects,
                    528: provided the two pools are kept distinct.  In this case, there is a very
                    529: low probablility that GC_malloc allocated objects may be misidentified as
                    530: having been overwritten.  This should happen with probability at most
                    531: one in 2**32.  This probability is zero if GC_debug_malloc is never called.
                    532:
                    533:   GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
                    534: additional trailing arguments, a string and an integer.  These are not
                    535: interpreted by the allocator.  They are stored in the object (the string is
                    536: not copied).  If an error involving the object is detected, they are printed.
                    537:
                    538:   The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
                    539: GC_REGISTER_FINALIZER are also provided.  These require the same arguments
                    540: as the corresponding (nondebugging) routines.  If gc.h is included
                    541: with GC_DEBUG defined, they call the debugging versions of these
                    542: functions, passing the current file name and line number as the two
                    543: extra arguments, where appropriate.  If gc.h is included without GC_DEBUG
                    544: defined, then all these macros will instead be defined to their nondebugging
                    545: equivalents.  (GC_REGISTER_FINALIZER is necessary, since pointers to
                    546: objects with debugging information are really pointers to a displacement
                    547: of 16 bytes form the object beginning, and some translation is necessary
                    548: when finalization routines are invoked.  For details, about what's stored
                    549: in the header, see the definition of the type oh in debug_malloc.c)
                    550:
                    551: INCREMENTAL/GENERATIONAL COLLECTION:
                    552:
                    553: The collector normally interrupts client code for the duration of
                    554: a garbage collection mark phase.  This may be unacceptable if interactive
                    555: response is needed for programs with large heaps.  The collector
                    556: can also run in a "generational" mode, in which it usually attempts to
                    557: collect only objects allocated since the last garbage collection.
                    558: Furthermore, in this mode, garbage collections run mostly incrementally,
                    559: with a small amount of work performed in response to each of a large number of
                    560: GC_malloc requests.
                    561:
                    562: This mode is enabled by a call to GC_enable_incremental().
                    563:
                    564: Incremental and generational collection is effective in reducing
                    565: pause times only if the collector has some way to tell which objects
                    566: or pages have been recently modified.  The collector uses two sources
                    567: of information:
                    568:
                    569: 1. Information provided by the VM system.  This may be provided in
                    570: one of several forms.  Under Solaris 2.X (and potentially under other
                    571: similar systems) information on dirty pages can be read from the
                    572: /proc file system.  Under other systems (currently SunOS4.X) it is
                    573: possible to write-protect the heap, and catch the resulting faults.
                    574: On these systems we require that system calls writing to the heap
                    575: (other than read) be handled specially by client code.
                    576: See os_dep.c for details.
                    577:
                    578: 2. Information supplied by the programmer.  We define "stubborn"
                    579: objects to be objects that are rarely changed.  Such an object
                    580: can be allocated (and enabled for writing) with GC_malloc_stubborn.
                    581: Once it has been initialized, the collector should be informed with
                    582: a call to GC_end_stubborn_change.  Subsequent writes that store
                    583: pointers into the object must be preceded by a call to
                    584: GC_change_stubborn.
                    585:
                    586: This mechanism performs best for objects that are written only for
                    587: initialization, and such that only one stubborn object is writable
                    588: at once.  It is typically not worth using for short-lived
                    589: objects.  Stubborn objects are treated less efficiently than pointerfree
                    590: (atomic) objects.
                    591:
                    592: A rough rule of thumb is that, in the absence of VM information, garbage
                    593: collection pauses are proportional to the amount of pointerful storage
                    594: plus the amount of modified "stubborn" storage that is reachable during
                    595: the collection.
                    596:
                    597: Initial allocation of stubborn objects takes longer than allocation
                    598: of other objects, since other data structures need to be maintained.
                    599:
                    600: We recommend against random use of stubborn objects in client
                    601: code, since bugs caused by inappropriate writes to stubborn objects
                    602: are likely to be very infrequently observed and hard to trace.
                    603: However, their use may be appropriate in a few carefully written
                    604: library routines that do not make the objects themselves available
                    605: for writing by client code.
                    606:
                    607:
                    608: BUGS:
                    609:
                    610:   Any memory that does not have a recognizable pointer to it will be
                    611: reclaimed.  Exclusive-or'ing forward and backward links in a list
                    612: doesn't cut it.
                    613:   Some C optimizers may lose the last undisguised pointer to a memory
                    614: object as a consequence of clever optimizations.  This has almost
                    615: never been observed in practice.  Send mail to boehm@acm.org
                    616: for suggestions on how to fix your compiler.
                    617:   This is not a real-time collector.  In the standard configuration,
                    618: percentage of time required for collection should be constant across
                    619: heap sizes.  But collection pauses will increase for larger heaps.
                    620: (On SPARCstation 2s collection times will be on the order of 300 msecs
                    621: per MB of accessible memory that needs to be scanned.  Your mileage
                    622: may vary.)  The incremental/generational collection facility helps,
                    623: but is portable only if "stubborn" allocation is used.
                    624:   Please address bug reports to boehm@acm.org.  If you are
                    625: contemplating a major addition, you might also send mail to ask whether
                    626: it's already been done (or whether we tried and discarded it).
                    627:
                    628: RECENT VERSIONS:
                    629:
                    630:   Version 1.3 and immediately preceding versions contained spurious
                    631: assembly language assignments to TMP_SP.  Only the assignment in the PC/RT
                    632: code is necessary.  On other machines, with certain compiler options,
                    633: the assignments can lead to an unsaved register being overwritten.
                    634: Known to cause problems under SunOS 3.5 WITHOUT the -O option.  (With
                    635: -O the compiler recognizes it as dead code.  It probably shouldn't,
                    636: but that's another story.)
                    637:
                    638:   Version 1.4 and earlier versions used compile time determined values
                    639: for the stack base.  This no longer works on Sun 3s, since Sun 3/80s use
                    640: a different stack base.  We now use a straightforward heuristic on all
                    641: machines on which it is known to work (incl. Sun 3s) and compile-time
                    642: determined values for the rest.  There should really be library calls
                    643: to determine such values.
                    644:
                    645:   Version 1.5 and earlier did not ensure 8 byte alignment for objects
                    646: allocated on a sparc based machine.
                    647:
                    648:   Version 1.8 added ULTRIX support in gc_private.h.
                    649:
                    650:   Version 1.9 fixed a major bug in gc_realloc.
                    651:
                    652:   Version 2.0 introduced a consistent naming convention for collector
                    653: routines and added support for registering dynamic library data segments
                    654: in the standard mark_roots.c.  Most of the data structures were revamped.
                    655: The treatment of interior pointers was completely changed.  Finalization
                    656: was added.  Support for locking was added.  Object kinds were added.
                    657: We added a black listing facility to avoid allocating at addresses known
                    658: to occur as integers somewhere in the address space.  Much of this
                    659: was accomplished by adapting ideas and code from the PCR collector.
                    660: The test program was changed and expanded.
                    661:
                    662:   Version 2.1 was the first stable version since 1.9, and added support
                    663: for PPCR.
                    664:
                    665:   Version 2.2 added debugging allocation, and fixed various bugs.  Among them:
                    666: - GC_realloc could fail to extend the size of the object for certain large object sizes.
                    667: - A blatant subscript range error in GC_printf, which unfortunately
                    668:   wasn't exercised on machines with sufficient stack alignment constraints.
                    669: - GC_register_displacement did the wrong thing if it was called after
                    670:   any allocation had taken place.
                    671: - The leak finding code would eventually break after 2048 byte
                    672:   byte objects leaked.
                    673: - interface.c didn't compile.
                    674: - The heap size remained much too small for large stacks.
                    675: - The stack clearing code behaved badly for large stacks, and perhaps
                    676:   on HP/PA machines.
                    677:
                    678:   Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs:
                    679: - Missing declaration of etext in the A/UX version.
                    680: - Some PCR root-finding problems.
                    681: - Blacklisting was not 100% effective, because the plausible future
                    682:   heap bounds were being miscalculated.
                    683: - GC_realloc didn't handle out-of-memory correctly.
                    684: - GC_base could return a nonzero value for addresses inside free blocks.
                    685: - test.c wasn't really thread safe, and could erroneously report failure
                    686:   in a multithreaded environment.  (The locking primitives need to be
                    687:   replaced for other threads packages.)
                    688: - GC_CONS was thoroughly broken.
                    689: - On a SPARC with dynamic linking, signals stayed diabled while the
                    690:   client code was running.
                    691:   (Thanks to Manuel Serrano at INRIA for reporting the last two.)
                    692:
                    693:   Version 2.4 added GC_free_space_divisor as a tuning knob, added
                    694:   support for OS/2 and linux, and fixed the following bugs:
                    695: - On machines with unaligned pointers (e.g. Sun 3), every 128th word could
                    696:   fail to be considered for marking.
                    697: - Dynamic_load.c erroneously added 4 bytes to the length of the data and
                    698:   bss sections of the dynamic library.  This could result in a bad memory
                    699:   reference if the actual length was a multiple of a page.  (Observed on
                    700:   Sun 3.  Can probably also happen on a Sun 4.)
                    701:   (Thanks to Robert Brazile for pointing out that the Sun 3 version
                    702:   was broken.  Dynamic library handling is still broken on Sun 3s
                    703:   under 4.1.1U1, but apparently not 4.1.1.  If you have such a machine,
                    704:   use -Bstatic.)
                    705:
                    706:   Version 2.5 fixed the following bugs:
                    707: - Removed an explicit call to exit(1)
                    708: - Fixed calls to GC_printf and GC_err_printf, so the correct number of
                    709:   arguments are always supplied.  The OS/2 C compiler gets confused if
                    710:   the number of actuals and the number of formals differ.  (ANSI C
                    711:   doesn't require this to work.  The ANSI sanctioned way of doing things
                    712:   causes too many compatibility problems.)
                    713:
                    714:   Version 3.0  added generational/incremental collection and stubborn
                    715:   objects.
                    716:
                    717:   Version 3.1 added the following features:
                    718: - A workaround for a SunOS 4.X SPARC C compiler
                    719:   misfeature that caused problems when the collector was turned into
                    720:   a dynamic library.
                    721: - A fix for a bug in GC_base that could result in a memory fault.
                    722: - A fix for a performance bug (and several other misfeatures) pointed
                    723:   out by Dave Detlefs and Al Dosser.
                    724: - Use of dirty bit information for static data under Solaris 2.X.
                    725: - DEC Alpha/OSF1 support (thanks to Al Dosser).
                    726: - Incremental collection on more platforms.
                    727: - A more refined heap expansion policy.  Less space usage by default.
                    728: - Various minor enhancements to reduce space usage, and to reduce
                    729:   the amount of memory scanned by the collector.
                    730: - Uncollectable allocation without per object overhead.
                    731: - More conscientious handling of out-of-memory conditions.
                    732: - Fixed a bug in debugging stubborn allocation.
                    733: - Fixed a bug that resulted in occasional erroneous reporting of smashed
                    734:   objects with debugging allocation.
                    735: - Fixed bogus leak reports of size 4096 blocks with FIND_LEAK.
                    736:
                    737:   Version 3.2 fixed a serious and not entirely repeatable bug in
                    738:   the incremental collector.  It appeared only when dirty bit info
                    739:   on the roots was available, which is normally only under Solaris.
                    740:   It also added GC_general_register_disappearing_link, and some
                    741:   testing code.  Interface.c disappeared.
                    742:
                    743:   Version 3.3 fixes several bugs and adds new ports:
                    744: - PCR-specific bugs.
                    745: - Missing locking in GC_free, redundant FASTUNLOCK
                    746:   in GC_malloc_stubborn, and 2 bugs in
                    747:   GC_unregister_disappearing_link.
                    748:   All of the above were pointed out by Neil Sharman
                    749:   (neil@cs.mu.oz.au).
                    750: - Common symbols allocated by the SunOS4.X dynamic loader
                    751:   were not included in the root set.
                    752: - Bug in GC_finalize (reported by Brian Beuning and Al Dosser)
                    753: - Merged Amiga port from Jesper Peterson (untested)
                    754: - Merged NeXT port from Thomas Funke (significantly
                    755:   modified and untested)
                    756:
                    757:   Version 3.4:
                    758: - Fixed a performance bug in GC_realloc.
                    759: - Updated the amiga port.
                    760: - Added NetBSD and 386BSD ports.
                    761: - Added cord library.
                    762: - Added trivial performance enhancement for
                    763:   ALL_INTERIOR_POINTERS.  (Don't scan last word.)
                    764:
                    765:   Version 3.5
                    766: - Minor collections now mark from roots only once, if that
                    767:   doesn't cause an excessive pause.
                    768: - The stack clearing heuristic was refined to prevent anomalies
                    769:   with very heavily recursive programs and sparse stacks.
                    770: - Fixed a bug that prevented mark stack growth in some cases.
                    771:   GC_objects_are_marked should be set to TRUE after a call
                    772:   to GC_push_roots and as part of GC_push_marked, since
                    773:   both can now set mark bits.  I think this is only a performance
                    774:   bug, but I wouldn't bet on it.  It's certainly very hard to argue
                    775:   that the old version was correct.
                    776: - Fixed an incremental collection bug that prevented it from
                    777:   working at all when HBLKSIZE != getpagesize()
                    778: - Changed dynamic_loading.c to include gc_priv.h before testing
                    779:   DYNAMIC_LOADING.  SunOS dynamic library scanning
                    780:   must have been broken in 3.4.
                    781: - Object size rounding now adapts to program behavior.
                    782: - Added a workaround (provided by Manuel Serrano and
                    783:   colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug
                    784:   that I had incorrectly assumed to have been squished.
                    785:   The collector was broken if the text segment size was within
                    786:   32 bytes of a multiple of 8K bytes, and if the beginning of
                    787:   the data segment contained interesting roots.  The workaround
                    788:   assumes a demand-loadable executable.  The original may have
                    789:   have "worked" in some other cases.
                    790: - Added dynamic library support under IRIX5.
                    791: - Added support for EMX under OS/2 (thanks to Ari Huttunen).
                    792:
                    793: Version 3.6:
                    794: - fixed a bug in the mark stack growth code that was introduced
                    795:   in 3.4.
                    796: - fixed Makefile to work around DEC AXP compiler tail recursion
                    797:   bug.
                    798:
                    799: Version 3.7:
                    800: - Added a workaround for an HP/UX compiler bug.
                    801: - Fixed another stack clearing performance bug.  Reworked
                    802:   that code once more.
                    803:
                    804: Version 4.0:
                    805: - Added support for Solaris threads (which was possible
                    806:   only by reimplementing some fraction of Solaris threads,
                    807:   since Sun doesn't currently make the thread debugging
                    808:   interface available).
                    809: - Added non-threads win32 and win32S support.
                    810: - (Grudgingly, with suitable muttering of obscenities) renamed
                    811:   files so that the collector distribution could live on a FAT
                    812:   file system.  Files that are guaranteed to be useless on
                    813:   a PC still have long names.  Gc_inline.h and gc_private.h
                    814:   still exist, but now just include  gc_inl.h and gc_priv.h.
                    815: - Fixed a really obscure bug in finalization that could cause
                    816:   undetected mark stack overflows.  (I would be surprised if
                    817:   any real code ever tickled this one.)
                    818: - Changed finalization code to dynamically resize the hash
                    819:   tables it maintains.  (This probably does not matter for well-
                    820:   -written code.  It no doubt does for C++ code that overuses
                    821:   destructors.)
                    822: - Added typed allocation primitives.  Rewrote the marker to
                    823:   accommodate them with more reasonable efficiency.  This
                    824:   change should also speed up marking for GC_malloc allocated
                    825:   objects a little.  See gc_typed.h for new primitives.
                    826: - Improved debugging facilities slightly.  Allocation time
                    827:   stack traces are now kept by default on SPARC/SUNOS4.
                    828:   (Thanks to Scott Schwartz.)
                    829: - Added better support for small heap applications.
                    830: - Significantly extended cord package.  Fixed a bug in the
                    831:   implementation of lazily read files.  Printf and friends now
                    832:   have cord variants.  Cord traversals are a bit faster.
                    833: - Made ALL_INTERIOR_POINTERS recognition the default.
                    834: - Fixed de so that it can run in constant space, independent
                    835:   of file size.  Added simple string searching to cords and de.
                    836: - Added the Hull-Ellis C++ interface.
                    837: - Added dynamic library support for OSF/1.
                    838:   (Thanks to Al Dosser and Tim Bingham at DEC.)
                    839: - Changed argument to GC_expand_hp to be expressed
                    840:   in units of bytes instead of heap blocks.  (Necessary
                    841:   since the heap block size now varies depending on
                    842:   configuration.  The old version was never very clean.)
                    843: - Added GC_get_heap_size().  The previous "equivalent"
                    844:   was broken.
                    845: - Restructured the Makefile a bit.
                    846:
                    847: Since version 4.0:
                    848: - Changed finalization implementation to guarantee that
                    849:   finalization procedures are called outside of the allocation
                    850:   lock, making direct use of the interface a little less dangerous.
                    851:   MAY BREAK EXISTING CLIENTS that assume finalizers
                    852:   are protected by a lock.  Since there seem to be few multithreaded
                    853:   clients that use finalization, this is hopefully not much of
                    854:   a problem.
                    855: - Fixed a gross bug in CORD_prev.
                    856: - Fixed a bug in blacklst.c that could result in unbounded
                    857:   heap growth during startup on machines that do not clear
                    858:   memory obtained from the OS (e.g. win32S).
                    859: - Ported de editor to win32/win32S.  (This is now the only
                    860:   version with a mouse-sensitive UI.)
                    861: - Added GC_malloc_ignore_off_page to allocate large arrays
                    862:   in the presence of ALL_INTERIOR_POINTERS.
                    863: - Changed GC_call_with_alloc_lock to not disable signals in
                    864:   the single-threaded case.
                    865: - Reduced retry count in GC_collect_or_expand for garbage
                    866:   collecting when out of memory.
                    867: - Made uncollectable allocations bypass black-listing, as they
                    868:   should.
                    869: - Fixed a bug in typed_test in test.c that could cause (legitimate)
                    870:   GC crashes.
                    871: - Fixed some potential synchronization problems in finalize.c
                    872: - Fixed a real locking problem in typd_mlc.c.
                    873: - Worked around an AIX 3.2 compiler feature that results in
                    874:   out of bounds memory references.
                    875: - Partially worked around an IRIX5.2 beta problem (which may
                    876:   or may not persist to the final release).
                    877: - Fixed a bug in the heap integrity checking code that could
                    878:   result in explicitly deallocated objects being identified as
                    879:   smashed.  Fixed a bug in the dbg_mlc stack saving code
                    880:   that caused old argument pointers to be considered live.
                    881: - Fixed a bug in CORD_ncmp (and hence CORD_str).
                    882: - Repaired the OS2 port, which had suffered from bit rot
                    883:   in 4.0.  Worked around what appears to be CSet/2 V1.0
                    884:   optimizer bug.
                    885: - Fixed a Makefile bug for target "c++".
                    886:
                    887: Since version 4.1:
                    888: - Multiple bug fixes/workarounds in the Solaris threads version.
                    889:   (It occasionally failed to locate some register contents for
                    890:   marking.  It also turns out that thr_suspend and friends are
                    891:   unreliable in Solaris 2.3.  Dirty bit reads appear
                    892:   to be unreliable under some weird
                    893:   circumstances.  My stack marking code
                    894:   contained a serious performance bug.  The new code is
                    895:   extremely defensive, and has not failed in several cpu
                    896:   hours of testing.  But  no guarantees ...)
                    897: - Added MacOS support (thanks to Patrick Beard.)
                    898: - Fixed several syntactic bugs in gc_c++.h and friends.  (These
                    899:   didn't bother g++, but did bother most other compilers.)
                    900:   Fixed gc_c++.h finalization interface.  (It didn't.)
                    901: - 64 bit alignment for allocated objects was not guaranteed in a
                    902:   few cases in which it should have been.
                    903: - Added GC_malloc_atomic_ignore_off_page.
                    904: - Added GC_collect_a_little.
                    905: - Added some prototypes to gc.h.
                    906: - Some other minor bug fixes (notably in Makefile).
                    907: - Fixed OS/2 / EMX port (thanks to Ari Huttunen).
                    908: - Fixed AmigaDOS port. (thanks to Michel Schinz).
                    909: - Fixed the DATASTART definition under Solaris.  There
                    910:   was a 1 in 16K chance of the collector missing the first
                    911:   64K of static data (and thus crashing).
                    912: - Fixed some blatant anachronisms in the README file.
                    913: - Fixed PCR-Makefile for upcoming PPCR release.
                    914:
                    915: Since version 4.2:
                    916: - Fixed SPARC alignment problem with GC_DEBUG.
                    917: - Fixed Solaris threads /proc workaround.  The real
                    918:   problem was an interaction with mprotect.
                    919: - Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h).
                    920: - Slightly improved allocator space utilization by
                    921:   fixing the GC_size_map mechanism.
                    922: - Integrated some Sony News and MIPS RISCos 4.51
                    923:   patches.  (Thanks to Nobuyuki Hikichi of
                    924:   Software Research Associates, Inc. Japan)
                    925: - Fixed HP_PA alignment problem.  (Thanks to
                    926:   xjam@cork.cs.berkeley.edu.)
                    927: - Added GC_same_obj and friends.  Changed GC_base
                    928:   to return 0 for pointers past the end of large objects.
                    929:   Improved GC_base performance with ALL_INTERIOR_POINTERS
                    930:   on machines with a slow integer mod operation.
                    931:   Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare
                    932:   for preprocessor.
                    933: - changed the default on most UNIX machines to be that
                    934:   signals are not disabled during critical GC operations.
                    935:   This is still ANSI-conforming, though somewhat dangerous
                    936:   in the presence of signal handlers. But the performance
                    937:   cost of the alternative is sometimes problematic.
                    938:   Can be changed back with a minor Makefile edit.
                    939: - renamed IS_STRING in gc.h, to CORD_IS_STRING, thus
                    940:   following my own naming convention.  Added the function
                    941:   CORD_to_const_char_star.
                    942: - Fixed a gross bug in GC_finalize.  Symptom: occasional
                    943:   address faults in that function.  (Thanks to Anselm
                    944:   Baird-Smith (Anselm.BairdSmith@inria.fr)
                    945: - Added port to ICL DRS6000 running DRS/NX.  Restructured
                    946:   things a bit to factor out common code, and remove obsolete
                    947:   code.  Collector should now run under SUNOS5 with either
                    948:   mprotect or /proc dirty bits.  (Thanks to Douglas Steel
                    949:   (doug@wg.icl.co.uk)).
                    950: - More bug fixes and workarounds for Solaris 2.X.  (These were
                    951:   mostly related to putting the collector in a dynamic library,
                    952:   which didn't really work before.  Also SOLARIS_THREADS
                    953:   didn't interact well with dl_open.)  Thanks to btlewis@eng.sun.com.
                    954: - Fixed a serious performance bug on the DEC Alpha.  The text
                    955:   segment was getting registered as part of the root set.
                    956:   (Amazingly, the result was still fast enough that the bug
                    957:   was not conspicuous.) The fix works on OSF/1, version 1.3.
                    958:   Hopefully it also works on other versions of OSF/1 ...
                    959: - Fixed a bug in GC_clear_roots.
                    960: - Fixed a bug in GC_generic_malloc_words_small that broke
                    961:   gc_inl.h.  (Reported by Antoine de Maricourt.  I broke it
                    962:   in trying to tweak the Mac port.)
                    963: - Fixed some problems with cord/de under Linux.
                    964: - Fixed some cord problems, notably with CORD_riter4.
                    965: - Added DG/UX port.
                    966:   Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov)
                    967: - Added finalization registration routines with weaker ordering
                    968:   constraints.  (This is necessary for C++ finalization with
                    969:   multiple inheritance, since the compiler often adds self-cycles.)
                    970: - Filled the holes in the SCO port. (Thanks to Michael Arnoldus
                    971:   <chime@proinf.dk>.)
                    972: - John Ellis' additions to the C++ support:  From John:
                    973:
                    974: * I completely rewrote the documentation in the interface gc_c++.h
                    975: (later renamed gc_cpp.h).  I've tried to make it both clearer and more
                    976: precise.
                    977:
                    978: * The definition of accessibility now ignores pointers from an
                    979: finalizable object (an object with a clean-up function) to itself.
                    980: This allows objects with virtual base classes to be finalizable by the
                    981: collector.  Compilers typically implement virtual base classes using
                    982: pointers from an object to itself, which under the old definition of
                    983: accessibility prevented objects with virtual base classes from ever
                    984: being collected or finalized.
                    985:
                    986: * gc_cleanup now includes gc as a virtual base.  This was enabled by
                    987: the change in the definition of accessibility.
                    988:
                    989: * I added support for operator new[].  Since most (all?) compilers
                    990: don't yet support operator new[], it is conditionalized on
                    991: -DOPERATOR_NEW_ARRAY.  The code is untested, but its trivial and looks
                    992: correct.
                    993:
                    994: * The test program test_gc_c++ (later renamed test_cpp.cc)
                    995: tries to test for the C++-specific functionality not tested by the
                    996: other programs.
                    997: - Added <unistd.h> include to misc.c.  (Needed for ppcr.)
                    998: - Added PowerMac port. (Thanks to Patrick Beard again.)
                    999: - Fixed "srcdir"-related Makefile problems.  Changed things so
                   1000:   that all externally visible include files always appear in the
                   1001:   include subdirectory of the source.  Made gc.h directly
                   1002:   includable from C++ code.  (These were at Per
                   1003:   Bothner's suggestion.)
                   1004: - Changed Intel code to also mark from ebp (Kevin Warne's
                   1005:   suggestion).
                   1006: - Renamed C++ related files so they could live in a FAT
                   1007:   file system. (Charles Fiterman's suggestion.)
                   1008: - Changed Windows NT Makefile to include C++ support in
                   1009:   gc.lib.  Added C++ test as Makefile target.
                   1010:
                   1011: Since version 4.3:
                   1012:  - ASM_CLEAR_CODE was erroneously defined for HP
                   1013:    PA machines, resulting in a compile error.
                   1014:  - Fixed OS/2 Makefile to create a library.  (Thanks to
                   1015:    Mark Boulter (mboulter@vnet.ibm.com)).
                   1016:  - Gc_cleanup objects didn't work if they were created on
                   1017:    the stack.  Fixed.
                   1018:  - One copy of Gc_cpp.h in the distribution was out of
                   1019:    synch, and failed to document some known compiler
                   1020:    problems with explicit destructor invocation.  Partially
                   1021:    fixed.  There are probably other compilers on which
                   1022:    gc_cleanup is miscompiled.
                   1023:  - Fixed Makefile to pass C compiler flags to C++ compiler.
                   1024:  - Added Mac fixes.
                   1025:  - Fixed os_dep.c to work around what appears to be
                   1026:    a new and different VirtualQuery bug under newer
                   1027:    versions of win32S.
                   1028:  - GC_non_gc_bytes was not correctly maintained by
                   1029:    GC_free.  Fixed.  Thanks to James Clark (jjc@jclark.com).
                   1030:  - Added GC_set_max_heap_size.
                   1031:  - Changed allocation code to ignore blacklisting if it is preventing
                   1032:    use of a very large block of memory.  This has the advantage
                   1033:    that naive code allocating very large objects is much more
                   1034:    likely to work.  The downside is you might no
                   1035:    longer find out that such code should really use
                   1036:    GC_malloc_ignore_off_page.
                   1037:  - Changed GC_printf under win32 to close and reopen the file
                   1038:    between calls.  FAT file systems otherwise make the log file
                   1039:    useless for debugging.
                   1040:  - Added GC_try_to_collect and GC_get_bytes_since_gc.  These
                   1041:    allow starting an abortable collection during idle times.
                   1042:    This facility does not require special OS support.  (Thanks to
                   1043:    Michael Spertus of Geodesic Systems for suggesting this.  It was
                   1044:    actually an easy addition.  Kumar Srikantan previously added a similar
                   1045:    facility to a now ancient version of the collector.  At the time
                   1046:    this was much harder, and the result was less convincing.)
                   1047:  - Added some support for the Borland development environment.  (Thanks
                   1048:    to John Ellis and Michael Spertus.)
                   1049:  - Removed a misfeature from checksums.c that caused unexpected
                   1050:    heap growth.  (Thanks to Scott Schwartz.)
                   1051:  - Changed finalize.c to call WARN if it encounters a finalization cycle.
                   1052:    WARN is defined in gc_priv.h to write a message, usually to stdout.
                   1053:    In many environments, this may be inappropriate.
                   1054:  - Renamed NO_PARAMS in gc.h to GC_NO_PARAMS, thus adhering to my own
                   1055:    naming convention.
                   1056:  - Added GC_set_warn_proc to intercept warnings.
                   1057:  - Fixed Amiga port. (Thanks to Michel Schinz (schinz@alphanet.ch).)
                   1058:  - Fixed a bug in mark.c that could result in an access to unmapped
                   1059:    memory from GC_mark_from_mark_stack on machines with unaligned
                   1060:    pointers.
                   1061:  - Fixed a win32 specific performance bug that could result in scanning of
                   1062:    objects allocated with the system malloc.
                   1063:  - Added REDIRECT_MALLOC.
                   1064:
                   1065: Since version 4.4:
                   1066:  - Fixed many minor and one major README bugs. (Thanks to Franklin Chen
                   1067:    (chen@adi.com) for pointing out many of them.)
                   1068:  - Fixed ALPHA/OSF/1 dynamic library support. (Thanks to Jonathan Bachrach
                   1069:    (jonathan@harlequin.com)).
                   1070:  - Added incremental GC support (MPROTECT_VDB) for Linux (with some
                   1071:    help from Bruno Haible).
                   1072:  - Altered SPARC recognition tests in gc.h and config.h (mostly as
                   1073:    suggested by Fergus Henderson).
                   1074:  - Added basic incremental GC support for win32, as implemented by
                   1075:    Windows NT and Windows 95.  GC_enable_incremental is a noop
                   1076:    under win32s, which doesn't implement enough of the VM interface.
                   1077:  - Added -DLARGE_CONFIG.
                   1078:  - Fixed GC_..._ignore_off_page to also function without
                   1079:    -DALL_INTERIOR_POINTERS.
                   1080:  - (Hopefully) fixed RS/6000 port.  (Only the test was broken.)
                   1081:  - Fixed a performance bug in the nonincremental collector running
                   1082:    on machines supporting incremental collection with MPROTECT_VDB
                   1083:    (e.g. SunOS 4, DEC AXP).  This turned into a correctness bug under
                   1084:    win32s with win32 incremental collection.  (Not all memory protection
                   1085:    was disabled.)
                   1086:  - Fixed some ppcr related bit rot.
                   1087:  - Caused dynamic libraries to be unregistered before reregistering.
                   1088:    The old way turned out to be a performance bug on some machines.
                   1089:  - GC_root_size was not properly maintained under MSWIN32.
                   1090:  - Added -DNO_DEBUGGING and GC_dump.
                   1091:  - Fixed a couple of bugs arising with SOLARIS_THREADS +
                   1092:    REDIRECT_MALLOC.
                   1093:  - Added NetBSD/M68K port.  (Thanks to Peter Seebach
                   1094:    <seebs@taniemarie.solon.com>.)
                   1095:  - Fixed a serious realloc bug.  For certain object sizes, the collector
                   1096:    wouldn't scan the expanded part of the object.  (Thanks to Clay Spence
                   1097:    (cds@peanut.sarnoff.com) for noticing the problem, and helping me to
                   1098:    track it down.)
                   1099:
                   1100: Since version 4.5:
                   1101:  - Added Linux ELF support.  (Thanks to Arrigo Triulzi <arrigo@ic.ac.uk>.)
                   1102:  - GC_base crashed if it was called before any other GC_ routines.
                   1103:    This could happen if a gc_cleanup object was allocated outside the heap
                   1104:    before any heap allocation.
                   1105:  - The heap expansion heuristic was not stable if all objects had finalization
                   1106:    enabled.  Fixed finalize.c to count memory in finalization queue and
                   1107:    avoid explicit deallocation.  Changed alloc.c to also consider this count.
                   1108:    (This is still not recommended.  It's expensive if nothing else.)  Thanks
                   1109:    to John Ellis for pointing this out.
                   1110:  - GC_malloc_uncollectable(0) was broken.  Thanks to Phong Vo for pointing
                   1111:    this out.
                   1112:  - The collector didn't compile under Linux 1.3.X.  (Thanks to Fred Gilham for
                   1113:    pointing this out.)  The current workaround is ugly, but expected to be
                   1114:    temporary.
                   1115:  - Fixed a formatting problem for SPARC stack traces.
                   1116:  - Fixed some '=='s in os_dep.c that should have been assignments.
                   1117:    Fortunately these were in code that should never be executed anyway.
                   1118:    (Thanks to Fergus Henderson.)
                   1119:  - Fixed the heap block allocator to only drop blacklisted blocks in small
                   1120:    chunks.  Made BL_LIMIT self adjusting.  (Both of these were in response
                   1121:    to heap growth observed by Paul Graham.)
                   1122:  - Fixed the Metrowerks/68K Mac code to also mark from a6.  (Thanks
                   1123:    to Patrick Beard.)
                   1124:  - Significantly updated README.debugging.
                   1125:  - Fixed some problems with longjmps out of signal handlers, especially under
                   1126:    Solaris.  Added a workaround for the fact that siglongjmp doesn't appear to
                   1127:    do the right thing with -lthread under Solaris.
                   1128:  - Added MSDOS/djgpp port.  (Thanks to Mitch Harris  (maharri@uiuc.edu).)
                   1129:  - Added "make reserved_namespace" and "make user_namespace".  The
                   1130:    first renames ALL "GC_xxx" identifiers as "_GC_xxx".  The second is the
                   1131:    inverse transformation.  Note that doing this is guaranteed to break all
                   1132:    clients written for the other names.
                   1133:  - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
                   1134:    defined should be -ALIGNMENT not WORDS_TO_BYTES(-1).  This is
                   1135:    a serious bug on machines with pointer alignment of less than a word.
                   1136:  - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the
                   1137:    end of the object correctly.  Caused failures of the C++ test on a DEC Alpha
                   1138:    with g++.
                   1139:  - gc_inl.h still had problems.  Partially fixed.  Added warnings at the
                   1140:    beginning to hopefully specify the remaining dangers.
                   1141:  - Added DATAEND definition to config.h.
                   1142:  - Fixed some of the .h file organization.  Fixed "make floppy".
                   1143:
                   1144: Since version 4.6:
                   1145:  - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle)
                   1146:  - Updated some Mac specific files to synchronize with Patrick Beard.
                   1147:  - Fixed a serious bug for machines with non-word-aligned pointers.
                   1148:    (Thanks to Patrick Beard for pointing out the problem.  The collector
                   1149:    should fail almost any conceivable test immediately on such machines.)
                   1150:
                   1151: Since version 4.7:
                   1152:  - Changed a "comment" in a MacOS specific part of mach-dep.c that caused
                   1153:    gcc to fail on other platforms.
                   1154:
                   1155: Since version 4.8
                   1156:  - More README.debugging fixes.
                   1157:  - Objects ready for finalization, but not finalized in the same GC
                   1158:    cycle, could be prematurely collected.  This occasionally happened
                   1159:    in test_cpp.
                   1160:  - Too little memory was obtained from the system for very large
                   1161:    objects.  That could cause a heap explosion if these objects were
                   1162:    not contiguous (e.g. under PCR), and too much of them was blacklisted.
                   1163:  - Due to an improper initialization, the collector was too hesitant to
                   1164:    allocate blacklisted objects immediately after system startup.
                   1165:  - Moved GC_arrays from the data into the bss segment by not explicitly
                   1166:    initializing it to zero.  This significantly
                   1167:    reduces the size of executables, and probably avoids some disk accesses
                   1168:    on program startup.  It's conceivable that it might break a port that I
                   1169:    didn't test.
                   1170:  - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which
                   1171:    occurred a while ago.
                   1172:
                   1173: Since 4.9:
                   1174:  - Fixed a typo around a call to GC_collect_or_expand in alloc.c.  It broke
                   1175:    handling of out of memory.  (Thanks to Patrick Beard for noticing.)
                   1176:
                   1177: Since 4.10:
                   1178:  - Rationalized (hopefully) GC_try_to_collect in an incremental collection
                   1179:    environment.  It appeared to not handle a call while a collection was in
                   1180:    progress, and was otherwise too conservative.
                   1181:  - Merged GC_reclaim_or_delete_all into GC_reclaim_all to get rid of some
                   1182:    code.
                   1183:  - Added Patrick Beard's Mac fixes, with substantial completely untested
                   1184:    modifications.
                   1185:  - Fixed the MPROTECT_VDB code to deal with large pages and imprecise
                   1186:    fault addresses (as on an UltraSPARC running Solaris 2.5).  Note that this
                   1187:    was not a problem in the default configuration, which uses PROC_VDB.
                   1188:  - The DEC Alpha assembly code needed to restore $gp between calls.
                   1189:    Thanks to Fergus Henderson for tracking this down and supplying a
                   1190:    patch.
                   1191:  - The write command for "de" was completely broken for large files.
                   1192:    I used the easiest portable fix, which involved changing the semantics
                   1193:    so that f.new is written instead of overwriting f.  That's safer anyway.
                   1194:  - Added README.solaris2 with a discussion of the possible problems of
                   1195:    mixing the collector's sbrk allocation with malloc/realloc.
                   1196:  - Changed the data segment starting address for SGI machines.  The
                   1197:    old code failed under IRIX6.
                   1198:  - Required double word alignment for MIPS.
                   1199:  - Various minor fixes to remove warnings.
                   1200:  - Attempted to fix some Solaris threads problems reported by Zhiying Chen.
                   1201:    In particular, the collector could try to fork a thread with the
                   1202:    world stopped as part of GC_thr_init.  It also failed to deal with
                   1203:    the case in which the original thread terminated before the whole
                   1204:    process did.
                   1205:  - Added -DNO_EXECUTE_PERMISSION.  This has a major performance impact
                   1206:    on the incremental collector under Irix, and perhaps under other
                   1207:    operating systems.
                   1208:  - Added some code to support allocating the heap with mmap.  This may
                   1209:    be preferable under some circumstances.
                   1210:  - Integrated dynamic library support for HP.
                   1211:    (Thanks to Knut Tvedten <knuttv@ifi.uio.no>.)
                   1212:  - Integrated James Clark's win32 threads support, and made a number
                   1213:    of changes to it, many of which were suggested by Pontus Rydin.
                   1214:    This is still not 100% solid.
                   1215:  - Integrated Alistair Crooks' support for UTS4 running on an Amdahl
                   1216:    370-class machine.
                   1217:  - Fixed a serious bug in explicitly typed allocation.  Objects requiring
                   1218:    large descriptors where handled in a way that usually resulted in
                   1219:    a segmentation fault in the marker.  (Thanks to Jeremy Fitzhardinge
                   1220:    for helping to track this down.)
                   1221:  - Added partial support for GNU win32 development.  (Thanks to Fergus
                   1222:    Henderson.)
                   1223:  - Added optional support for Java-style finalization semantics.  (Thanks
                   1224:    to Patrick Bridges.)  This is recommended only for Java implementations.
                   1225:  - GC_malloc_uncollectable faulted instead of returning 0 when out of
                   1226:    memory.  (Thanks to dan@math.uiuc.edu for noticing.)
                   1227:  - Calls to GC_base before the collector was initialized failed on a
                   1228:    DEC Alpha.  (Thanks to Matthew Flatt.)
                   1229:  - Added base pointer checking to GC_REGISTER_FINALIZER in debugging
                   1230:    mode, at the suggestion of Jeremy Fitzhardinge.
                   1231:  - GC_debug_realloc failed for uncollectable objects.  (Thanks to
                   1232:    Jeremy Fitzhardinge.)
                   1233:  - Explicitly typed allocation could crash if it ran out of memory.
                   1234:    (Thanks to Jeremy Fitzhardinge.)
                   1235:  - Added minimal support for a DEC Alpha running Linux.
                   1236:  - Fixed a problem with allocation of objects whose size overflowed
                   1237:    ptrdiff_t.  (This now fails unconditionally, as it should.)
                   1238:  - Added the beginning of Irix pthread support.
                   1239:  - Integrated Xiaokun Zhu's fixes for djgpp 2.01.
                   1240:  - Added SGI-style STL allocator support (gc_alloc.h).
                   1241:  - Fixed a serious bug in README.solaris2.  Multithreaded programs must include
                   1242:    gc.h with SOLARIS_THREADS defined.
                   1243:  - Changed GC_free so it actually deallocates uncollectable objects.
                   1244:    (Thanks to Peter Chubb for pointing out the problem.)
                   1245:  - Added Linux ELF support for dynamic libararies.  (Thanks again to
                   1246:    Patrick Bridges.)
                   1247:  - Changed the Borland cc configuration so that the assembler is not
                   1248:    required.
                   1249:  - Fixed a bug in the C++ test that caused it to fail in 64-bit
                   1250:    environments.
                   1251:
                   1252: Since 4.11:
                   1253:  - Fixed ElfW definition in dyn_load.c. (Thanks to Fergus Henderson.)
                   1254:    This prevented the dynamic library support from compiling on some
                   1255:    older ELF Linux systems.
                   1256:  - Fixed UTS4 port (which I apparently mangled during the integration)
                   1257:    (Thanks to again to Alistair Crooks.)
                   1258:  - "Make C++" failed on Suns with SC4.0, due to a problem with "bool".
                   1259:    Fixed in gc_priv.h.
                   1260:  - Added more pieces for GNU win32.  (Thanks to Timothy N. Newsham.)
                   1261:    The current state of things should suffice for at least some
                   1262:    applications.
                   1263:  - Changed the out of memory retry count handling as suggested by
                   1264:    Kenjiro Taura.  (This matters only if GC_max_retries > 0, which
                   1265:    is no longer the default.)
                   1266:  - If a /proc read failed repeatedly, GC_written_pages was not updated
                   1267:    correctly.  (Thanks to Peter Chubb for diagnosing this.)
                   1268:  - Under unlikely circumstances, the allocator could infinite loop in
                   1269:    an out of memory situation.  (Thanks again to Kenjiro Taura for
                   1270:    identifying the problem and supplying a fix.)
                   1271:  - Fixed a syntactic error in the DJGPP code.  (Thanks to Fergus
                   1272:    Henderson for finding this by inspection.)  Also fixed a test program
                   1273:    problem with DJGPP (Thanks to Peter Monks.)
                   1274:  - Atomic uncollectable objects were not treated correctly by the
                   1275:    incremental collector.  This resulted in weird log statistics and
                   1276:    occasional performance problems.  (Thanks to Peter Chubb for pointing
                   1277:    this out.)
                   1278:  - Fixed some problems resulting from compilers that dont define
                   1279:    __STDC__.  In this case void * and char * were used inconsistently
                   1280:    in some cases.  (Void * should not have been used at all.  If
                   1281:    you have an ANSI superset compiler that does not define __STDC__,
                   1282:    please compile with -D__STDC__=0. Thanks to Manuel Serrano and others
                   1283:    for pointing out the problem.)
                   1284:  - Fixed a compilation problem on Irix with -n32 and -DIRIX_THREADS.
                   1285:    Also fixed some other IRIX_THREADS problems which may or may not have
                   1286:    had observable symptoms.
                   1287:  - Fixed an HP PA compilation problem in dyn_load.c.  (Thanks to
                   1288:    Philippe Queinnec.)
                   1289:  - SEGV fault handlers sometimes did not get reset correctly.  (Thanks
                   1290:    to David Pickens.)
                   1291:  - Added a fix for SOLARIS_THREADS on Intel.  (Thanks again to David
                   1292:    Pickens.)  This probably needs more work to become functional.
                   1293:  - Fixed struct sigcontext_struct in os_dep.c for compilation under
                   1294:    Linux 2.1.X.        (Thanks to Fergus Henderson.)
                   1295:  - Changed the DJGPP STACKBOTTOM and DATASTART values to those suggested
                   1296:    by Kristian Kristensen.  These may still not be right, but it is
                   1297:    it is likely to work more often than what was there before.  They may
                   1298:    even be exactly right.
                   1299:  - Added a #include <string.h> to test_cpp.cc.  This appears to help
                   1300:    with HP/UX and gcc.  (Thanks to assar@sics.se.)
                   1301:  - Version 4.11 failed to run in incremental mode on recent 64-bit Irix
                   1302:    kernels.  This was a problem related to page unaligned heap segments.
                   1303:    Changed the code to page align heap sections on all platforms.
                   1304:    (I had mistakenly identified this as a kernel problem earlier.
                   1305:    It was not.)
                   1306:  - Version 4.11 did not make allocated storage executable, except on
                   1307:    one or two platforms, due to a bug in a #if test.  (Thanks to Dave
                   1308:    Grove for pointing this out.)
                   1309:  - Added sparc_sunos4_mach_dep.s to support Sun's compilers under SunOS4.
                   1310:  - Added GC_exclude_static_roots.
                   1311:  - Fixed the object size mapping algorithm.  This shouldn't matter,
                   1312:    but the old code was ugly.
                   1313:  - Heap checking code could die if one of the allocated objects was
                   1314:    larger than its base address.  (Unsigned underflow problem.  Thanks
                   1315:    to Clay Spence for isolating the problem.)
                   1316:  - Added RS6000 (AIX) dynamic library support and fixed STACK_BOTTOM.
                   1317:    (Thanks to Fred Stearns.)
                   1318:  - Added Fergus Henderson's patches for improved robustness with large
                   1319:    heaps and lots of blacklisting.
                   1320:  - Added Peter Chubb's changes to support Solaris Pthreads, to support
                   1321:    MMAP allocation in Solaris, to allow Solaris to find dynamic libraries
                   1322:    through /proc, to add malloc_typed_ignore_off_page, and a few other
                   1323:    minor features and bug fixes.
                   1324:  - The Solaris 2 port should not use sbrk.  I received confirmation from
                   1325:    Sun that the use of sbrk and malloc in the same program is not
                   1326:    supported.  The collector now defines USE_MMAP by default on Solaris.
                   1327:  - Replaced the djgpp makefile with Gary Leavens' version.
                   1328:  - Fixed MSWIN32 detection test.
                   1329:  - Added Fergus Henderson's patches to allow putting the collector into
                   1330:    a DLL under GNU win32.
                   1331:  - Added Ivan V. Demakov's port to Watcom C on X86.
                   1332:  - Added Ian Piumarta's Linux/PowerPC port.
                   1333:  - On Brian Burton's suggestion added PointerFreeGC to the placement
                   1334:    options in gc_cpp.h.  This is of course unsafe, and may be controversial.
                   1335:    On the other hand, it seems to be needed often enough that it's worth
                   1336:    adding as a standard facility.
                   1337:
                   1338: Since 4.12:
                   1339:  - Fixed a crucial bug in the Watcom port.  There was a redundant decl
                   1340:    of GC_push_one in gc_priv.h.
                   1341:  - Added FINALIZE_ON_DEMAND.
                   1342:  - Fixed some pre-ANSI cc problems in test.c.
                   1343:  - Removed getpagesize() use for Solaris.  It seems to be missing in one
                   1344:    or two versions.
                   1345:  - Fixed bool handling for SPARCCompiler version 4.2.
                   1346:  - Fixed some files in include that had gotten unlinked from the main
                   1347:    copy.
                   1348:  - Some RS/6000 fixes (missing casts).  Thanks to Toralf Foerster.
                   1349:  - Fixed several problems in GC_debug_realloc, affecting mostly the
                   1350:    FIND_LEAK case.
                   1351:  - GC_exclude_static_roots contained a buggy unsigned comparison to
                   1352:    terminate a loop.  (Thanks to Wilson Ho.)
                   1353:  - CORD_str failed if the substring occurred at the last possible position.
                   1354:    (Only affects cord users.)
                   1355:  - Fixed Linux code to deal with RedHat 5.0 and integrated Peter Bigot's
                   1356:    os_dep.c code for dealing with various Linux versions.
                   1357:  - Added workaround for Irix pthreads sigaction bug and possible signal
                   1358:    misdirection problems.
                   1359: Since alpha1:
                   1360:  - Changed RS6000 STACKBOTTOM.
                   1361:  - Integrated Patrick Beard's Mac changes.
                   1362:  - Alpha1 didn't compile on Irix m.n, m < 6.
                   1363:  - Replaced Makefile.dj with a new one from Gary Leavens.
                   1364:  - Added Andrew Stitcher's changes to support SCO OpenServer.
                   1365:  - Added PRINT_BLACK_LIST, to allow debugging of high densities of false
                   1366:    pointers.
                   1367:  - Added code to debug allocator to keep track of return address
                   1368:    in GC_malloc caller, thus giving a bit more context.
                   1369:  - Changed default behavior of large block allocator to more
                   1370:    aggressively avoid fragmentation.  This is likely to slow down the
                   1371:    collector when it succeeds at reducing space cost.
                   1372:  - Integrated Fergus Henderson's CYGWIN32 changes.  They are untested,
                   1373:    but needed for newer versions.
                   1374:  - USE_MMAP had some serious bugs.  This caused the collector to fail
                   1375:    consistently on Solaris with -DSMALL_CONFIG.
                   1376:  - Added Linux threads support, thanks largely to Fergus Henderson.
                   1377: Since alpha2:
                   1378:  - Fixed more Linux threads problems.
                   1379:  - Changed default GC_free_space_divisor to 3 with new large block allocation.
                   1380:    (Thanks to Matthew Flatt for some measurements that suggest the old
                   1381:    value sometimes favors space too much over time.)
                   1382:  - More CYGWIN32 fixes.
                   1383:  - Integrated Tyson-Dowd's Linux-M68K port.
                   1384:  - Minor HP PA and DEC UNIX fixes from Fergus Henderson.
                   1385:  - Integrated Christoffe Raffali's Linux-SPARC changes.
                   1386:  - Allowed for one more GC fixup iteration after a full GC in incremental
                   1387:    mode.  Some quick measurements suggested that this significantly
                   1388:    reduces pause times even with smaller GC_RATE values.
                   1389:  - Moved some more GC data structures into GC_arrays.  This decreases
                   1390:    pause times and GC overhead, but makes debugging slightly less convenient.
                   1391:  - Fixed namespace pollution problem ("excl_table").
                   1392:  - Made GC_incremental a constant for -DSMALL_CONFIG, hopefully shrinking
                   1393:    that slightly.
                   1394:  - Added some win32 threads fixes.
                   1395:  - Integrated Ivan Demakov and David Stes' Watcom fixes.
                   1396:  - Various other minor fixes contributed by many people.
                   1397:  - Renamed config.h to gcconfig.h, since config.h tends to be used for
                   1398:    many other things.
                   1399:  - Integrated Matthew Flatt's support for 68K MacOS "far globals".
                   1400:  - Fixed up some of the dynamic library Makefile targets for consistency
                   1401:    across platforms.
                   1402:  - Fixed a USE_MMAP typo that caused out-of-memory handling to fail
                   1403:    on Solaris.
                   1404:  - Added code to test.c to test thread creation a bit more.
                   1405:  - Integrated GC_win32_free_heap, as suggested by Ivan Demakov.
                   1406:  - Fixed Solaris 2.7 stack base finding problem.  (This may actually
                   1407:    have been done in an earlier alpha release.)
                   1408: Since alpha3:
                   1409:  - Fixed MSWIN32 recognition test, which interfered with cygwin.
                   1410:  - Removed unnecessary gc_watcom.asm from distribution.  Removed
                   1411:    some obsolete README.win32 text.
                   1412:  - Added Alpha Linux incremental GC support.  (Thanks to Philipp Tomsich
                   1413:    for code for retrieving the fault address in a signal handler.)
                   1414:    Changed Linux signal handler context argument to be a pointer.
                   1415:  - Took care of some new warnings generated by the 7.3 SGI compiler.
                   1416:  - Integrated Phillip Musumeci's FreeBSD/ELF fixes.
                   1417:  - -DIRIX_THREADS was broken with the -o32 ABI (typo in gc_priv.h>
                   1418:
                   1419: Since 4.13:
                   1420:  - Fixed GC_print_source_ptr to not use a prototype.
                   1421:  - generalized CYGWIN test.
                   1422:  - gc::new did the wrong thing with PointerFreeGC placement.
                   1423:    (Thanks to Rauli Ruohonen.)
                   1424:  - In the ALL_INTERIOR_POINTERS (default) case, some callee-save register
                   1425:    values could fail to be scanned if the register was saved and
                   1426:    reused in a GC frame.  This showed up in verbose mode with gctest
                   1427:    compiled with an unreleased SGI compiler.  I vaguely recall an old
                   1428:    bug report that may have been related.  The bug was probably quite old.
                   1429:    (The problem was that the stack scanning could be deferred until
                   1430:    after the relevant frame was overwritten, and the new save location
                   1431:    might be outside the scanned area.  Fixed by more eager stack scanning.)
                   1432:  - PRINT_BLACK_LIST had some problems.  A few source addresses were garbage.
                   1433:  - Replaced Makefile.dj and added -I flags to cord make targets.
                   1434:    (Thanks to Gary Leavens.)
                   1435:  - GC_try_to_collect was broken with the nonincremental collector.
                   1436:  - gc_cleanup destructors could pass the wrong address to
                   1437:    GC_register_finalizer_ignore_self in the presence of multiple
                   1438:    inheritance.  (Thanks to Darrell Schiebel.)
                   1439:  - Changed PowerPC Linux stack finding code.
                   1440:
                   1441: Since 4.14alpha1
                   1442:  - -DSMALL_CONFIG did not work reliably with large (> 4K) pages.
                   1443:    Recycling the mark stack during expansion could result in a size
                   1444:    zero heap segment, which confused things.  (This was probably also an
                   1445:    issue with the normal config and huge pages.)
                   1446:  - Did more work to make sure that callee-save registers were scanned
                   1447:    completely, even with the setjmp-based code.  Added USE_GENERIC_PUSH_REGS
                   1448:    macro to facilitate testing on machines I have access to.
                   1449:  - Added code to explicitly push register contents for win32 threads.
                   1450:    This seems to be necessary.  (Thanks to Pierre de Rop.)
                   1451:
                   1452: Since 4.14alpha2
                   1453:  - changed STACKBOTTOM for DJGPP (Thanks to Salvador Eduardo Tropea).
                   1454:
                   1455: Since 4.14
                   1456:  - Reworked large block allocator.  Now uses multiple doubly linked free
                   1457:    lists to approximate best fit.
                   1458:  - Changed heap expansion heuristic.  Entirely free blocks are no longer
                   1459:    counted towards the heap size.  This seems to have a major impact on
                   1460:    heap size stability; the old version could expand the heap way too
                   1461:    much in the presence of large block fragmentation.
                   1462:  - added -DGC_ASSERTIONS and some simple assertions inside the collector.
                   1463:    This is mainlyt for collector debugging.
                   1464:  - added -DUSE_MUNMAP to allow the heap to shrink.  Suupported on only
                   1465:    a few UNIX-like platforms for now.
                   1466:  - added GC_dump_regions() for debugging of fragmentation issues.
                   1467:  - Changed PowerPC pointer alignment under Linux to 4.  (This needs
                   1468:    checking by someone who has one.  The suggestions came to me via a
                   1469:    rather circuitous path.)
                   1470:  - Changed the Linux/Alpha port to walk the data segment backwards until
                   1471:    it encounters a SIGSEGV.  The old way to find the start of the data
                   1472:    segment broke with a recent release.
                   1473:  - cordxtra.c needed to call GC_REGISTER_FINALIZER instead of
                   1474:    GC_register_finalizer, so that it would continue to work with GC_DEBUG.
                   1475:  - allochblk sometimes cleared the wrong block for debugging purposes
                   1476:    when it dropped blacklisted blocks.  This could result in spurious
                   1477:    error reports with GC_DEBUG.
                   1478:  - added MACOS X Server support.  (Thanks to Andrew Stone.)
                   1479:  - Changed the Solaris threads code to ignore stack limits > 8 MB with
                   1480:    a warning.  Empirically, it is not safe to access arbitrary pages
                   1481:    in such large stacks.  And the dirty bit implementation does not
                   1482:    guarantee that none of them will be accessed.
                   1483:  - Integrated Martin Tauchmann's Amiga changes.
                   1484:  - Integrated James Dominy's OpenBSD/SPARC port.
                   1485:
                   1486: Since 5.0alpha1
                   1487:  - Fixed bugs introduced in alpha1 (OpenBSD & large block initialization).
                   1488:  - Added -DKEEP_BACK_PTRS and backptr.h interface.  (The implementation
                   1489:    idea came from Al Demers.)
                   1490:
                   1491: Since 5.0alpha2
                   1492:  - Added some highly incomplete code to support a copied young generation.
                   1493:    Comments on nursery.h are appreciated.
                   1494:  - Changed -DFIND_LEAK, -DJAVA_FINALIZATION, and -DFINALIZE_ON_DEMAND,
                   1495:    so the same effect could be obtained with a runtime switch.   This is
                   1496:    a step towards standardizing on a single dynamic GC library.
                   1497:  - Significantly changed the way leak detection is handled, as a consequence
                   1498:    of the above.
                   1499:
                   1500: Since 5.0 alpha3
                   1501:  - Added protection fault handling patch for Linux/M68K from Fergus
                   1502:    Henderson and Roman Hodek.
                   1503:  - Removed the tests for SGI_SOURCE in new_gc_alloc.h.  This was causing that
                   1504:    interface to fail on nonSGI platforms.
                   1505:  - Changed the Linux stack finding code to use /proc, after changing it
                   1506:    to use HEURISTIC1.  (Thanks to David Mossberger for pointing out the
                   1507:    /proc hook.)
                   1508:  - Added HP/UX incremental GC support and HP/UX 11 thread support.
                   1509:    Thread support is currently still flakey.
                   1510:  - Added basic Linux/IA64 support.
                   1511:  - Integrated Anthony Green's PicoJava support.
                   1512:  - Integrated Scott Ananian's StrongARM/NetBSD support.
                   1513:  - Fixed some fairly serious performance bugs in the incremental
                   1514:    collector.  These have probably been there essentially forever.
                   1515:    (Mark bits were sometimes set before scanning dirty pages.
                   1516:    The reclaim phase unnecessarily dirtied full small object pages.)
                   1517:  - Changed the reclaim phase to ignore nearly full pages to avoid
                   1518:    touching them.
                   1519:  - Limited GC_black_list_spacing to roughly the heap growth increment.
                   1520:  - Changed full collection triggering heuristic to decrease full GC
                   1521:    frequency by default, but to explicitly trigger full GCs during
                   1522:    heap growth.  This doesn't always improve things, but on average it's
                   1523:    probably a win.
                   1524:  - GC_debug_free(0, ...) failed.  Thanks to Fergus Henderson for the
                   1525:    bug report and fix.
                   1526:
                   1527: Since 5.0 alpha4
                   1528:  - GC_malloc_explicitly_typed and friends sometimes failed to
                   1529:    initialize first word.
                   1530:  - Added allocation routines and support in the marker for mark descriptors
                   1531:    in a type structure referenced by the first word of an object.  This was
                   1532:    introduced to support gcj, but hopefully in a way that makes it
                   1533:    generically useful.
                   1534:  - Added GC_requested_heapsize, and inhibited collections in nonincremental
                   1535:    mode if the actual used heap size is less than what was explicitly
                   1536:    requested.
                   1537:  - The Solaris pthreads version of GC_pthread_create didn't handle a NULL
                   1538:    attribute pointer.  Solaris thread support used the wrong default thread
                   1539:    stack size.  (Thanks to Melissa O'Neill for the patch.)
                   1540:  - Changed PUSH_CONTENTS macro to no longer modify first parameter.
                   1541:    This usually doesn't matter, but it was certainly an accident waiting
                   1542:    to happen ...
                   1543:  - Added GC_register_finalizer_no_order and friends to gc.h.  They're
                   1544:    needed by Java implementations.
                   1545:  - Integrated a fix for a win32 deadlock resulting from clock() calling
                   1546:    malloc.  (Thanks to Chris Dodd.)
                   1547:  - Integrated Hiroshi Kawashima's port to Linux/MIPS.  This was designed
                   1548:    for a handheld platform, and may or may not be sufficient for other
                   1549:    machines.
                   1550:  - Fixed a va_arg problem with the %c specifier in cordprnt.c.  It appears
                   1551:    that this was always broken, but recent versions of gcc are the first to
                   1552:    report the (statically detectable) bug.
                   1553:  - Added an attempt at a more general solution to dlopen races/deadlocks.
                   1554:    GC_dlopen now temporarily disables collection.  Still not ideal, but ...
                   1555:  - Added -DUSE_I686_PREFETCH, -DUSE_3DNOW_PREFETCH, and support for IA64
                   1556:    prefetch instructions.  May improve performance measurably, but I'm not
                   1557:    sure the code will run correctly on processors that don't support the
                   1558:    instruction.  Won't build except with very recent gcc.
                   1559:  - Added caching for header lookups in the marker.  This seems to result
                   1560:    in a barely measurable performance gain.  Added support for interleaved
                   1561:    lookups of two pointers, but unconfigured that since the performance
                   1562:    gain is currently near zero, and it adds to code size.
                   1563:  - Changed Linux DATA_START definition to check both data_start and
                   1564:    __data_start, since nothing else seems to be portable.
                   1565:  - Added -DUSE_LD_WRAP to optionally take advantage of the GNU ld function
                   1566:    wrapping mechanism.  Probably currently useful only on Linux.
                   1567:  - Moved some variables for the scratch allocator into GC_arrays, on
                   1568:    Martin Hirzel's suggestion.
                   1569:  - Fixed a win32 threads bug that caused the collector to not look for
                   1570:    interior pointers from one of the thread stacks without
                   1571:    ALL_INTERIOR_POINTERS.  (Thanks to Jeff Sturm.)
                   1572:  - Added Mingw32 support.  (Thanks again to Jeff Sturm for the patch.)
                   1573:  - Changed the alpha port to use the generic register scanning code instead
                   1574:    of alpha_mach_dep.s.  Alpha_mach_dep.s doesn't look for pointers in fp
                   1575:    registers, but gcc sometimes spills pointers there.  (Thanks to Manuel
                   1576:    Serrano for helping me debug this by email.)  Changed the IA64 code to
                   1577:    do something similar for similar reasons.
                   1578:
                   1579: Since 5.0alpha6:
                   1580:  - -DREDIRECT_MALLOC was broken in alpha6. Fixed.
                   1581:  - Cleaned up gc_ccp.h slightly, thus also causing the HP C++ compiler to
                   1582:    accept it.
                   1583:  - Removed accidental reference to dbg_mlc.c, which caused dbg_mlc.o to be
                   1584:    linked into every executable.
                   1585:  - Added PREFETCH to bitmap marker.  Changed it to use the header cache.
                   1586:  - GC_push_marked sometimes pushed one object too many, resulting in a
                   1587:    segmentation fault in GC_mark_from_mark_stack.  This was probably an old
                   1588:    bug.  It finally showed up in gctest on win32.
                   1589:  - Gc_priv.h erroneously #defined GC_incremental to be TRUE instead of FALSE
                   1590:    when SMALL_CONFIG was defined.  This was no doubt a major performance bug for
                   1591:    the default win32 configuration.
                   1592:  - Removed -DSMALL_CONFIG from NT_MAKEFILE.  It seemed like an anchronism now
                   1593:    that the average PC has 64MB or so.
                   1594:  - Integrated Bryce McKinley's patches for linux threads and dynamic loading
                   1595:    from the libgcj tree.  Turned on dynamic loading support for Linux/PPC.
                   1596:  - Changed the stack finding code to use environ on HP/UX.  (Thanks
                   1597:    to Gustavo Rodriguez-Rivera for the suggestion.)  This should probably
                   1598:    be done on other platforms, too.  Since I can't test those, that'll
                   1599:    wait until after 5.0.
                   1600:
                   1601: Since 5.0alpha7:
                   1602:  - Fixed threadlibs.c for linux threads.  -DUSE_LD_WRAP was broken and
                   1603:    -ldl was omitted.  Fixed Linux stack finding code to handle
                   1604:    -DUSE_LD_WRAP correctly.
                   1605:  - Added MSWIN32 exception handler around marker, so that the collector
                   1606:    can recover from root segments that are unmapped during the collection.
                   1607:    This caused occasional failures under Windows 98, and may also be
                   1608:    an issue under Windows NT/2000.
                   1609:
                   1610: Since 5.0
                   1611:  - Fixed a gc.h header bug which showed up under Irix.  (Thanks to
                   1612:    Dan Sullivan.)
                   1613:  - Fixed a typo in GC_double_descr in typd_mlc.c not getting traced correctly.
                   1614:    This probably could result in objects described by array descriptors not
                   1615:    getting traced correctly.  (Thanks to Ben Hutchings for pointing this out.)
                   1616:  - The block nearly full tests in reclaim.c were not correct for 64 bit
                   1617:    environments.  This could result in unnecessary heap growth under unlikely
                   1618:    conditions.
                   1619:  - Removed use of CLEAR_DOUBLE from generic reclaim code, since odd sizes
                   1620:    could occur.
                   1621:
                   1622: Since 5.1
                   1623:  - dyn_load.c declared GC_scratch_last_end_ptr as an extern even if it
                   1624:    was defined as a macro.  This prevented the collector from building on
                   1625:    Irix.
                   1626:  - We quietly assumed that indirect mark descriptors were never 0.
                   1627:    Our own typed allocation interface violated that.  This could result
                   1628:    in segmentation faults in the marker with typed allocation.
                   1629:  - Fixed a _DUSE_MUNMAP bug in the heap block allocation code.
                   1630:    (Thanks to Ben Hutchings for the patch.)
                   1631:  - Taught the collector about VC++ handling array operator new.
                   1632:    (Thanks again to Ben Hutchings for the patch.)
                   1633:  - The two copies of gc_hdrs.h had diverged.  Made one a link to the other
                   1634:    again.
                   1635:
                   1636: Since 5.2
                   1637:  - Fixed _end declaration for OSF1.
                   1638:  - There were lots of spurious leak reports in leak detection mode, caused
                   1639:    by the fact that some pages were not being swept, and hence unmarked
                   1640:    objects weren't making it onto free lists.  (This bug dated back to 5.0.)
                   1641:  - Fixed a typo in the liblinuxgc.so Makefile rule.
                   1642:  - Added the GetExitCodeThread to Win32 GC_stop_world to (mostly) work
                   1643:    around a Windows 95 GetOpenFileName problem.  (Thanks to Jacob Navia.)
                   1644:
                   1645: To do:
                   1646:  - Integrate Linux/SPARC fixes.
                   1647:  - Very large root set sizes (> 16 MB or so) could cause the collector
                   1648:    to abort with an unexpected mark stack overflow.  (Thanks again to
                   1649:    Peter Chubb.)  NOT YET FIXED.  Workaround is to increase the initial
                   1650:    size.
                   1651:  - The SGI version of the collector marks from mmapped pages, even
                   1652:    if they are not part of dynamic library static data areas.  This
                   1653:    causes performance problems with some SGI libraries that use mmap
                   1654:    as a bitmap allocator.  NOT YET FIXED.  It may be possible to turn
                   1655:    off DYNAMIC_LOADING in the collector as a workaround.  It may also
                   1656:    be possible to conditionally intercept mmap and use GC_exclude_static_roots.
                   1657:    The real fix is to walk rld data structures, which looks possible.
                   1658:  - Integrate MIT and DEC pthreads ports.
                   1659:  - Incremental collector should handle large objects better.  Currently,
                   1660:    it looks like the whole object is treated as dirty if any part of it
                   1661:    is.
                   1662:  - Cord/cordprnt.c doesn't build on a few platforms (notably PowerPC), since
                   1663:    we make some unwarranted assumptions about how varargs are handled.  This
                   1664:    currently makes the cord-aware versions of printf unusable on some platforms.
                   1665:    Fixing this is unfortunately not trivial.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>