aboutsummaryrefslogtreecommitdiffstats
path: root/gc/doc
diff options
context:
space:
mode:
authorDave Love2003-06-05 18:00:24 +0000
committerDave Love2003-06-05 18:00:24 +0000
commitd0982fbddb5d9202766a24ace3313b281a0a2eff (patch)
treee1b13c9ff11ae2359d1b1dd0ca33a9b9be197fd8 /gc/doc
parent460ff54e9d7a1aca9043ac267025e17b7b299595 (diff)
downloademacs-d0982fbddb5d9202766a24ace3313b281a0a2eff.tar.gz
emacs-d0982fbddb5d9202766a24ace3313b281a0a2eff.zip
Not committed to branch, sorry.
Diffstat (limited to 'gc/doc')
-rw-r--r--gc/doc/Makefile.am26
-rw-r--r--gc/doc/Makefile.in280
-rw-r--r--gc/doc/README622
-rw-r--r--gc/doc/README.DGUX386215
-rw-r--r--gc/doc/README.Mac385
-rw-r--r--gc/doc/README.MacOSX40
-rw-r--r--gc/doc/README.OS26
-rw-r--r--gc/doc/README.amiga322
-rwxr-xr-xgc/doc/README.arm.cross68
-rw-r--r--gc/doc/README.autoconf59
-rw-r--r--gc/doc/README.changes1809
-rw-r--r--gc/doc/README.contributors57
-rw-r--r--gc/doc/README.cords53
-rw-r--r--gc/doc/README.dj12
-rw-r--r--gc/doc/README.environment120
-rw-r--r--gc/doc/README.ews480081
-rw-r--r--gc/doc/README.hp18
-rw-r--r--gc/doc/README.linux132
-rw-r--r--gc/doc/README.macros78
-rw-r--r--gc/doc/README.rs60009
-rw-r--r--gc/doc/README.sgi41
-rw-r--r--gc/doc/README.solaris262
-rw-r--r--gc/doc/README.uts2
-rw-r--r--gc/doc/README.win32170
-rw-r--r--gc/doc/barrett_diagram106
-rw-r--r--gc/doc/debugging.html295
-rw-r--r--gc/doc/gc.man80
-rw-r--r--gc/doc/gcdescr.html520
-rw-r--r--gc/doc/gcinterface.html203
-rw-r--r--gc/doc/leak.html197
-rw-r--r--gc/doc/scale.html210
-rw-r--r--gc/doc/tree.html199
32 files changed, 0 insertions, 6477 deletions
diff --git a/gc/doc/Makefile.am b/gc/doc/Makefile.am
deleted file mode 100644
index 2e98329b36f..00000000000
--- a/gc/doc/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
1#
2#
3# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
5#
6# Permission is hereby granted to use or copy this program
7# for any purpose, provided the above notices are retained on all copies.
8# Permission to modify the code and to distribute modified code is granted,
9# provided the above notices are retained, and a notice that the code was
10# modified is included with the above copyright notice.
11#
12# Modified by: Grzegorz Jakacki <jakacki at acm dot org>
13
14## Process this file with automake to produce Makefile.in.
15
16# installed documentation
17#
18dist_pkgdata_DATA = barrett_diagram debugging.html gc.man \
19 gcdescr.html README README.amiga README.arm.cross \
20 README.autoconf README.changes README.contributors \
21 README.cords README.DGUX386 README.dj README.environment \
22 README.ews4800 README.hp README.linux README.Mac \
23 README.MacOSX README.macros README.OS2 README.rs6000 \
24 README.sgi README.solaris2 README.uts README.win32 \
25 tree.html leak.html gcinterface.html scale.html
26
diff --git a/gc/doc/Makefile.in b/gc/doc/Makefile.in
deleted file mode 100644
index ea2a214661e..00000000000
--- a/gc/doc/Makefile.in
+++ /dev/null
@@ -1,280 +0,0 @@
1# Makefile.in generated by automake 1.6.3 from Makefile.am.
2# @configure_input@
3
4# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
5# Free Software Foundation, Inc.
6# This Makefile.in is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13# PARTICULAR PURPOSE.
14
15@SET_MAKE@
16
17#
18#
19# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
20# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
21#
22# Permission is hereby granted to use or copy this program
23# for any purpose, provided the above notices are retained on all copies.
24# Permission to modify the code and to distribute modified code is granted,
25# provided the above notices are retained, and a notice that the code was
26# modified is included with the above copyright notice.
27#
28# Modified by: Grzegorz Jakacki <jakacki at acm dot org>
29SHELL = @SHELL@
30
31srcdir = @srcdir@
32top_srcdir = @top_srcdir@
33VPATH = @srcdir@
34prefix = @prefix@
35exec_prefix = @exec_prefix@
36
37bindir = @bindir@
38sbindir = @sbindir@
39libexecdir = @libexecdir@
40datadir = @datadir@
41sysconfdir = @sysconfdir@
42sharedstatedir = @sharedstatedir@
43localstatedir = @localstatedir@
44libdir = @libdir@
45infodir = @infodir@
46mandir = @mandir@
47includedir = @includedir@
48oldincludedir = /usr/include
49pkgdatadir = $(datadir)/@PACKAGE@
50pkglibdir = $(libdir)/@PACKAGE@
51pkgincludedir = $(includedir)/@PACKAGE@
52top_builddir = ..
53
54ACLOCAL = @ACLOCAL@
55AUTOCONF = @AUTOCONF@
56AUTOMAKE = @AUTOMAKE@
57AUTOHEADER = @AUTOHEADER@
58
59am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
60INSTALL = @INSTALL@
61INSTALL_PROGRAM = @INSTALL_PROGRAM@
62INSTALL_DATA = @INSTALL_DATA@
63install_sh_DATA = $(install_sh) -c -m 644
64install_sh_PROGRAM = $(install_sh) -c
65install_sh_SCRIPT = $(install_sh) -c
66INSTALL_SCRIPT = @INSTALL_SCRIPT@
67INSTALL_HEADER = $(INSTALL_DATA)
68transform = @program_transform_name@
69NORMAL_INSTALL = :
70PRE_INSTALL = :
71POST_INSTALL = :
72NORMAL_UNINSTALL = :
73PRE_UNINSTALL = :
74POST_UNINSTALL = :
75host_alias = @host_alias@
76host_triplet = @host@
77
78EXEEXT = @EXEEXT@
79OBJEXT = @OBJEXT@
80PATH_SEPARATOR = @PATH_SEPARATOR@
81AMTAR = @AMTAR@
82AR = @AR@
83AS = @AS@
84AWK = @AWK@
85CC = @CC@
86CCAS = @CCAS@
87CCASFLAGS = @CCASFLAGS@
88CFLAGS = @CFLAGS@
89CXX = @CXX@
90CXXFLAGS = @CXXFLAGS@
91CXXINCLUDES = @CXXINCLUDES@
92DEPDIR = @DEPDIR@
93DLLTOOL = @DLLTOOL@
94ECHO = @ECHO@
95EXTRA_TEST_LIBS = @EXTRA_TEST_LIBS@
96GC_CFLAGS = @GC_CFLAGS@
97GC_VERSION = @GC_VERSION@
98INCLUDES = @INCLUDES@
99INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
100LIBTOOL = @LIBTOOL@
101LN_S = @LN_S@
102MAINT = @MAINT@
103MY_CFLAGS = @MY_CFLAGS@
104OBJDUMP = @OBJDUMP@
105PACKAGE = @PACKAGE@
106RANLIB = @RANLIB@
107STRIP = @STRIP@
108THREADLIBS = @THREADLIBS@
109VERSION = @VERSION@
110addincludes = @addincludes@
111addobjs = @addobjs@
112addtests = @addtests@
113am__include = @am__include@
114am__quote = @am__quote@
115install_sh = @install_sh@
116target_all = @target_all@
117
118# installed documentation
119#
120dist_pkgdata_DATA = barrett_diagram debugging.html gc.man \
121 gcdescr.html README README.amiga README.arm.cross \
122 README.autoconf README.changes README.contributors \
123 README.cords README.DGUX386 README.dj README.environment \
124 README.ews4800 README.hp README.linux README.Mac \
125 README.MacOSX README.macros README.OS2 README.rs6000 \
126 README.sgi README.solaris2 README.uts README.win32 \
127 tree.html leak.html gcinterface.html scale.html
128
129subdir = doc
130mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
131CONFIG_CLEAN_FILES =
132DIST_SOURCES =
133DATA = $(dist_pkgdata_DATA)
134
135DIST_COMMON = README $(dist_pkgdata_DATA) Makefile.am Makefile.in
136all: all-am
137
138.SUFFIXES:
139$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
140 cd $(top_srcdir) && \
141 $(AUTOMAKE) --gnu doc/Makefile
142Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
143 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
144
145mostlyclean-libtool:
146 -rm -f *.lo
147
148clean-libtool:
149 -rm -rf .libs _libs
150
151distclean-libtool:
152 -rm -f libtool
153uninstall-info-am:
154dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
155install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
156 @$(NORMAL_INSTALL)
157 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
158 @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
159 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
160 f="`echo $$p | sed -e 's|^.*/||'`"; \
161 echo " $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \
162 $(dist_pkgdataDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \
163 done
164
165uninstall-dist_pkgdataDATA:
166 @$(NORMAL_UNINSTALL)
167 @list='$(dist_pkgdata_DATA)'; for p in $$list; do \
168 f="`echo $$p | sed -e 's|^.*/||'`"; \
169 echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
170 rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
171 done
172tags: TAGS
173TAGS:
174
175DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
176
177top_distdir = ..
178distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
179
180distdir: $(DISTFILES)
181 @list='$(DISTFILES)'; for file in $$list; do \
182 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
183 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
184 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
185 dir="/$$dir"; \
186 $(mkinstalldirs) "$(distdir)$$dir"; \
187 else \
188 dir=''; \
189 fi; \
190 if test -d $$d/$$file; then \
191 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
192 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
193 fi; \
194 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
195 else \
196 test -f $(distdir)/$$file \
197 || cp -p $$d/$$file $(distdir)/$$file \
198 || exit 1; \
199 fi; \
200 done
201check-am: all-am
202check: check-am
203all-am: Makefile $(DATA)
204
205installdirs:
206 $(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
207
208install: install-am
209install-exec: install-exec-am
210install-data: install-data-am
211uninstall: uninstall-am
212
213install-am: all-am
214 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
215
216installcheck: installcheck-am
217install-strip:
218 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
219 INSTALL_STRIP_FLAG=-s \
220 `test -z '$(STRIP)' || \
221 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
222mostlyclean-generic:
223
224clean-generic:
225
226distclean-generic:
227 -rm -f Makefile $(CONFIG_CLEAN_FILES)
228
229maintainer-clean-generic:
230 @echo "This command is intended for maintainers to use"
231 @echo "it deletes files that may require special tools to rebuild."
232clean: clean-am
233
234clean-am: clean-generic clean-libtool mostlyclean-am
235
236distclean: distclean-am
237
238distclean-am: clean-am distclean-generic distclean-libtool
239
240dvi: dvi-am
241
242dvi-am:
243
244info: info-am
245
246info-am:
247
248install-data-am: install-dist_pkgdataDATA
249
250install-exec-am:
251
252install-info: install-info-am
253
254install-man:
255
256installcheck-am:
257
258maintainer-clean: maintainer-clean-am
259
260maintainer-clean-am: distclean-am maintainer-clean-generic
261
262mostlyclean: mostlyclean-am
263
264mostlyclean-am: mostlyclean-generic mostlyclean-libtool
265
266uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am
267
268.PHONY: all all-am check check-am clean clean-generic clean-libtool \
269 distclean distclean-generic distclean-libtool distdir dvi \
270 dvi-am info info-am install install-am install-data \
271 install-data-am install-dist_pkgdataDATA install-exec \
272 install-exec-am install-info install-info-am install-man \
273 install-strip installcheck installcheck-am installdirs \
274 maintainer-clean maintainer-clean-generic mostlyclean \
275 mostlyclean-generic mostlyclean-libtool uninstall uninstall-am \
276 uninstall-dist_pkgdataDATA uninstall-info-am
277
278# Tell versions [3.59,3.63) of GNU make to not export all variables.
279# Otherwise a system limit (for SysV at least) may be exceeded.
280.NOEXPORT:
diff --git a/gc/doc/README b/gc/doc/README
deleted file mode 100644
index afe2d52453c..00000000000
--- a/gc/doc/README
+++ /dev/null
@@ -1,622 +0,0 @@
1Copyright (c) 1988, 1989 Hans-J. Boehm, Alan J. Demers
2Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
3Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved.
5
6The file linux_threads.c is also
7Copyright (c) 1998 by Fergus Henderson. All rights reserved.
8
9The files Makefile.am, and configure.in are
10Copyright (c) 2001 by Red Hat Inc. All rights reserved.
11
12Several files supporting GNU-style builds are copyrighted by the Free
13Software Foundation, and carry a different license from that given
14below.
15
16THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
17OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
18
19Permission is hereby granted to use or copy this program
20for any purpose, provided the above notices are retained on all copies.
21Permission to modify the code and to distribute modified code is granted,
22provided the above notices are retained, and a notice that the code was
23modified is included with the above copyright notice.
24
25A few of the files needed to use the GNU-style build procedure come with
26slightly different licenses, though they are all similar in spirit. A few
27are GPL'ed, but with an exception that should cover all uses in the
28collector. (If you are concerned about such things, I recommend you look
29at the notice in config.guess or ltmain.sh.)
30
31This is version 6.2alpha3 of a conservative garbage collector for C and C++.
32
33You might find a more recent version of this at
34
35http://www.hpl.hp.com/personal/Hans_Boehm/gc
36
37OVERVIEW
38
39 This is intended to be a general purpose, garbage collecting storage
40allocator. The algorithms used are described in:
41
42Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
43Software Practice & Experience, September 1988, pp. 807-820.
44
45Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
46Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
47and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
48
49Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
50of the ACM SIGPLAN '91 Conference on Programming Language Design and
51Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
52
53Boehm H., "Reducing Garbage Collector Cache Misses", Proceedings of the
542000 International Symposium on Memory Management.
55
56 Possible interactions between the collector and optimizing compilers are
57discussed in
58
59Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
60The Journal of C Language Translation 4, 2 (December 1992).
61
62and
63
64Boehm H., "Simple GC-safe Compilation", Proceedings
65of the ACM SIGPLAN '96 Conference on Programming Language Design and
66Implementation.
67
68(Some of these are also available from
69http://www.hpl.hp.com/personal/Hans_Boehm/papers/, among other places.)
70
71 Unlike the collector described in the second reference, this collector
72operates either with the mutator stopped during the entire collection
73(default) or incrementally during allocations. (The latter is supported
74on only a few machines.) On the most common platforms, it can be built
75with or without thread support. On a few platforms, it can take advantage
76of a multiprocessor to speed up garbage collection.
77
78 Many of the ideas underlying the collector have previously been explored
79by others. Notably, some of the run-time systems developed at Xerox PARC
80in the early 1980s conservatively scanned thread stacks to locate possible
81pointers (cf. Paul Rovner, "On Adding Garbage Collection and Runtime Types
82to a Strongly-Typed Statically Checked, Concurrent Language" Xerox PARC
83CSL 84-7). Doug McIlroy wrote a simpler fully conservative collector that
84was part of version 8 UNIX (tm), but appears to not have received
85widespread use.
86
87 Rudimentary tools for use of the collector as a leak detector are included
88(see http://www.hpl.hp.com/personal/Hans_Boehm/gc/leak.html),
89as is a fairly sophisticated string package "cord" that makes use of the
90collector. (See doc/README.cords and H.-J. Boehm, R. Atkinson, and M. Plass,
91"Ropes: An Alternative to Strings", Software Practice and Experience 25, 12
92(December 1995), pp. 1315-1330. This is very similar to the "rope" package
93in Xerox Cedar, or the "rope" package in the SGI STL or the g++ distribution.)
94
95Further collector documantation can be found at
96
97http://www.hpl.hp.com/personal/Hans_Boehm/gc
98
99
100GENERAL DESCRIPTION
101
102 This is a garbage collecting storage allocator that is intended to be
103used as a plug-in replacement for C's malloc.
104
105 Since the collector does not require pointers to be tagged, it does not
106attempt to ensure that all inaccessible storage is reclaimed. However,
107in our experience, it is typically more successful at reclaiming unused
108memory than most C programs using explicit deallocation. Unlike manually
109introduced leaks, the amount of unreclaimed memory typically stays
110bounded.
111
112 In the following, an "object" is defined to be a region of memory allocated
113by the routines described below.
114
115 Any objects not intended to be collected must be pointed to either
116from other such accessible objects, or from the registers,
117stack, data, or statically allocated bss segments. Pointers from
118the stack or registers may point to anywhere inside an object.
119The same is true for heap pointers if the collector is compiled with
120 ALL_INTERIOR_POINTERS defined, as is now the default.
121
122Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
123of garbage objects, by requiring pointers from the heap to to the beginning
124of an object. But this no longer appears to be a significant
125issue for most programs.
126
127There are a number of routines which modify the pointer recognition
128algorithm. GC_register_displacement allows certain interior pointers
129to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
130GC_malloc_ignore_off_page allows some pointers into the middle of large objects
131to be disregarded, greatly reducing the probablility of accidental
132retention of large objects. For most purposes it seems best to compile
133with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
134you get collector warnings from allocations of very large objects.
135See README.debugging for details.
136
137 WARNING: pointers inside memory allocated by the standard "malloc" are not
138seen by the garbage collector. Thus objects pointed to only from such a
139region may be prematurely deallocated. It is thus suggested that the
140standard "malloc" be used only for memory regions, such as I/O buffers, that
141are guaranteed not to contain pointers to garbage collectable memory.
142Pointers in C language automatic, static, or register variables,
143are correctly recognized. (Note that GC_malloc_uncollectable has semantics
144similar to standard malloc, but allocates objects that are traced by the
145collector.)
146
147 WARNING: the collector does not always know how to find pointers in data
148areas that are associated with dynamic libraries. This is easy to
149remedy IF you know how to find those data areas on your operating
150system (see GC_add_roots). Code for doing this under SunOS, IRIX 5.X and 6.X,
151HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default. (See
152README.win32 for win32 details.) On other systems pointers from dynamic
153library data areas may not be considered by the collector.
154If you're writing a program that depends on the collector scanning
155dynamic library data areas, it may be a good idea to include at least
156one call to GC_is_visible() to ensure that those areas are visible
157to the collector.
158
159 Note that the garbage collector does not need to be informed of shared
160read-only data. However if the shared library mechanism can introduce
161discontiguous data areas that may contain pointers, then the collector does
162need to be informed.
163
164 Signal processing for most signals may be deferred during collection,
165and during uninterruptible parts of the allocation process.
166Like standard ANSI C mallocs, by default it is unsafe to invoke
167malloc (and other GC routines) from a signal handler while another
168malloc call may be in progress. Removing -DNO_SIGNALS from Makefile
169attempts to remedy that. But that may not be reliable with a compiler that
170substantially reorders memory operations inside GC_malloc.
171
172 The allocator/collector can also be configured for thread-safe operation.
173(Full signal safety can also be achieved, but only at the cost of two system
174calls per malloc, which is usually unacceptable.)
175WARNING: the collector does not guarantee to scan thread-local storage
176(e.g. of the kind accessed with pthread_getspecific()). The collector
177does scan thread stacks, though, so generally the best solution is to
178ensure that any pointers stored in thread-local storage are also
179stored on the thread's stack for the duration of their lifetime.
180(This is arguably a longstanding bug, but it hasn't been fixed yet.)
181
182INSTALLATION AND PORTABILITY
183
184 As distributed, the macro SILENT is defined in Makefile.
185In the event of problems, this can be removed to obtain a moderate
186amount of descriptive output for each collection.
187(The given statistics exhibit a few peculiarities.
188Things don't appear to add up for a variety of reasons, most notably
189fragmentation losses. These are probably much more significant for the
190contrived program "test.c" than for your application.)
191
192 Note that typing "make test" will automatically build the collector
193and then run setjmp_test and gctest. Setjmp_test will give you information
194about configuring the collector, which is useful primarily if you have
195a machine that's not already supported. Gctest is a somewhat superficial
196test of collector functionality. Failure is indicated by a core dump or
197a message to the effect that the collector is broken. Gctest takes about
19835 seconds to run on a SPARCstation 2. It may use up to 8 MB of memory. (The
199multi-threaded version will use more. 64-bit versions may use more.)
200"Make test" will also, as its last step, attempt to build and test the
201"cord" string library. This will fail without an ANSI C compiler, but
202the garbage collector itself should still be usable.
203
204 The Makefile will generate a library gc.a which you should link against.
205Typing "make cords" will add the cord library to gc.a.
206Note that this requires an ANSI C compiler.
207
208 It is suggested that if you need to replace a piece of the collector
209(e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
210ld command line, rather than replacing the one in gc.a. (This will
211generate numerous warnings under some versions of AIX, but it still
212works.)
213
214 All include files that need to be used by clients will be put in the
215include subdirectory. (Normally this is just gc.h. "Make cords" adds
216"cord.h" and "ec.h".)
217
218 The collector currently is designed to run essentially unmodified on
219machines that use a flat 32-bit or 64-bit address space.
220That includes the vast majority of Workstations and X86 (X >= 3) PCs.
221(The list here was deleted because it was getting too long and constantly
222out of date.)
223 It does NOT run under plain 16-bit DOS or Windows 3.X. There are however
224various packages (e.g. win32s, djgpp) that allow flat 32-bit address
225applications to run under those systemsif the have at least an 80386 processor,
226and several of those are compatible with the collector.
227
228 In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
229or equivalent is supplied. Many of these have separate README.system
230files.
231
232 Dynamic libraries are completely supported only under SunOS/Solaris,
233(and even that support is not functional on the last Sun 3 release),
234Linux, FreeBSD, NetBSD, IRIX 5&6, HP/UX, Win32 (not Win32S) and OSF/1
235on DEC AXP machines plus perhaps a few others listed near the top
236of dyn_load.c. On other machines we recommend that you do one of
237the following:
238
239 1) Add dynamic library support (and send us the code).
240 2) Use static versions of the libraries.
241 3) Arrange for dynamic libraries to use the standard malloc.
242 This is still dangerous if the library stores a pointer to a
243 garbage collected object. But nearly all standard interfaces
244 prohibit this, because they deal correctly with pointers
245 to stack allocated objects. (Strtok is an exception. Don't
246 use it.)
247
248 In all cases we assume that pointer alignment is consistent with that
249enforced by the standard C compilers. If you use a nonstandard compiler
250you may have to adjust the alignment parameters defined in gc_priv.h.
251Note that this may also be an issue with packed records/structs, if those
252enforce less alignment for pointers.
253
254 A port to a machine that is not byte addressed, or does not use 32 bit
255or 64 bit addresses will require a major effort. A port to plain MSDOS
256or win16 is hard.
257
258 For machines not already mentioned, or for nonstandard compilers, the
259following are likely to require change:
260
2611. The parameters in gcconfig.h.
262 The parameters that will usually require adjustment are
263 STACKBOTTOM, ALIGNMENT and DATASTART. Setjmp_test
264 prints its guesses of the first two.
265 DATASTART should be an expression for computing the
266 address of the beginning of the data segment. This can often be
267 &etext. But some memory management units require that there be
268 some unmapped space between the text and the data segment. Thus
269 it may be more complicated. On UNIX systems, this is rarely
270 documented. But the adb "$m" command may be helpful. (Note
271 that DATASTART will usually be a function of &etext. Thus a
272 single experiment is usually insufficient.)
273 STACKBOTTOM is used to initialize GC_stackbottom, which
274 should be a sufficient approximation to the coldest stack address.
275 On some machines, it is difficult to obtain such a value that is
276 valid across a variety of MMUs, OS releases, etc. A number of
277 alternatives exist for using the collector in spite of this. See the
278 discussion in gcconfig.h immediately preceding the various
279 definitions of STACKBOTTOM.
280
2812. mach_dep.c.
282 The most important routine here is one to mark from registers.
283 The distributed file includes a generic hack (based on setjmp) that
284 happens to work on many machines, and may work on yours. Try
285 compiling and running setjmp_t.c to see whether it has a chance of
286 working. (This is not correct C, so don't blame your compiler if it
287 doesn't work. Based on limited experience, register window machines
288 are likely to cause trouble. If your version of setjmp claims that
289 all accessible variables, including registers, have the value they
290 had at the time of the longjmp, it also will not work. Vanilla 4.2 BSD
291 on Vaxen makes such a claim. SunOS does not.)
292 If your compiler does not allow in-line assembly code, or if you prefer
293 not to use such a facility, mach_dep.c may be replaced by a .s file
294 (as we did for the MIPS machine and the PC/RT).
295 At this point enough architectures are supported by mach_dep.c
296 that you will rarely need to do more than adjust for assembler
297 syntax.
298
2993. os_dep.c (and gc_priv.h).
300 Several kinds of operating system dependent routines reside here.
301 Many are optional. Several are invoked only through corresponding
302 macros in gc_priv.h, which may also be redefined as appropriate.
303 The routine GC_register_data_segments is crucial. It registers static
304 data areas that must be traversed by the collector. (User calls to
305 GC_add_roots may sometimes be used for similar effect.)
306 Routines to obtain memory from the OS also reside here.
307 Alternatively this can be done entirely by the macro GET_MEM
308 defined in gc_priv.h. Routines to disable and reenable signals
309 also reside here if they are need by the macros DISABLE_SIGNALS
310 and ENABLE_SIGNALS defined in gc_priv.h.
311 In a multithreaded environment, the macros LOCK and UNLOCK
312 in gc_priv.h will need to be suitably redefined.
313 The incremental collector requires page dirty information, which
314 is acquired through routines defined in os_dep.c. Unless directed
315 otherwise by gcconfig.h, these are implemented as stubs that simply
316 treat all pages as dirty. (This of course makes the incremental
317 collector much less useful.)
318
3194. dyn_load.c
320 This provides a routine that allows the collector to scan data
321 segments associated with dynamic libraries. Often it is not
322 necessary to provide this routine unless user-written dynamic
323 libraries are used.
324
325 For a different version of UN*X or different machines using the
326Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
327it should frequently suffice to change definitions in gcconfig.h.
328
329
330THE C INTERFACE TO THE ALLOCATOR
331
332 The following routines are intended to be directly called by the user.
333Note that usually only GC_malloc is necessary. GC_clear_roots and GC_add_roots
334calls may be required if the collector has to trace from nonstandard places
335(e.g. from dynamic library data areas on a machine on which the
336collector doesn't already understand them.) On some machines, it may
337be desirable to set GC_stacktop to a good approximation of the stack base.
338(This enhances code portability on HP PA machines, since there is no
339good way for the collector to compute this value.) Client code may include
340"gc.h", which defines all of the following, plus many others.
341
3421) GC_malloc(nbytes)
343 - allocate an object of size nbytes. Unlike malloc, the object is
344 cleared before being returned to the user. Gc_malloc will
345 invoke the garbage collector when it determines this to be appropriate.
346 GC_malloc may return 0 if it is unable to acquire sufficient
347 space from the operating system. This is the most probable
348 consequence of running out of space. Other possible consequences
349 are that a function call will fail due to lack of stack space,
350 or that the collector will fail in other ways because it cannot
351 maintain its internal data structures, or that a crucial system
352 process will fail and take down the machine. Most of these
353 possibilities are independent of the malloc implementation.
354
3552) GC_malloc_atomic(nbytes)
356 - allocate an object of size nbytes that is guaranteed not to contain any
357 pointers. The returned object is not guaranteed to be cleared.
358 (Can always be replaced by GC_malloc, but results in faster collection
359 times. The collector will probably run faster if large character
360 arrays, etc. are allocated with GC_malloc_atomic than if they are
361 statically allocated.)
362
3633) GC_realloc(object, new_size)
364 - change the size of object to be new_size. Returns a pointer to the
365 new object, which may, or may not, be the same as the pointer to
366 the old object. The new object is taken to be atomic iff the old one
367 was. If the new object is composite and larger than the original object,
368 then the newly added bytes are cleared (we hope). This is very likely
369 to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
370 Even then, it is likely to recycle the old object only if the object
371 is grown in small additive increments (which, we claim, is generally bad
372 coding practice.)
373
3744) GC_free(object)
375 - explicitly deallocate an object returned by GC_malloc or
376 GC_malloc_atomic. Not necessary, but can be used to minimize
377 collections if performance is critical. Probably a performance
378 loss for very small objects (<= 8 bytes).
379
3805) GC_expand_hp(bytes)
381 - Explicitly increase the heap size. (This is normally done automatically
382 if a garbage collection failed to GC_reclaim enough memory. Explicit
383 calls to GC_expand_hp may prevent unnecessarily frequent collections at
384 program startup.)
385
3866) GC_malloc_ignore_off_page(bytes)
387 - identical to GC_malloc, but the client promises to keep a pointer to
388 the somewhere within the first 256 bytes of the object while it is
389 live. (This pointer should nortmally be declared volatile to prevent
390 interference from compiler optimizations.) This is the recommended
391 way to allocate anything that is likely to be larger than 100Kbytes
392 or so. (GC_malloc may result in failure to reclaim such objects.)
393
3947) GC_set_warn_proc(proc)
395 - Can be used to redirect warnings from the collector. Such warnings
396 should be rare, and should not be ignored during code development.
397
3988) GC_enable_incremental()
399 - Enables generational and incremental collection. Useful for large
400 heaps on machines that provide access to page dirty information.
401 Some dirty bit implementations may interfere with debugging
402 (by catching address faults) and place restrictions on heap arguments
403 to system calls (since write faults inside a system call may not be
404 handled well).
405
4069) Several routines to allow for registration of finalization code.
407 User supplied finalization code may be invoked when an object becomes
408 unreachable. To call (*f)(obj, x) when obj becomes inaccessible, use
409 GC_register_finalizer(obj, f, x, 0, 0);
410 For more sophisticated uses, and for finalization ordering issues,
411 see gc.h.
412
413 The global variable GC_free_space_divisor may be adjusted up from its
414default value of 4 to use less space and more collection time, or down for
415the opposite effect. Setting it to 1 or 0 will effectively disable collections
416and cause all allocations to simply grow the heap.
417
418 The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
419the amount of memory allocated by the above routines that should not be
420considered as a candidate for collection. Careless use may, of course, result
421in excessive memory consumption.
422
423 Some additional tuning is possible through the parameters defined
424near the top of gc_priv.h.
425
426 If only GC_malloc is intended to be used, it might be appropriate to define:
427
428#define malloc(n) GC_malloc(n)
429#define calloc(m,n) GC_malloc((m)*(n))
430
431 For small pieces of VERY allocation intensive code, gc_inl.h
432includes some allocation macros that may be used in place of GC_malloc
433and friends.
434
435 All externally visible names in the garbage collector start with "GC_".
436To avoid name conflicts, client code should avoid this prefix, except when
437accessing garbage collector routines or variables.
438
439 There are provisions for allocation with explicit type information.
440This is rarely necessary. Details can be found in gc_typed.h.
441
442THE C++ INTERFACE TO THE ALLOCATOR:
443
444 The Ellis-Hull C++ interface to the collector is included in
445the collector distribution. If you intend to use this, type
446"make c++" after the initial build of the collector is complete.
447See gc_cpp.h for the definition of the interface. This interface
448tries to approximate the Ellis-Detlefs C++ garbage collection
449proposal without compiler changes.
450
451Cautions:
4521. Arrays allocated without new placement syntax are
453allocated as uncollectable objects. They are traced by the
454collector, but will not be reclaimed.
455
4562. Failure to use "make c++" in combination with (1) will
457result in arrays allocated using the default new operator.
458This is likely to result in disaster without linker warnings.
459
4603. If your compiler supports an overloaded new[] operator,
461then gc_cpp.cc and gc_cpp.h should be suitably modified.
462
4634. Many current C++ compilers have deficiencies that
464break some of the functionality. See the comments in gc_cpp.h
465for suggested workarounds.
466
467USE AS LEAK DETECTOR:
468
469 The collector may be used to track down leaks in C programs that are
470intended to run with malloc/free (e.g. code with extreme real-time or
471portability constraints). To do so define FIND_LEAK in Makefile
472This will cause the collector to invoke the report_leak
473routine defined near the top of reclaim.c whenever an inaccessible
474object is found that has not been explicitly freed. Such objects will
475also be automatically reclaimed.
476 Productive use of this facility normally involves redefining report_leak
477to do something more intelligent. This typically requires annotating
478objects with additional information (e.g. creation time stack trace) that
479identifies their origin. Such code is typically not very portable, and is
480not included here, except on SPARC machines.
481 If all objects are allocated with GC_DEBUG_MALLOC (see next section),
482then the default version of report_leak will report the source file
483and line number at which the leaked object was allocated. This may
484sometimes be sufficient. (On SPARC/SUNOS4 machines, it will also report
485a cryptic stack trace. This can often be turned into a sympolic stack
486trace by invoking program "foo" with "callprocs foo". Callprocs is
487a short shell script that invokes adb to expand program counter values
488to symbolic addresses. It was largely supplied by Scott Schwartz.)
489 Note that the debugging facilities described in the next section can
490sometimes be slightly LESS effective in leak finding mode, since in
491leak finding mode, GC_debug_free actually results in reuse of the object.
492(Otherwise the object is simply marked invalid.) Also note that the test
493program is not designed to run meaningfully in FIND_LEAK mode.
494Use "make gc.a" to build the collector.
495
496DEBUGGING FACILITIES:
497
498 The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
499and GC_debug_free provide an alternate interface to the collector, which
500provides some help with memory overwrite errors, and the like.
501Objects allocated in this way are annotated with additional
502information. Some of this information is checked during garbage
503collections, and detected inconsistencies are reported to stderr.
504
505 Simple cases of writing past the end of an allocated object should
506be caught if the object is explicitly deallocated, or if the
507collector is invoked while the object is live. The first deallocation
508of an object will clear the debugging info associated with an
509object, so accidentally repeated calls to GC_debug_free will report the
510deallocation of an object without debugging information. Out of
511memory errors will be reported to stderr, in addition to returning
512NIL.
513
514 GC_debug_malloc checking during garbage collection is enabled
515with the first call to GC_debug_malloc. This will result in some
516slowdown during collections. If frequent heap checks are desired,
517this can be achieved by explicitly invoking GC_gcollect, e.g. from
518the debugger.
519
520 GC_debug_malloc allocated objects should not be passed to GC_realloc
521or GC_free, and conversely. It is however acceptable to allocate only
522some objects with GC_debug_malloc, and to use GC_malloc for other objects,
523provided the two pools are kept distinct. In this case, there is a very
524low probablility that GC_malloc allocated objects may be misidentified as
525having been overwritten. This should happen with probability at most
526one in 2**32. This probability is zero if GC_debug_malloc is never called.
527
528 GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
529additional trailing arguments, a string and an integer. These are not
530interpreted by the allocator. They are stored in the object (the string is
531not copied). If an error involving the object is detected, they are printed.
532
533 The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
534GC_REGISTER_FINALIZER are also provided. These require the same arguments
535as the corresponding (nondebugging) routines. If gc.h is included
536with GC_DEBUG defined, they call the debugging versions of these
537functions, passing the current file name and line number as the two
538extra arguments, where appropriate. If gc.h is included without GC_DEBUG
539defined, then all these macros will instead be defined to their nondebugging
540equivalents. (GC_REGISTER_FINALIZER is necessary, since pointers to
541objects with debugging information are really pointers to a displacement
542of 16 bytes form the object beginning, and some translation is necessary
543when finalization routines are invoked. For details, about what's stored
544in the header, see the definition of the type oh in debug_malloc.c)
545
546INCREMENTAL/GENERATIONAL COLLECTION:
547
548The collector normally interrupts client code for the duration of
549a garbage collection mark phase. This may be unacceptable if interactive
550response is needed for programs with large heaps. The collector
551can also run in a "generational" mode, in which it usually attempts to
552collect only objects allocated since the last garbage collection.
553Furthermore, in this mode, garbage collections run mostly incrementally,
554with a small amount of work performed in response to each of a large number of
555GC_malloc requests.
556
557This mode is enabled by a call to GC_enable_incremental().
558
559Incremental and generational collection is effective in reducing
560pause times only if the collector has some way to tell which objects
561or pages have been recently modified. The collector uses two sources
562of information:
563
5641. Information provided by the VM system. This may be provided in
565one of several forms. Under Solaris 2.X (and potentially under other
566similar systems) information on dirty pages can be read from the
567/proc file system. Under other systems (currently SunOS4.X) it is
568possible to write-protect the heap, and catch the resulting faults.
569On these systems we require that system calls writing to the heap
570(other than read) be handled specially by client code.
571See os_dep.c for details.
572
5732. Information supplied by the programmer. We define "stubborn"
574objects to be objects that are rarely changed. Such an object
575can be allocated (and enabled for writing) with GC_malloc_stubborn.
576Once it has been initialized, the collector should be informed with
577a call to GC_end_stubborn_change. Subsequent writes that store
578pointers into the object must be preceded by a call to
579GC_change_stubborn.
580
581This mechanism performs best for objects that are written only for
582initialization, and such that only one stubborn object is writable
583at once. It is typically not worth using for short-lived
584objects. Stubborn objects are treated less efficiently than pointerfree
585(atomic) objects.
586
587A rough rule of thumb is that, in the absence of VM information, garbage
588collection pauses are proportional to the amount of pointerful storage
589plus the amount of modified "stubborn" storage that is reachable during
590the collection.
591
592Initial allocation of stubborn objects takes longer than allocation
593of other objects, since other data structures need to be maintained.
594
595We recommend against random use of stubborn objects in client
596code, since bugs caused by inappropriate writes to stubborn objects
597are likely to be very infrequently observed and hard to trace.
598However, their use may be appropriate in a few carefully written
599library routines that do not make the objects themselves available
600for writing by client code.
601
602
603BUGS:
604
605 Any memory that does not have a recognizable pointer to it will be
606reclaimed. Exclusive-or'ing forward and backward links in a list
607doesn't cut it.
608 Some C optimizers may lose the last undisguised pointer to a memory
609object as a consequence of clever optimizations. This has almost
610never been observed in practice. Send mail to boehm@acm.org
611for suggestions on how to fix your compiler.
612 This is not a real-time collector. In the standard configuration,
613percentage of time required for collection should be constant across
614heap sizes. But collection pauses will increase for larger heaps.
615(On SPARCstation 2s collection times will be on the order of 300 msecs
616per MB of accessible memory that needs to be scanned. Your mileage
617may vary.) The incremental/generational collection facility helps,
618but is portable only if "stubborn" allocation is used.
619 Please address bug reports to boehm@acm.org. If you are
620contemplating a major addition, you might also send mail to ask whether
621it's already been done (or whether we tried and discarded it).
622
diff --git a/gc/doc/README.DGUX386 b/gc/doc/README.DGUX386
deleted file mode 100644
index 9d6d84788ef..00000000000
--- a/gc/doc/README.DGUX386
+++ /dev/null
@@ -1,215 +0,0 @@
1 Garbage Collector (parallel iversion) for ix86 DG/UX Release R4.20MU07
2
3
4 *READ* the file README.QUICK.
5
6 You need the GCC-3.0.3 rev (DG/UX) compiler to build this tree.
7 This compiler has the new "dgux386" threads package implemented.
8 It also supports the switch "-pthread" needed to link correctly
9 the DG/UX's -lrte -lthread with -lgcc and the system's -lc.
10 Finally we support parralleli-mark for the SMP DG/UX machines.
11 To build the garbage collector do:
12
13 ./configure --enable-parallel-mark
14 make
15 make gctest
16
17 Before you run "gctest" you need to set your LD_LIBRARY_PATH
18 correctly so that "gctest" can find the shared library libgc.
19 Alternatively you can do a configuration
20
21 ./configure --enable-parallel-mark --disable-shared
22
23 to build only the static version of libgc.
24
25 To enable debugging messages please do:
26 1) Add the "--enable-full-debug" flag during configuration.
27 2) Edit the file linux-threads.c and uncommnect the line:
28
29 /* #define DEBUG_THREADS 1 */ to --->
30
31 #define DEBUG_THREADS 1
32
33 Then give "make" as usual.
34
35 In a machine with 4 CPUs (my own machine) the option parallel
36 mark (aka --enable-parallel-mark) makes a BIG difference.
37
38 Takis Psarogiannakopoulos
39 University of Cambridge
40 Centre for Mathematical Sciences
41 Department of Pure Mathematics
42 Wilberforce Road
43 Cambridge CB3 0WB ,UK , <takis@XFree86.Org>
44 January 2002
45
46
47Note (HB):
48 The integration of this patch is currently not complete.
49 The following patches against 6.1alpha3 where hard to move
50 to alpha4, and are not integrated. There may also be minor
51 problems with stylistic corrections made by me.
52
53
54--- ltconfig.ORIG Mon Jan 28 20:22:18 2002
55+++ ltconfig Mon Jan 28 20:44:00 2002
56@@ -689,6 +689,11 @@
57 pic_flag=-Kconform_pic
58 fi
59 ;;
60+ dgux*)
61+ pic_flag='-fPIC'
62+ link_static='-Bstatic'
63+ wl='-Wl,'
64+ ;;
65 *)
66 pic_flag='-fPIC'
67 ;;
68@@ -718,6 +723,12 @@
69 # We can build DLLs from non-PIC.
70 ;;
71
72+ dgux*)
73+ pic_flag='-KPIC'
74+ link_static='-Bstatic'
75+ wl='-Wl,'
76+ ;;
77+
78 osf3* | osf4* | osf5*)
79 # All OSF/1 code is PIC.
80 wl='-Wl,'
81@@ -1154,6 +1165,22 @@
82 fi
83 ;;
84
85+ dgux*)
86+ ld_shlibs=yes
87+ # For both C/C++ ommit the deplibs. This is because we relying on the fact
88+ # that compilation of execitables will put them in correct order
89+ # in any case and sometimes are wrong when listed as deplibs (or missing some deplibs)
90+ # However when GNU ld and --whole-archive needs to be used we have the problem
91+ # that if the -fPIC *_s.a archive is linked through deplibs list we ommiting crucial
92+ # .lo/.o files from the created shared lib. This I think is not the case here.
93+ archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts'
94+ thread_safe_flag_spec='-pthread'
95+ wlarc=
96+ hardcode_libdir_flag_spec='-L$libdir'
97+ hardcode_shlibpath_var=no
98+ ac_cv_archive_cmds_needs_lc=no
99+ ;;
100+
101 cygwin* | mingw*)
102 # hardcode_libdir_flag_spec is actually meaningless, as there is
103 # no search path for DLLs.
104@@ -1497,7 +1524,7 @@
105 ;;
106
107 dgux*)
108- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
109+ archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts'
110 hardcode_libdir_flag_spec='-L$libdir'
111 hardcode_shlibpath_var=no
112 ;;
113@@ -2092,12 +2119,17 @@
114 ;;
115
116 dgux*)
117- version_type=linux
118+ version_type=dgux
119 need_lib_prefix=no
120 need_version=no
121- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
122- soname_spec='${libname}${release}.so$major'
123+ library_names_spec='$libname.so$versuffix'
124+ soname_spec='$libname.so$versuffix'
125 shlibpath_var=LD_LIBRARY_PATH
126+ thread_safe_flag_spec='-pthread'
127+ wlarc=
128+ hardcode_libdir_flag_spec='-L$libdir'
129+ hardcode_shlibpath_var=no
130+ ac_cv_archive_cmds_needs_lc=no
131 ;;
132
133 sysv4*MP*)
134
135
136--- ltmain.sh.ORIG Mon Jan 28 20:31:18 2002
137+++ ltmain.sh Tue Jan 29 00:11:29 2002
138@@ -1072,11 +1072,38 @@
139 esac
140 ;;
141
142+ -thread*)
143+ # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread
144+ # with the switch -threads
145+ if test "$arg" = "-threads"; then
146+ case "$host" in
147+ i[3456]86-*-dgux*)
148+ deplibs="$deplibs $arg"
149+ continue
150+ ;;
151+ esac
152+ fi
153+ ;;
154+
155+ -pthread*)
156+ # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread
157+ # with the switch -pthread
158+ if test "$arg" = "-pthread"; then
159+ case "$host" in
160+ i[3456]86-*-dgux*)
161+ deplibs="$deplibs $arg"
162+ continue
163+ ;;
164+ esac
165+ fi
166+ ;;
167+
168 -l*)
169 if test "$arg" = "-lc"; then
170 case "$host" in
171- *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
172+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*)
173 # These systems don't actually have c library (as such)
174+ # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs
175 continue
176 ;;
177 esac
178@@ -1248,6 +1275,12 @@
179 temp_deplibs=
180 for deplib in $dependency_libs; do
181 case "$deplib" in
182+ -thread*)
183+ temp_deplibs="$temp_deplibs $deplib"
184+ ;;
185+ -pthread)
186+ temp_deplibs="$temp_deplibs $deplib"
187+ ;;
188 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
189 case " $rpath $xrpath " in
190 *" $temp_xrpath "*) ;;
191@@ -1709,6 +1742,13 @@
192 done
193 ;;
194
195+ dgux)
196+ # Leave mostly blank for DG/UX
197+ major=
198+ versuffix=".$current.$revision";
199+ verstring=
200+ ;;
201+
202 linux)
203 major=.`expr $current - $age`
204 versuffix="$major.$age.$revision"
205@@ -1792,8 +1832,9 @@
206
207 dependency_libs="$deplibs"
208 case "$host" in
209- *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
210+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*)
211 # these systems don't actually have a c library (as such)!
212+ # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs
213 ;;
214 *)
215 # Add libc to deplibs on all other systems.
diff --git a/gc/doc/README.Mac b/gc/doc/README.Mac
deleted file mode 100644
index 04f468251a1..00000000000
--- a/gc/doc/README.Mac
+++ /dev/null
@@ -1,385 +0,0 @@
1Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2:
2----------------------------------------------------------------------------
3The current build environment for the collector is CodeWarrior Pro 2.
4Projects for CodeWarrior Pro 2 (and for quite a few older versions)
5are distributed in the file Mac_projects.sit.hqx. The project file
6:Mac_projects:gc.prj builds static library versions of the collector.
7:Mac_projects:gctest.prj builds the GC test suite.
8
9Configuring the collector is still done by editing the files
10:Mac_files:MacOS_config.h and :Mac_files:MacOS_Test_config.h.
11
12Lars Farm's suggestions on building the collector:
13----------------------------------------------------------------------------
14Garbage Collection on MacOS - a manual 'MakeFile'
15-------------------------------------------------
16
17Project files and IDE's are great on the Macintosh, but they do have
18problems when used as distribution media. This note tries to provide
19porting instructions in pure TEXT form to avoid those problems. A manual
20'makefile' if you like.
21
22 GC version: 4.12a2
23 Codewarrior: CWPro1
24 date: 18 July 1997
25
26The notes may or may not apply to earlier or later versions of the
27GC/CWPro. Actually, they do apply to earlier versions of both except that
28until recently a project could only build one target so each target was a
29separate project. The notes will most likely apply to future versions too.
30Possibly with minor tweaks.
31
32This is just to record my experiences. These notes do not mean I now
33provide a supported port of the GC to MacOS. It works for me. If it works
34for you, great. If it doesn't, sorry, try again...;-) Still, if you find
35errors, please let me know.
36
37 mailto: lars.farm@ite.mh.se
38
39 address: Lars Farm
40 Krönvägen 33b
41 856 44 Sundsvall
42 Sweden
43
44Porting to MacOS is a bit more complex than it first seems. Which MacOS?
4568K/PowerPC? Which compiler? Each supports both 68K and PowerPC and offer a
46large number of (unique to each environment) compiler settings. Each
47combination of compiler/68K/PPC/settings require a unique combination of
48standard libraries. And the IDE's does not select them for you. They don't
49even check that the library is built with compatible setting and this is
50the major source of problems when porting the GC (and otherwise too).
51
52You will have to make choices when you configure the GC. I've made some
53choices here, but there are other combinations of settings and #defines
54that work too.
55
56As for target settings the major obstacles may be:
57- 68K Processor: check "4-byte Ints".
58- PPC Processor: uncheck "Store Static Data in TOC".
59
60What you need to do:
61===================
62
631) Build the GC as a library
642) Test that the library works with 'test.c'.
653) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
66
671) The Libraries:
68=================
69I made one project with four targets (68K/PPC tempmem or appheap). One target
70will suffice if you're able to decide which one you want. I wasn't...
71
72Codewarrior allows a large number of compiler/linker settings. I used these:
73
74Settings shared by all targets:
75------------------------------
76o Access Paths:
77 - User Paths: the GC folder
78 - System Paths: {Compiler}:Metrowerks Standard Library:
79 {Compiler}:MacOS Support:Headers:
80 {Compiler}:MacOS Support:MacHeaders:
81o C/C++ language:
82 - inlining: normal
83 - direct to SOM: off
84 - enable/check: exceptions, RTTI, bool (and if you like pool strings)
85
86PowerPC target settings
87-----------------------
88o Target Settings:
89 - name of target
90 - MacOS PPC Linker
91o PPC Target
92 - name of library
93o C/C++ language
94 - prefix file as described below
95o PPC Processor
96 - Struct Alignment: PowerPC
97 - uncheck "Store Static Data in TOC" -- important!
98 I don't think the others matter, I use full optimization and its ok
99o PPC Linker
100 - Factory Settings (SYM file with full paths, faster linking, dead-strip
101 static init, Main: __start)
102
103
10468K target settings
105-------------------
106o Target Settings:
107 - name of target
108 - MacOS 68K Linker
109o 68K Target
110 - name of library
111 - A5 relative data
112o C/C++ language
113 - prefix file as described below
114o 68K Processor
115 - Code model: smart
116 - Struct alignment: 68K
117 - FP: SANE
118 - enable 4-Byte Ints -- important!
119 I don't think the others matter. I selected...
120 - enable: 68020
121 - enable: global register allocation
122o IR Optimizer
123 - enable: Optimize Space, Optimize Speed
124 I suppose the others would work too, but haven't tried...
125o 68K Linker
126 - Factory Settings (New Style MacsBug,SYM file with full paths,
127 A6 Frames, fast link, Merge compiler glue into segment 1,
128 dead-strip static init)
129
130Prefix Files to configure the GC sources
131----------------------------------------
132The Codewarrior equivalent of commandline compilers -DNAME=X is to use
133prefix-files. A TEXT file that is automatically #included before the first byte
134of every source file. I used these:
135
136---- ( cut here ) ---- gc_prefix_tempmem.h -- 68K and PPC -----
137 #include "gc_prefix_common.h"
138 #undef USE_TEMPORARY_MEMORY
139 #define USE_TEMPORARY_MEMORY
140---- ( cut here ) ---- gc_prefix_appmem.h -- 68K and PPC -----
141 #include "gc_prefix_common.h"
142 #undef USE_TEMPORARY_MEMORY
143// #define USE_TEMPORARY_MEMORY
144
145---- ( cut here ) ---- gc_prefix_common.h --------------------
146// gc_prefix_common.h
147// ------------------
148// Codewarrior prefix file to configure the GC libraries
149//
150// prefix files are the Codewarrior equivalent of the
151// command line option -Dname=x frequently seen in makefiles
152
153#if !__MWERKS__
154 #error only tried this with Codewarrior
155#endif
156
157#if macintosh
158 #define MSL_USE_PRECOMPILED_HEADERS 0
159 #include <ansi_prefix.mac.h>
160 #ifndef __STDC__
161 #define __STDC__ 0
162 #endif
163
164 // See list of #defines to configure the library in: 'MakeFile'
165 // see also README
166
167 #define SILENT // no collection messages. In case
168 // of trouble you might want this off
169 #define ALL_INTERIOR_POINTERS // follows interior pointers.
170//#define DONT_ADD_BYTE_AT_END // disables the padding if defined.
171//#define SMALL_CONFIG // whether to use a smaller heap.
172 #define NO_SIGNALS // signals aren't real on the Macintosh.
173 #define ATOMIC_UNCOLLECTABLE // GC_malloc_atomic_uncollectable()
174
175 // define either or none as per personal preference
176 // used in malloc.c
177 #define REDIRECT_MALLOC GC_malloc
178//#define REDIRECT_MALLOC GC_malloc_uncollectable
179 // if REDIRECT_MALLOC is #defined make sure that the GC library
180 // is listed before the ANSI/ISO libs in the Codewarrior
181 // 'Link order' panel
182//#define IGNORE_FREE
183
184 // mac specific configs
185//#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
186//#define SHARED_LIBRARY_BUILD // build for use in a shared library.
187
188#else
189 // could build Win32 here too, or in the future
190 // Rhapsody PPC-mach, Rhapsody PPC-MacOS,
191 // Rhapsody Intel-mach, Rhapsody Intel-Win32,...
192 // ... ugh this will get messy ...
193#endif
194
195// make sure ints are at least 32-bit
196// ( could be set to 16-bit by compiler settings (68K) )
197
198struct gc_private_assert_intsize_{ char x[ sizeof(int)>=4 ? 1 : 0 ]; };
199
200#if __powerc
201 #if __option(toc_data)
202 #error turn off "store static data in TOC" when using GC
203 // ... or find a way to add TOC to the root set...(?)
204 #endif
205#endif
206---- ( cut here ) ---- end of gc_prefix_common.h -----------------
207
208Files to build the GC libraries:
209--------------------------------
210 allchblk.c
211 alloc.c
212 blacklst.c
213 checksums.c
214 dbg_mlc.c
215 finalize.c
216 headers.c
217 mach_dep.c
218 MacOS.c -- contains MacOS code
219 malloc.c
220 mallocx.c
221 mark.c
222 mark_rts.c
223 misc.c
224 new_hblk.c
225 obj_map.c
226 os_dep.c -- contains MacOS code
227 ptr_chck.c
228 reclaim.c
229 stubborn.c
230 typd_mlc.c
231 gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and
232 -- throw std::bad_alloc when out of memory
233 -- gc_cpp.cc works just fine too
234
2352) Test that the library works with 'test.c'.
236=============================================
237
238The test app is just an ordinary ANSI-C console app. Make sure settings
239match the library you're testing.
240
241Files
242-----
243 test.c
244 the GC library to test -- link order before ANSI libs
245 suitable Mac+ANSI libraries
246
247prefix:
248------
249---- ( cut here ) ---- gc_prefix_testlib.h -- all libs -----
250#define MSL_USE_PRECOMPILED_HEADERS 0
251#include <ansi_prefix.mac.h>
252#undef NDEBUG
253
254#define ALL_INTERIOR_POINTERS /* for GC_priv.h */
255---- ( cut here ) ----
256
2573) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
258
259The test app is just an ordinary ANSI-C console app. Make sure settings match
260the library you're testing.
261
262Files
263-----
264 test_cpp.cc
265 the GC library to test -- link order before ANSI libs
266 suitable Mac+ANSI libraries
267
268prefix:
269------
270same as for test.c
271
272For convenience I used one test-project with several targets so that all
273test apps are build at once. Two for each library to test: test.c and
274gc_app.cc. When I was satisfied that the libraries were ok. I put the
275libraries + gc.h + the c++ interface-file in a folder that I then put into
276the MSL hierarchy so that I don't have to alter access-paths in projects
277that use the GC.
278
279After that, just add the proper GC library to your project and the GC is in
280action! malloc will call GC_malloc and free GC_free, new/delete too. You
281don't have to call free or delete. You may have to be a bit cautious about
282delete if you're freeing other resources than RAM. See gc_cpp.h. You can
283also keep coding as always with delete/free. That works too. If you want,
284"include <gc.h> and tweak it's use a bit.
285
286Symantec SPM
287============
288It has been a while since I tried the GC in SPM, but I think that the above
289instructions should be sufficient to guide you through in SPM too. SPM
290needs to know where the global data is. Use the files 'datastart.c' and
291'dataend.c'. Put 'datastart.c' at the top of your project and 'dataend.c'
292at the bottom of your project so that all data is surrounded. This is not
293needed in Codewarrior because it provides intrinsic variables
294__datastart__, __data_end__ that wraps all globals.
295
296Source Changes (GC 4.12a2)
297==========================
298Very few. Just one tiny in the GC, not strictly needed.
299- MacOS.c line 131 in routine GC_MacFreeTemporaryMemory()
300 change # if !defined(SHARED_LIBRARY_BUILD)
301 to # if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD)
302 To turn off a message when the application quits (actually, I faked
303 this change by #defining SHARED_LIBRARY_BUILD in a statically linked
304 library for more than a year without ill effects but perhaps this is
305 better).
306
307- test_cpp.cc
308 made the first lines of main() look like this:
309 ------------
310 int main( int argc, char* argv[] ) {
311 #endif
312 #if macintosh // MacOS
313 char* argv_[] = {"test_cpp","10"}; // doesn't
314 argv=argv_; // have a
315 argc = sizeof(argv_)/sizeof(argv_[0]); // commandline
316 #endif //
317
318 int i, iters, n;
319 # ifndef __GNUC__
320 alloc dummy_to_fool_the_compiler_into_doing_things_it_currently_cant_handle;
321 ------------
322
323- config.h [now gcconfig.h]
324 __MWERKS__ does not have to mean MACOS. You can use Codewarrior to
325 build a Win32 or BeOS library and soon a Rhapsody library. You may
326 have to change that #if...
327
328
329
330 It worked for me, hope it works for you.
331
332 Lars Farm
333 18 July 1997
334----------------------------------------------------------------------------
335
336
337Patrick Beard's instructions (may be dated):
338
339v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and
340Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided
341to build and test the collector under both development systems.
342
343Configuration
344-------------
345
346To configure the collector, under both development systems, a prefix file
347is used to set preprocessor directives. This file is called "MacOS_config.h".
348Also to test the collector, "MacOS_Test_config.h" is provided.
349
350Testing
351-------
352
353To test the collector (always a good idea), build one of the gctest projects,
354gctest.¹ (Symantec C++/THINK C), mw/gctest.68K.¹, or mw/gctest.PPC.¹. The
355test will ask you how many times to run; 1 should be sufficient.
356
357Building
358--------
359
360For your convenience project files for the major Macintosh development
361systems are provided.
362
363For Symantec C++/THINK C, you must build the two projects gclib-1.¹ and
364gclib-2.¹. It has to be split up because the collector has more than 32k
365of static data and no library can have more than this in the Symantec
366environment. (Future versions will probably fix this.)
367
368For Metrowerks C/C++ 4.5 you build gc.68K.¹/gc.PPC.¹ and the result will
369be a library called gc.68K.lib/gc.PPC.lib.
370
371Using
372-----
373
374Under Symantec C++/THINK C, you can just add the gclib-1.¹ and gclib-2.¹
375projects to your own project. Under Metrowerks, you add gc.68K.lib or
376gc.PPC.lib and two additional files. You add the files called datastart.c
377and dataend.c to your project, bracketing all files that use the collector.
378See mw/gctest.¹ for an example.
379
380Include the projects/libraries you built above into your own project,
381#include "gc.h", and call GC_malloc. You don't have to call GC_free.
382
383
384Patrick C. Beard
385January 4, 1995
diff --git a/gc/doc/README.MacOSX b/gc/doc/README.MacOSX
deleted file mode 100644
index a517dd61fc9..00000000000
--- a/gc/doc/README.MacOSX
+++ /dev/null
@@ -1,40 +0,0 @@
1While the GC should work on MacOS X Server, MacOS X and Darwin, I only tested
2it on MacOS X Server.
3I've added a PPC assembly version of GC_push_regs(), thus the setjmp() hack is
4no longer necessary. Incremental collection is supported via mprotect/signal.
5The current solution isn't really optimal because the signal handler must decode
6the faulting PPC machine instruction in order to find the correct heap address.
7Further, it must poke around in the register state which the kernel saved away
8in some obscure register state structure before it calls the signal handler -
9needless to say the layout of this structure is no where documented.
10Threads and dynamic libraries are not yet supported (adding dynamic library
11support via the low-level dyld API shouldn't be that hard).
12
13The original MacOS X port was brought to you by Andrew Stone.
14
15
16June, 1 2000
17
18Dietmar Planitzer
19dave.pl@ping.at
20
21Note from Andrew Begel:
22
23One more fix to enable gc.a to link successfully into a shared library for
24MacOS X. You have to add -fno-common to the CFLAGS in the Makefile. MacOSX
25disallows common symbols in anything that eventually finds its way into a
26shared library. (I don't completely understand why, but -fno-common seems to
27work and doesn't mess up the garbage collector's functionality).
28
29Feb 26, 2003
30
31Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support.
32GC_MACOSX_THREADS should be defined in the build and in clients. Real
33dynamic library support is still missing, i.e. dynamic library data segments
34are still not scanned. Code that stores pointers to the garbage collected
35heap in statically allocated variables should not reside in a dynamic
36library. This still doesn't appear to be 100% reliable.
37
38Mar 10, 2003
39Brian Alliet contributed dynamic library support for MacOSX. It could also
40use more testing.
diff --git a/gc/doc/README.OS2 b/gc/doc/README.OS2
deleted file mode 100644
index 5345bbd0f65..00000000000
--- a/gc/doc/README.OS2
+++ /dev/null
@@ -1,6 +0,0 @@
1The code assumes static linking, and a single thread. The editor de has
2not been ported. The cord test program has. The supplied OS2_MAKEFILE
3assumes the IBM C Set/2 environment, but the code shouldn't.
4
5Since we haven't figured out hoe to do perform partial links or to build static
6libraries, clients currently need to link against a long list of executables.
diff --git a/gc/doc/README.amiga b/gc/doc/README.amiga
deleted file mode 100644
index 730dce3fe96..00000000000
--- a/gc/doc/README.amiga
+++ /dev/null
@@ -1,322 +0,0 @@
1===========================================================================
2 Kjetil S. Matheussen's notes (28-11-2000)
3===========================================================================
4Compiles under SAS/C again. Should allso still compile under other
5amiga compilers without big changes. I haven't checked if it still
6works under gcc, because I don't have gcc for amiga. But I have
7updated 'Makefile', and hope it compiles fine.
8
9
10WHATS NEW:
11
121.
13 Made a pretty big effort in preventing GCs allocating-functions from returning
14 chip-mem.
15
16 The lower part of the new file AmigaOS.c does this in various ways, mainly by
17 wrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable,
18 GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_page
19 and GC_malloc_atomic_ignore_off_page. GC_realloc is allso wrapped, but
20 doesn't do the same effort in preventing to return chip-mem.
21 Other allocating-functions (f.ex. GC_*_typed_) can probably be
22 used without any problems, but beware that the warn hook will not be called.
23 In case of problems, don't define GC_AMIGA_FASTALLOC.
24
25 Programs using more time actually using the memory allocated
26 (instead of just allocate and free rapidly) have
27 the most to earn on this, but even gctest now normally runs twice
28 as fast and uses less memory, on my poor 8MB machine.
29
30 The changes have only effect when there is no more
31 fast-mem left. But with the way GC works, it
32 could happen quite often. Beware that an atexit handler had to be added,
33 so using the abort() function will make a big memory-loss.
34 If you absolutely must call abort() instead of exit(), try calling
35 the GC_amiga_free_all_mem function before abort().
36
37 New amiga-spesific compilation flags:
38
39 GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before,
40 it will not try to force fast-mem out of the OS, and
41 it will use normal calloc for allocation, and the rest
42 of the following flags will have no effect.
43
44 GC_AMIGA_ONLYFAST - Makes GC never to return chip-mem. GC_AMIGA_RETRY have
45 no effect if this flag is set.
46
47 GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. This
48 usually is a success with the standard GC configuration.
49 It is allso the most important flag to set to prevent
50 GC from returning chip-mem. Beware that it slows down a lot
51 when a program is rapidly allocating/deallocating when
52 theres either very little fast-memory left or verly little
53 chip-memory left. Its not a very common situation, but gctest
54 sometimes (very rare) use many minutes because of this.
55
56 GC_AMIGA_RETRY - If gc succeed allocating memory, but it is chip-mem,
57 try again and see if it is fast-mem. Most of the time,
58 it will actually return fast-mem for the second try.
59 I have set max number of retries to 9 or size/5000. You
60 can change this if you like. (see GC_amiga_rec_alloc())
61
62 GC_AMIGA_PRINTSTATS - Gather some statistics during the execution of a
63 program, and prints out the info when the atexit-handler
64 is called.
65
66 My reccomendation is to set all this flags, except GC_AMIGA_PRINTSTATS and
67 GC_AMIGA_ONLYFAST.
68
69 If your program demands high response-time, you should
70 not define GC_AMIGA_GC, and possible allso define GC_AMIGA_ONLYFAST.
71 GC_AMIGA_RETRY does not seem to slow down much.
72
73 Allso, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when
74 compilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation-
75 functions wrapped. (see gc.h)
76
77 Note that GC_realloc must not be called before any of
78 the other above mentioned allocating-functions have been called. (shouldn't be
79 any programs doing so either, I hope).
80
81 Another note. The allocation-function is wrapped when defining
82 GC_AMIGA_FASTALLOC by letting the function go thru the new
83 GC_amiga_allocwrapper_do function-pointer (see gc.h). Means that
84 sending function-pointers, such as GC_malloc, GC_malloc_atomic, etc.,
85 for later to be called like f.ex this, (*GC_malloc_functionpointer)(size),
86 will not wrap the function. This is normally not a big problem, unless
87 all allocation function is called like this, which will cause the
88 atexit un-allocating function never to be called. Then you either
89 have to manually add the atexit handler, or call the allocation-
90 functions function-pointer functions like this;
91 (*GC_amiga_allocwrapper_do)(size,GC_malloc_functionpointer).
92 There are probably better ways this problem could be handled, unfortunately,
93 I didn't find any without rewriting or replacing a lot of the GC-code, which
94 I really didn't want to. (Making new GC_malloc_* functions, and just
95 define f.ex GC_malloc as GC_amiga_malloc should allso work).
96
97
98 New amiga-spesific function:
99
100 void GC_amiga_set_toany(void (*func)(void));
101
102 'func' is a function that will be called right before gc has to change
103 allocation-method from MEMF_FAST to MEMF_ANY. Ie. when it is likely
104 it will return chip-mem.
105
106
1072. A few small compiler-spesific additions to make it compile with SAS/C again.
108
1093. Updated and rewritten the smakefile, so that it works again and that
110 the "unnecesarry" 'SCOPTIONS' files could be removed. Allso included
111 the cord-smakefile stuff in the main smakefile, so that the cord smakefile
112 could be removed too. By writing smake -f Smakefile.smk, both gc.lib and
113 cord.lib will be made.
114
115
116
117STILL MISSING:
118
119Programs can not be started from workbench, at least not for SAS/C. (Martin
120Tauchmanns note about that it now works with workbench is definitely wrong
121when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code,
122but I haven't tested it. I think the reason for MT to replace the
123"#if 0'ed"-code was only because it was a bit to SAS/C-spesific. But I
124don't know. An iconx-script solves this problem anyway.
125
126
127BEWARE!
128
129-To run gctest, set the stack to around 200000 bytes first.
130-SAS/C-spesific: cord will crash if you compile gc.lib with
131 either parm=reg or parm=both. (missing legal prototypes for
132 function-pointers someplace is the reason I guess.).
133
134
135tested with software: Radium, http://www.stud.ifi.uio.no/~ksvalast/radium/
136
137tested with hardware: MC68060
138
139
140-ksvalast@ifi.uio.no
141
142
143===========================================================================
144 Martin Tauchmann's notes (1-Apr-99)
145===========================================================================
146
147Works now, also with the GNU-C compiler V2.7.2.1. <ftp://ftp.unina.it/pub/amiga/geekgadgets/amiga/m68k/snapshots/971125/amiga-bin/>
148Modify the `Makefile`
149CC=cc $(ABI_FLAG)
150to
151CC=gcc $(ABI_FLAG)
152
153TECHNICAL NOTES
154
155- `GC_get_stack_base()`, `GC_register_data_segments()` works now with every
156 C compiler; also Workbench.
157
158- Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC.
159
160
161PROBLEMS
162- When the Linker, does`t merge all Code-Segments to an single one. LD of GCC
163 do it always.
164
165- With ixemul.library V47.3, when an GC program launched from another program
166 (example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()`
167 found the Segment-List of the caller program.
168 Can be fixed, if the run-time initialization code (for C programs, usually *crt0*)
169 support `__data` and `__bss`.
170
171- PowerPC Amiga currently not supported.
172
173- Dynamic libraries (dyn_load.c) not supported.
174
175
176TESTED WITH SOFTWARE
177
178`Optimized Oberon 2 C` (oo2c) <http://cognac.informatik.uni-kl.de/download/index.html>
179
180
181TESTED WITH HARDWARE
182
183MC68030
184
185
186CONTACT
187
188Please, contact me at <martintauchmann@bigfoot.com>, when you change the
189Amiga port. <http://martintauchmann.home.pages.de>
190
191===========================================================================
192 Michel Schinz's notes
193===========================================================================
194WHO DID WHAT
195
196The original Amiga port was made by Jesper Peterson. I (Michel Schinz)
197modified it slightly to reflect the changes made in the new official
198distributions, and to take advantage of the new SAS/C 6.x features. I also
199created a makefile to compile the "cord" package (see the cord
200subdirectory).
201
202TECHNICAL NOTES
203
204In addition to Jesper's notes, I have the following to say:
205
206- Starting with version 4.3, gctest checks to see if the code segment is
207 added to the root set or not, and complains if it is. Previous versions
208 of this Amiga port added the code segment to the root set, so I tried to
209 fix that. The only problem is that, as far as I know, it is impossible to
210 know which segments are code segments and which are data segments (there
211 are indeed solutions to this problem, like scanning the program on disk
212 or patch the LoadSeg functions, but they are rather complicated). The
213 solution I have chosen (see os_dep.c) is to test whether the program
214 counter is in the segment we are about to add to the root set, and if it
215 is, to skip the segment. The problems are that this solution is rather
216 awkward and that it works only for one code segment. This means that if
217 your program has more than one code segment, all of them but one will be
218 added to the root set. This isn't a big problem in fact, since the
219 collector will continue to work correctly, but it may be slower.
220
221 Anyway, the code which decides whether to skip a segment or not can be
222 removed simply by not defining AMIGA_SKIP_SEG. But notice that if you do
223 so, gctest will complain (it will say that "GC_is_visible produced wrong
224 failure indication"). However, it may be useful if you happen to have
225 pointers stored in a code segment (you really shouldn't).
226
227 If anyone has a good solution to the problem of finding, when a program
228 is loaded in memory, whether a segment is a code or a data segment,
229 please let me know.
230
231PROBLEMS
232
233If you have any problem with this version, please contact me at
234schinz@alphanet.ch (but do *not* send long files, since we pay for
235every mail!).
236
237===========================================================================
238 Jesper Peterson's notes
239===========================================================================
240
241ADDITIONAL NOTES FOR AMIGA PORT
242
243These notes assume some familiarity with Amiga internals.
244
245WHY I PORTED TO THE AMIGA
246
247The sole reason why I made this port was as a first step in getting
248the Sather(*) language on the Amiga. A port of this language will
249be done as soon as the Sather 1.0 sources are made available to me.
250Given this motivation, the garbage collection (GC) port is rather
251minimal.
252
253(*) For information on Sather read the comp.lang.sather newsgroup.
254
255LIMITATIONS
256
257This port assumes that the startup code linked with target programs
258is that supplied with SAS/C versions 6.0 or later. This allows
259assumptions to be made about where to find the stack base pointer
260and data segments when programs are run from WorkBench, as opposed
261to running from the CLI. The compiler dependent code is all in the
262GC_get_stack_base() and GC_register_data_segments() functions, but
263may spread as I add Amiga specific features.
264
265Given that SAS/C was assumed, the port is set up to be built with
266"smake" using the "SMakefile". Compiler options in "SCoptions" can
267be set with "scopts" program. Both "smake" and "scopts" are part of
268the SAS/C commercial development system.
269
270In keeping with the porting philosophy outlined above, this port
271will not behave well with Amiga specific code. Especially not inter-
272process comms via messages, and setting up public structures like
273Intuition objects or anything else in the system lists. For the
274time being the use of this library is limited to single threaded
275ANSI/POSIX compliant or near-complient code. (ie. Stick to stdio
276for now). Given this limitation there is currently no mechanism for
277allocating "CHIP" or "PUBLIC" memory under the garbage collector.
278I'll add this after giving it considerable thought. The major
279problem is the entire physical address space may have to me scanned,
280since there is no telling who we may have passed memory to.
281
282If you allocate your own stack in client code, you will have to
283assign the pointer plus stack size to GC_stackbottom.
284
285The initial stack size of the target program can be compiled in by
286setting the __stack symbol (see SAS documentaion). It can be over-
287ridden from the CLI by running the AmigaDOS "stack" program, or from
288the WorkBench by setting the stack size in the tool types window.
289
290SAS/C COMPILER OPTIONS (SCoptions)
291
292You may wish to check the "CPU" code option is appropriate for your
293intended target system.
294
295Under no circumstances set the "StackExtend" code option in either
296compiling the library or *ANY* client code.
297
298All benign compiler warnings have been suppressed. These mainly
299involve lack of prototypes in the code, and dead assignments
300detected by the optimizer.
301
302THE GOOD NEWS
303
304The library as it stands is compatible with the GigaMem commercial
305virtual memory software, and probably similar PD software.
306
307The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz)
308compares favourably with an HP9000 with similar architecture (a 325
309with a 68030 I think).
310
311-----------------------------------------------------------------------
312
313The Amiga port has been brought to you by:
314
315Jesper Peterson.
316
317jep@mtiame.mtia.oz.au (preferred, but 1 week turnaround)
318jep@orca1.vic.design.telecom.au (that's orca<one>, 1 day turnaround)
319
320At least one of these addresses should be around for a while, even
321though I don't work for either of the companies involved.
322
diff --git a/gc/doc/README.arm.cross b/gc/doc/README.arm.cross
deleted file mode 100755
index 96744edaf67..00000000000
--- a/gc/doc/README.arm.cross
+++ /dev/null
@@ -1,68 +0,0 @@
1From: Margaret Fleck
2
3Here's the key details of what worked for me, in case anyone else needs them.
4There may well be better ways to do some of this, but ....
5 -- Margaret
6
7
8The badge4 has a StrongArm-1110 processor and a StrongArm-1111 coprocessor.
9
10Assume that the garbage collector distribution is unpacked into /home/arm/gc6.0,
11which is visible to both the ARM machine and a linux desktop (e.g. via NFS mounting).
12
13Assume that you have a file /home/arm/config.site with contents something like the
14example attached below. Notice that our local ARM toolchain lives in
15/skiff/local.
16
17Go to /home/arm/gc6.0 directory. Do
18 CONFIG_SITE=/home/arm/config.site ./configure --target=arm-linux
19--prefix=/home/arm/gc6.0
20
21On your desktop, do:
22 make
23 make install
24The main garbage collector library should now be in ../gc6.0/lib/libgc.so.
25
26To test the garbage collector, first do the following on your desktop
27 make gctest
28 ./gctest
29Then do the following on the ARM machine
30 cd .libs
31 ./lt-gctest
32
33Do not try to do "make test" (the usual way of running the test
34program). This does not work and seems to erase some of the important
35files.
36
37The gctest program claims to have succeeded. Haven't run any further tests
38with it, though I'll be doing so in the near future.
39
40-------------------------------
41# config.site for configure
42
43# Modified from the one provided by Bradley D. LaRonde
44# Edited by Andrej Cedilnik <acedil1@csee.umbc.edu>
45# Used some of solutions by Tilman Vogel <Tilman.Vogel@web.de>
46# Ported for iPAQ Familiar by Oliver Kurth <oliver.kurth@innominate.com>
47# Further modified by Margaret Fleck for the badge4
48
49HOSTCC=gcc
50
51# Names of the cross-compilers
52CC=/skiff/local/bin/arm-linux-gcc
53CXX=/skiff/local/bin/arm-linux-gcc
54
55# The cross compiler specific options
56CFLAGS="-O2 -fno-exceptions"
57CXXFLAGS="-O2 -fno-exceptions"
58CPPFLAGS="-O2 -fno-exceptions"
59LDFLAGS=""
60
61# Some other programs
62AR=/skiff/local/bin/arm-linux-ar
63RANLIB=/skiff/local/bin/arm-linux-ranlib
64NM=/skiff/local/bin/arm-linux-nm
65ac_cv_path_NM=/skiff/local/bin/arm-linux-nm
66ac_cv_func_setpgrp_void=yes
67x_includes=/skiff/local/arm-linux/include/X11
68x_libraries=/skiff/local/arm-linux/lib/X11
diff --git a/gc/doc/README.autoconf b/gc/doc/README.autoconf
deleted file mode 100644
index 53fcf5a50b3..00000000000
--- a/gc/doc/README.autoconf
+++ /dev/null
@@ -1,59 +0,0 @@
1As of GC6.0alpha8, we attempt to support GNU-style builds based on automake,
2autoconf and libtool. This is based almost entirely on Tom Tromey's work
3with gcj.
4
5To build and install libraries use
6
7configure; make; make install
8
9The advantages of this process are:
10
111) It should eventually do a better job of automatically determining the
12right compiler to use, etc. It probably already does in some cases.
13
142) It tries to automatically set a good set of default GC parameters for
15the platform (e.g. thread support). It provides an easier way to configure
16some of the others.
17
183) It integrates better with other projects using a GNU-style build process.
19
204) It builds both dynamic and static libraries.
21
22The known disadvantages are:
23
241) The build scripts are much more complex and harder to debug (though largely
25standard). I don't understand them all, and there's probably lots of redundant
26stuff.
27
282) It probably doesn't work on all Un*x-like platforms yet. It probably will
29never work on the rest.
30
313) The scripts are not yet complete. Some of the standard GNU targets don't
32yet work. (Corrections/additions are very welcome.)
33
34The distribution should contain all files needed to run "configure" and "make",
35as well as the sources needed to regenerate the derived files. (If I missed
36some, please let me know.)
37
38Note that the distribution comes with a "Makefile" which will be overwritten
39by "configure" with one that is not at all equiavelent to the original. The
40distribution contains a copy of the original "Makefile" in "Makefile.direct".
41
42Important options to configure:
43
44 --prefix=PREFIX install architecture-independent files in PREFIX
45 [/usr/local]
46 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
47 [same as prefix]
48 --enable-threads=TYPE choose threading package
49 --enable-parallel-mark parallelize marking and free list construction
50 --enable-full-debug include full support for pointer backtracing etc.
51
52Unless --prefix is set (or --exec-prefix or one of the more obscure options),
53make install will install libgc.a and libgc.so in /usr/local/bin, which
54would typically require the "make install" to be run as root.
55
56Most commonly --enable-threads=posix or will be needed. --enable-parallel-mark
57is recommended for multiprocessors if it is supported on the platform.
58
59
diff --git a/gc/doc/README.changes b/gc/doc/README.changes
deleted file mode 100644
index 627ddaefc73..00000000000
--- a/gc/doc/README.changes
+++ /dev/null
@@ -1,1809 +0,0 @@
1This is a rough history of garbage collector bugs and versions.
2
3This has been maintained with varying diligence over the years.
4
5I made an attempt to include recent contributors here. I apologize for any
6omissions.
7
8-------------------------
9
10 Version 1.3 and immediately preceding versions contained spurious
11assembly language assignments to TMP_SP. Only the assignment in the PC/RT
12code is necessary. On other machines, with certain compiler options,
13the assignments can lead to an unsaved register being overwritten.
14Known to cause problems under SunOS 3.5 WITHOUT the -O option. (With
15-O the compiler recognizes it as dead code. It probably shouldn't,
16but that's another story.)
17
18 Version 1.4 and earlier versions used compile time determined values
19for the stack base. This no longer works on Sun 3s, since Sun 3/80s use
20a different stack base. We now use a straightforward heuristic on all
21machines on which it is known to work (incl. Sun 3s) and compile-time
22determined values for the rest. There should really be library calls
23to determine such values.
24
25 Version 1.5 and earlier did not ensure 8 byte alignment for objects
26allocated on a sparc based machine.
27
28 Version 1.8 added ULTRIX support in gc_private.h.
29
30 Version 1.9 fixed a major bug in gc_realloc.
31
32 Version 2.0 introduced a consistent naming convention for collector
33routines and added support for registering dynamic library data segments
34in the standard mark_roots.c. Most of the data structures were revamped.
35The treatment of interior pointers was completely changed. Finalization
36was added. Support for locking was added. Object kinds were added.
37We added a black listing facility to avoid allocating at addresses known
38to occur as integers somewhere in the address space. Much of this
39was accomplished by adapting ideas and code from the PCR collector.
40The test program was changed and expanded.
41
42 Version 2.1 was the first stable version since 1.9, and added support
43for PPCR.
44
45 Version 2.2 added debugging allocation, and fixed various bugs. Among them:
46- GC_realloc could fail to extend the size of the object for certain large object sizes.
47- A blatant subscript range error in GC_printf, which unfortunately
48 wasn't exercised on machines with sufficient stack alignment constraints.
49- GC_register_displacement did the wrong thing if it was called after
50 any allocation had taken place.
51- The leak finding code would eventually break after 2048 byte
52 byte objects leaked.
53- interface.c didn't compile.
54- The heap size remained much too small for large stacks.
55- The stack clearing code behaved badly for large stacks, and perhaps
56 on HP/PA machines.
57
58 Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs:
59- Missing declaration of etext in the A/UX version.
60- Some PCR root-finding problems.
61- Blacklisting was not 100% effective, because the plausible future
62 heap bounds were being miscalculated.
63- GC_realloc didn't handle out-of-memory correctly.
64- GC_base could return a nonzero value for addresses inside free blocks.
65- test.c wasn't really thread safe, and could erroneously report failure
66 in a multithreaded environment. (The locking primitives need to be
67 replaced for other threads packages.)
68- GC_CONS was thoroughly broken.
69- On a SPARC with dynamic linking, signals stayed diabled while the
70 client code was running.
71 (Thanks to Manuel Serrano at INRIA for reporting the last two.)
72
73 Version 2.4 added GC_free_space_divisor as a tuning knob, added
74 support for OS/2 and linux, and fixed the following bugs:
75- On machines with unaligned pointers (e.g. Sun 3), every 128th word could
76 fail to be considered for marking.
77- Dynamic_load.c erroneously added 4 bytes to the length of the data and
78 bss sections of the dynamic library. This could result in a bad memory
79 reference if the actual length was a multiple of a page. (Observed on
80 Sun 3. Can probably also happen on a Sun 4.)
81 (Thanks to Robert Brazile for pointing out that the Sun 3 version
82 was broken. Dynamic library handling is still broken on Sun 3s
83 under 4.1.1U1, but apparently not 4.1.1. If you have such a machine,
84 use -Bstatic.)
85
86 Version 2.5 fixed the following bugs:
87- Removed an explicit call to exit(1)
88- Fixed calls to GC_printf and GC_err_printf, so the correct number of
89 arguments are always supplied. The OS/2 C compiler gets confused if
90 the number of actuals and the number of formals differ. (ANSI C
91 doesn't require this to work. The ANSI sanctioned way of doing things
92 causes too many compatibility problems.)
93
94 Version 3.0 added generational/incremental collection and stubborn
95 objects.
96
97 Version 3.1 added the following features:
98- A workaround for a SunOS 4.X SPARC C compiler
99 misfeature that caused problems when the collector was turned into
100 a dynamic library.
101- A fix for a bug in GC_base that could result in a memory fault.
102- A fix for a performance bug (and several other misfeatures) pointed
103 out by Dave Detlefs and Al Dosser.
104- Use of dirty bit information for static data under Solaris 2.X.
105- DEC Alpha/OSF1 support (thanks to Al Dosser).
106- Incremental collection on more platforms.
107- A more refined heap expansion policy. Less space usage by default.
108- Various minor enhancements to reduce space usage, and to reduce
109 the amount of memory scanned by the collector.
110- Uncollectable allocation without per object overhead.
111- More conscientious handling of out-of-memory conditions.
112- Fixed a bug in debugging stubborn allocation.
113- Fixed a bug that resulted in occasional erroneous reporting of smashed
114 objects with debugging allocation.
115- Fixed bogus leak reports of size 4096 blocks with FIND_LEAK.
116
117 Version 3.2 fixed a serious and not entirely repeatable bug in
118 the incremental collector. It appeared only when dirty bit info
119 on the roots was available, which is normally only under Solaris.
120 It also added GC_general_register_disappearing_link, and some
121 testing code. Interface.c disappeared.
122
123 Version 3.3 fixes several bugs and adds new ports:
124- PCR-specific bugs.
125- Missing locking in GC_free, redundant FASTUNLOCK
126 in GC_malloc_stubborn, and 2 bugs in
127 GC_unregister_disappearing_link.
128 All of the above were pointed out by Neil Sharman
129 (neil@cs.mu.oz.au).
130- Common symbols allocated by the SunOS4.X dynamic loader
131 were not included in the root set.
132- Bug in GC_finalize (reported by Brian Beuning and Al Dosser)
133- Merged Amiga port from Jesper Peterson (untested)
134- Merged NeXT port from Thomas Funke (significantly
135 modified and untested)
136
137 Version 3.4:
138- Fixed a performance bug in GC_realloc.
139- Updated the amiga port.
140- Added NetBSD and 386BSD ports.
141- Added cord library.
142- Added trivial performance enhancement for
143 ALL_INTERIOR_POINTERS. (Don't scan last word.)
144
145 Version 3.5
146- Minor collections now mark from roots only once, if that
147 doesn't cause an excessive pause.
148- The stack clearing heuristic was refined to prevent anomalies
149 with very heavily recursive programs and sparse stacks.
150- Fixed a bug that prevented mark stack growth in some cases.
151 GC_objects_are_marked should be set to TRUE after a call
152 to GC_push_roots and as part of GC_push_marked, since
153 both can now set mark bits. I think this is only a performance
154 bug, but I wouldn't bet on it. It's certainly very hard to argue
155 that the old version was correct.
156- Fixed an incremental collection bug that prevented it from
157 working at all when HBLKSIZE != getpagesize()
158- Changed dynamic_loading.c to include gc_priv.h before testing
159 DYNAMIC_LOADING. SunOS dynamic library scanning
160 must have been broken in 3.4.
161- Object size rounding now adapts to program behavior.
162- Added a workaround (provided by Manuel Serrano and
163 colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug
164 that I had incorrectly assumed to have been squished.
165 The collector was broken if the text segment size was within
166 32 bytes of a multiple of 8K bytes, and if the beginning of
167 the data segment contained interesting roots. The workaround
168 assumes a demand-loadable executable. The original may have
169 have "worked" in some other cases.
170- Added dynamic library support under IRIX5.
171- Added support for EMX under OS/2 (thanks to Ari Huttunen).
172
173Version 3.6:
174- fixed a bug in the mark stack growth code that was introduced
175 in 3.4.
176- fixed Makefile to work around DEC AXP compiler tail recursion
177 bug.
178
179Version 3.7:
180- Added a workaround for an HP/UX compiler bug.
181- Fixed another stack clearing performance bug. Reworked
182 that code once more.
183
184Version 4.0:
185- Added support for Solaris threads (which was possible
186 only by reimplementing some fraction of Solaris threads,
187 since Sun doesn't currently make the thread debugging
188 interface available).
189- Added non-threads win32 and win32S support.
190- (Grudgingly, with suitable muttering of obscenities) renamed
191 files so that the collector distribution could live on a FAT
192 file system. Files that are guaranteed to be useless on
193 a PC still have long names. Gc_inline.h and gc_private.h
194 still exist, but now just include gc_inl.h and gc_priv.h.
195- Fixed a really obscure bug in finalization that could cause
196 undetected mark stack overflows. (I would be surprised if
197 any real code ever tickled this one.)
198- Changed finalization code to dynamically resize the hash
199 tables it maintains. (This probably does not matter for well-
200 -written code. It no doubt does for C++ code that overuses
201 destructors.)
202- Added typed allocation primitives. Rewrote the marker to
203 accommodate them with more reasonable efficiency. This
204 change should also speed up marking for GC_malloc allocated
205 objects a little. See gc_typed.h for new primitives.
206- Improved debugging facilities slightly. Allocation time
207 stack traces are now kept by default on SPARC/SUNOS4.
208 (Thanks to Scott Schwartz.)
209- Added better support for small heap applications.
210- Significantly extended cord package. Fixed a bug in the
211 implementation of lazily read files. Printf and friends now
212 have cord variants. Cord traversals are a bit faster.
213- Made ALL_INTERIOR_POINTERS recognition the default.
214- Fixed de so that it can run in constant space, independent
215 of file size. Added simple string searching to cords and de.
216- Added the Hull-Ellis C++ interface.
217- Added dynamic library support for OSF/1.
218 (Thanks to Al Dosser and Tim Bingham at DEC.)
219- Changed argument to GC_expand_hp to be expressed
220 in units of bytes instead of heap blocks. (Necessary
221 since the heap block size now varies depending on
222 configuration. The old version was never very clean.)
223- Added GC_get_heap_size(). The previous "equivalent"
224 was broken.
225- Restructured the Makefile a bit.
226
227Since version 4.0:
228- Changed finalization implementation to guarantee that
229 finalization procedures are called outside of the allocation
230 lock, making direct use of the interface a little less dangerous.
231 MAY BREAK EXISTING CLIENTS that assume finalizers
232 are protected by a lock. Since there seem to be few multithreaded
233 clients that use finalization, this is hopefully not much of
234 a problem.
235- Fixed a gross bug in CORD_prev.
236- Fixed a bug in blacklst.c that could result in unbounded
237 heap growth during startup on machines that do not clear
238 memory obtained from the OS (e.g. win32S).
239- Ported de editor to win32/win32S. (This is now the only
240 version with a mouse-sensitive UI.)
241- Added GC_malloc_ignore_off_page to allocate large arrays
242 in the presence of ALL_INTERIOR_POINTERS.
243- Changed GC_call_with_alloc_lock to not disable signals in
244 the single-threaded case.
245- Reduced retry count in GC_collect_or_expand for garbage
246 collecting when out of memory.
247- Made uncollectable allocations bypass black-listing, as they
248 should.
249- Fixed a bug in typed_test in test.c that could cause (legitimate)
250 GC crashes.
251- Fixed some potential synchronization problems in finalize.c
252- Fixed a real locking problem in typd_mlc.c.
253- Worked around an AIX 3.2 compiler feature that results in
254 out of bounds memory references.
255- Partially worked around an IRIX5.2 beta problem (which may
256 or may not persist to the final release).
257- Fixed a bug in the heap integrity checking code that could
258 result in explicitly deallocated objects being identified as
259 smashed. Fixed a bug in the dbg_mlc stack saving code
260 that caused old argument pointers to be considered live.
261- Fixed a bug in CORD_ncmp (and hence CORD_str).
262- Repaired the OS2 port, which had suffered from bit rot
263 in 4.0. Worked around what appears to be CSet/2 V1.0
264 optimizer bug.
265- Fixed a Makefile bug for target "c++".
266
267Since version 4.1:
268- Multiple bug fixes/workarounds in the Solaris threads version.
269 (It occasionally failed to locate some register contents for
270 marking. It also turns out that thr_suspend and friends are
271 unreliable in Solaris 2.3. Dirty bit reads appear
272 to be unreliable under some weird
273 circumstances. My stack marking code
274 contained a serious performance bug. The new code is
275 extremely defensive, and has not failed in several cpu
276 hours of testing. But no guarantees ...)
277- Added MacOS support (thanks to Patrick Beard.)
278- Fixed several syntactic bugs in gc_c++.h and friends. (These
279 didn't bother g++, but did bother most other compilers.)
280 Fixed gc_c++.h finalization interface. (It didn't.)
281- 64 bit alignment for allocated objects was not guaranteed in a
282 few cases in which it should have been.
283- Added GC_malloc_atomic_ignore_off_page.
284- Added GC_collect_a_little.
285- Added some prototypes to gc.h.
286- Some other minor bug fixes (notably in Makefile).
287- Fixed OS/2 / EMX port (thanks to Ari Huttunen).
288- Fixed AmigaDOS port. (thanks to Michel Schinz).
289- Fixed the DATASTART definition under Solaris. There
290 was a 1 in 16K chance of the collector missing the first
291 64K of static data (and thus crashing).
292- Fixed some blatant anachronisms in the README file.
293- Fixed PCR-Makefile for upcoming PPCR release.
294
295Since version 4.2:
296- Fixed SPARC alignment problem with GC_DEBUG.
297- Fixed Solaris threads /proc workaround. The real
298 problem was an interaction with mprotect.
299- Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h).
300- Slightly improved allocator space utilization by
301 fixing the GC_size_map mechanism.
302- Integrated some Sony News and MIPS RISCos 4.51
303 patches. (Thanks to Nobuyuki Hikichi of
304 Software Research Associates, Inc. Japan)
305- Fixed HP_PA alignment problem. (Thanks to
306 xjam@cork.cs.berkeley.edu.)
307- Added GC_same_obj and friends. Changed GC_base
308 to return 0 for pointers past the end of large objects.
309 Improved GC_base performance with ALL_INTERIOR_POINTERS
310 on machines with a slow integer mod operation.
311 Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare
312 for preprocessor.
313- changed the default on most UNIX machines to be that
314 signals are not disabled during critical GC operations.
315 This is still ANSI-conforming, though somewhat dangerous
316 in the presence of signal handlers. But the performance
317 cost of the alternative is sometimes problematic.
318 Can be changed back with a minor Makefile edit.
319- renamed IS_STRING in gc.h, to CORD_IS_STRING, thus
320 following my own naming convention. Added the function
321 CORD_to_const_char_star.
322- Fixed a gross bug in GC_finalize. Symptom: occasional
323 address faults in that function. (Thanks to Anselm
324 Baird-Smith (Anselm.BairdSmith@inria.fr)
325- Added port to ICL DRS6000 running DRS/NX. Restructured
326 things a bit to factor out common code, and remove obsolete
327 code. Collector should now run under SUNOS5 with either
328 mprotect or /proc dirty bits. (Thanks to Douglas Steel
329 (doug@wg.icl.co.uk)).
330- More bug fixes and workarounds for Solaris 2.X. (These were
331 mostly related to putting the collector in a dynamic library,
332 which didn't really work before. Also SOLARIS_THREADS
333 didn't interact well with dl_open.) Thanks to btlewis@eng.sun.com.
334- Fixed a serious performance bug on the DEC Alpha. The text
335 segment was getting registered as part of the root set.
336 (Amazingly, the result was still fast enough that the bug
337 was not conspicuous.) The fix works on OSF/1, version 1.3.
338 Hopefully it also works on other versions of OSF/1 ...
339- Fixed a bug in GC_clear_roots.
340- Fixed a bug in GC_generic_malloc_words_small that broke
341 gc_inl.h. (Reported by Antoine de Maricourt. I broke it
342 in trying to tweak the Mac port.)
343- Fixed some problems with cord/de under Linux.
344- Fixed some cord problems, notably with CORD_riter4.
345- Added DG/UX port.
346 Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov)
347- Added finalization registration routines with weaker ordering
348 constraints. (This is necessary for C++ finalization with
349 multiple inheritance, since the compiler often adds self-cycles.)
350- Filled the holes in the SCO port. (Thanks to Michael Arnoldus
351 <chime@proinf.dk>.)
352- John Ellis' additions to the C++ support: From John:
353
354* I completely rewrote the documentation in the interface gc_c++.h
355(later renamed gc_cpp.h). I've tried to make it both clearer and more
356precise.
357
358* The definition of accessibility now ignores pointers from an
359finalizable object (an object with a clean-up function) to itself.
360This allows objects with virtual base classes to be finalizable by the
361collector. Compilers typically implement virtual base classes using
362pointers from an object to itself, which under the old definition of
363accessibility prevented objects with virtual base classes from ever
364being collected or finalized.
365
366* gc_cleanup now includes gc as a virtual base. This was enabled by
367the change in the definition of accessibility.
368
369* I added support for operator new[]. Since most (all?) compilers
370don't yet support operator new[], it is conditionalized on
371-DOPERATOR_NEW_ARRAY. The code is untested, but its trivial and looks
372correct.
373
374* The test program test_gc_c++ (later renamed test_cpp.cc)
375tries to test for the C++-specific functionality not tested by the
376other programs.
377- Added <unistd.h> include to misc.c. (Needed for ppcr.)
378- Added PowerMac port. (Thanks to Patrick Beard again.)
379- Fixed "srcdir"-related Makefile problems. Changed things so
380 that all externally visible include files always appear in the
381 include subdirectory of the source. Made gc.h directly
382 includable from C++ code. (These were at Per
383 Bothner's suggestion.)
384- Changed Intel code to also mark from ebp (Kevin Warne's
385 suggestion).
386- Renamed C++ related files so they could live in a FAT
387 file system. (Charles Fiterman's suggestion.)
388- Changed Windows NT Makefile to include C++ support in
389 gc.lib. Added C++ test as Makefile target.
390
391Since version 4.3:
392 - ASM_CLEAR_CODE was erroneously defined for HP
393 PA machines, resulting in a compile error.
394 - Fixed OS/2 Makefile to create a library. (Thanks to
395 Mark Boulter (mboulter@vnet.ibm.com)).
396 - Gc_cleanup objects didn't work if they were created on
397 the stack. Fixed.
398 - One copy of Gc_cpp.h in the distribution was out of
399 synch, and failed to document some known compiler
400 problems with explicit destructor invocation. Partially
401 fixed. There are probably other compilers on which
402 gc_cleanup is miscompiled.
403 - Fixed Makefile to pass C compiler flags to C++ compiler.
404 - Added Mac fixes.
405 - Fixed os_dep.c to work around what appears to be
406 a new and different VirtualQuery bug under newer
407 versions of win32S.
408 - GC_non_gc_bytes was not correctly maintained by
409 GC_free. Fixed. Thanks to James Clark (jjc@jclark.com).
410 - Added GC_set_max_heap_size.
411 - Changed allocation code to ignore blacklisting if it is preventing
412 use of a very large block of memory. This has the advantage
413 that naive code allocating very large objects is much more
414 likely to work. The downside is you might no
415 longer find out that such code should really use
416 GC_malloc_ignore_off_page.
417 - Changed GC_printf under win32 to close and reopen the file
418 between calls. FAT file systems otherwise make the log file
419 useless for debugging.
420 - Added GC_try_to_collect and GC_get_bytes_since_gc. These
421 allow starting an abortable collection during idle times.
422 This facility does not require special OS support. (Thanks to
423 Michael Spertus of Geodesic Systems for suggesting this. It was
424 actually an easy addition. Kumar Srikantan previously added a similar
425 facility to a now ancient version of the collector. At the time
426 this was much harder, and the result was less convincing.)
427 - Added some support for the Borland development environment. (Thanks
428 to John Ellis and Michael Spertus.)
429 - Removed a misfeature from checksums.c that caused unexpected
430 heap growth. (Thanks to Scott Schwartz.)
431 - Changed finalize.c to call WARN if it encounters a finalization cycle.
432 WARN is defined in gc_priv.h to write a message, usually to stdout.
433 In many environments, this may be inappropriate.
434 - Renamed NO_PARAMS in gc.h to GC_NO_PARAMS, thus adhering to my own
435 naming convention.
436 - Added GC_set_warn_proc to intercept warnings.
437 - Fixed Amiga port. (Thanks to Michel Schinz (schinz@alphanet.ch).)
438 - Fixed a bug in mark.c that could result in an access to unmapped
439 memory from GC_mark_from_mark_stack on machines with unaligned
440 pointers.
441 - Fixed a win32 specific performance bug that could result in scanning of
442 objects allocated with the system malloc.
443 - Added REDIRECT_MALLOC.
444
445Since version 4.4:
446 - Fixed many minor and one major README bugs. (Thanks to Franklin Chen
447 (chen@adi.com) for pointing out many of them.)
448 - Fixed ALPHA/OSF/1 dynamic library support. (Thanks to Jonathan Bachrach
449 (jonathan@harlequin.com)).
450 - Added incremental GC support (MPROTECT_VDB) for Linux (with some
451 help from Bruno Haible).
452 - Altered SPARC recognition tests in gc.h and config.h (mostly as
453 suggested by Fergus Henderson).
454 - Added basic incremental GC support for win32, as implemented by
455 Windows NT and Windows 95. GC_enable_incremental is a noop
456 under win32s, which doesn't implement enough of the VM interface.
457 - Added -DLARGE_CONFIG.
458 - Fixed GC_..._ignore_off_page to also function without
459 -DALL_INTERIOR_POINTERS.
460 - (Hopefully) fixed RS/6000 port. (Only the test was broken.)
461 - Fixed a performance bug in the nonincremental collector running
462 on machines supporting incremental collection with MPROTECT_VDB
463 (e.g. SunOS 4, DEC AXP). This turned into a correctness bug under
464 win32s with win32 incremental collection. (Not all memory protection
465 was disabled.)
466 - Fixed some ppcr related bit rot.
467 - Caused dynamic libraries to be unregistered before reregistering.
468 The old way turned out to be a performance bug on some machines.
469 - GC_root_size was not properly maintained under MSWIN32.
470 - Added -DNO_DEBUGGING and GC_dump.
471 - Fixed a couple of bugs arising with SOLARIS_THREADS +
472 REDIRECT_MALLOC.
473 - Added NetBSD/M68K port. (Thanks to Peter Seebach
474 <seebs@taniemarie.solon.com>.)
475 - Fixed a serious realloc bug. For certain object sizes, the collector
476 wouldn't scan the expanded part of the object. (Thanks to Clay Spence
477 (cds@peanut.sarnoff.com) for noticing the problem, and helping me to
478 track it down.)
479
480Since version 4.5:
481 - Added Linux ELF support. (Thanks to Arrigo Triulzi <arrigo@ic.ac.uk>.)
482 - GC_base crashed if it was called before any other GC_ routines.
483 This could happen if a gc_cleanup object was allocated outside the heap
484 before any heap allocation.
485 - The heap expansion heuristic was not stable if all objects had finalization
486 enabled. Fixed finalize.c to count memory in finalization queue and
487 avoid explicit deallocation. Changed alloc.c to also consider this count.
488 (This is still not recommended. It's expensive if nothing else.) Thanks
489 to John Ellis for pointing this out.
490 - GC_malloc_uncollectable(0) was broken. Thanks to Phong Vo for pointing
491 this out.
492 - The collector didn't compile under Linux 1.3.X. (Thanks to Fred Gilham for
493 pointing this out.) The current workaround is ugly, but expected to be
494 temporary.
495 - Fixed a formatting problem for SPARC stack traces.
496 - Fixed some '=='s in os_dep.c that should have been assignments.
497 Fortunately these were in code that should never be executed anyway.
498 (Thanks to Fergus Henderson.)
499 - Fixed the heap block allocator to only drop blacklisted blocks in small
500 chunks. Made BL_LIMIT self adjusting. (Both of these were in response
501 to heap growth observed by Paul Graham.)
502 - Fixed the Metrowerks/68K Mac code to also mark from a6. (Thanks
503 to Patrick Beard.)
504 - Significantly updated README.debugging.
505 - Fixed some problems with longjmps out of signal handlers, especially under
506 Solaris. Added a workaround for the fact that siglongjmp doesn't appear to
507 do the right thing with -lthread under Solaris.
508 - Added MSDOS/djgpp port. (Thanks to Mitch Harris (maharri@uiuc.edu).)
509 - Added "make reserved_namespace" and "make user_namespace". The
510 first renames ALL "GC_xxx" identifiers as "_GC_xxx". The second is the
511 inverse transformation. Note that doing this is guaranteed to break all
512 clients written for the other names.
513 - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
514 defined should be -ALIGNMENT not WORDS_TO_BYTES(-1). This is
515 a serious bug on machines with pointer alignment of less than a word.
516 - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the
517 end of the object correctly. Caused failures of the C++ test on a DEC Alpha
518 with g++.
519 - gc_inl.h still had problems. Partially fixed. Added warnings at the
520 beginning to hopefully specify the remaining dangers.
521 - Added DATAEND definition to config.h.
522 - Fixed some of the .h file organization. Fixed "make floppy".
523
524Since version 4.6:
525 - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle)
526 - Updated some Mac specific files to synchronize with Patrick Beard.
527 - Fixed a serious bug for machines with non-word-aligned pointers.
528 (Thanks to Patrick Beard for pointing out the problem. The collector
529 should fail almost any conceivable test immediately on such machines.)
530
531Since version 4.7:
532 - Changed a "comment" in a MacOS specific part of mach-dep.c that caused
533 gcc to fail on other platforms.
534
535Since version 4.8
536 - More README.debugging fixes.
537 - Objects ready for finalization, but not finalized in the same GC
538 cycle, could be prematurely collected. This occasionally happened
539 in test_cpp.
540 - Too little memory was obtained from the system for very large
541 objects. That could cause a heap explosion if these objects were
542 not contiguous (e.g. under PCR), and too much of them was blacklisted.
543 - Due to an improper initialization, the collector was too hesitant to
544 allocate blacklisted objects immediately after system startup.
545 - Moved GC_arrays from the data into the bss segment by not explicitly
546 initializing it to zero. This significantly
547 reduces the size of executables, and probably avoids some disk accesses
548 on program startup. It's conceivable that it might break a port that I
549 didn't test.
550 - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which
551 occurred a while ago.
552
553Since 4.9:
554 - Fixed a typo around a call to GC_collect_or_expand in alloc.c. It broke
555 handling of out of memory. (Thanks to Patrick Beard for noticing.)
556
557Since 4.10:
558 - Rationalized (hopefully) GC_try_to_collect in an incremental collection
559 environment. It appeared to not handle a call while a collection was in
560 progress, and was otherwise too conservative.
561 - Merged GC_reclaim_or_delete_all into GC_reclaim_all to get rid of some
562 code.
563 - Added Patrick Beard's Mac fixes, with substantial completely untested
564 modifications.
565 - Fixed the MPROTECT_VDB code to deal with large pages and imprecise
566 fault addresses (as on an UltraSPARC running Solaris 2.5). Note that this
567 was not a problem in the default configuration, which uses PROC_VDB.
568 - The DEC Alpha assembly code needed to restore $gp between calls.
569 Thanks to Fergus Henderson for tracking this down and supplying a
570 patch.
571 - The write command for "de" was completely broken for large files.
572 I used the easiest portable fix, which involved changing the semantics
573 so that f.new is written instead of overwriting f. That's safer anyway.
574 - Added README.solaris2 with a discussion of the possible problems of
575 mixing the collector's sbrk allocation with malloc/realloc.
576 - Changed the data segment starting address for SGI machines. The
577 old code failed under IRIX6.
578 - Required double word alignment for MIPS.
579 - Various minor fixes to remove warnings.
580 - Attempted to fix some Solaris threads problems reported by Zhiying Chen.
581 In particular, the collector could try to fork a thread with the
582 world stopped as part of GC_thr_init. It also failed to deal with
583 the case in which the original thread terminated before the whole
584 process did.
585 - Added -DNO_EXECUTE_PERMISSION. This has a major performance impact
586 on the incremental collector under Irix, and perhaps under other
587 operating systems.
588 - Added some code to support allocating the heap with mmap. This may
589 be preferable under some circumstances.
590 - Integrated dynamic library support for HP.
591 (Thanks to Knut Tvedten <knuttv@ifi.uio.no>.)
592 - Integrated James Clark's win32 threads support, and made a number
593 of changes to it, many of which were suggested by Pontus Rydin.
594 This is still not 100% solid.
595 - Integrated Alistair Crooks' support for UTS4 running on an Amdahl
596 370-class machine.
597 - Fixed a serious bug in explicitly typed allocation. Objects requiring
598 large descriptors where handled in a way that usually resulted in
599 a segmentation fault in the marker. (Thanks to Jeremy Fitzhardinge
600 for helping to track this down.)
601 - Added partial support for GNU win32 development. (Thanks to Fergus
602 Henderson.)
603 - Added optional support for Java-style finalization semantics. (Thanks
604 to Patrick Bridges.) This is recommended only for Java implementations.
605 - GC_malloc_uncollectable faulted instead of returning 0 when out of
606 memory. (Thanks to dan@math.uiuc.edu for noticing.)
607 - Calls to GC_base before the collector was initialized failed on a
608 DEC Alpha. (Thanks to Matthew Flatt.)
609 - Added base pointer checking to GC_REGISTER_FINALIZER in debugging
610 mode, at the suggestion of Jeremy Fitzhardinge.
611 - GC_debug_realloc failed for uncollectable objects. (Thanks to
612 Jeremy Fitzhardinge.)
613 - Explicitly typed allocation could crash if it ran out of memory.
614 (Thanks to Jeremy Fitzhardinge.)
615 - Added minimal support for a DEC Alpha running Linux.
616 - Fixed a problem with allocation of objects whose size overflowed
617 ptrdiff_t. (This now fails unconditionally, as it should.)
618 - Added the beginning of Irix pthread support.
619 - Integrated Xiaokun Zhu's fixes for djgpp 2.01.
620 - Added SGI-style STL allocator support (gc_alloc.h).
621 - Fixed a serious bug in README.solaris2. Multithreaded programs must include
622 gc.h with SOLARIS_THREADS defined.
623 - Changed GC_free so it actually deallocates uncollectable objects.
624 (Thanks to Peter Chubb for pointing out the problem.)
625 - Added Linux ELF support for dynamic libararies. (Thanks again to
626 Patrick Bridges.)
627 - Changed the Borland cc configuration so that the assembler is not
628 required.
629 - Fixed a bug in the C++ test that caused it to fail in 64-bit
630 environments.
631
632Since 4.11:
633 - Fixed ElfW definition in dyn_load.c. (Thanks to Fergus Henderson.)
634 This prevented the dynamic library support from compiling on some
635 older ELF Linux systems.
636 - Fixed UTS4 port (which I apparently mangled during the integration)
637 (Thanks to again to Alistair Crooks.)
638 - "Make C++" failed on Suns with SC4.0, due to a problem with "bool".
639 Fixed in gc_priv.h.
640 - Added more pieces for GNU win32. (Thanks to Timothy N. Newsham.)
641 The current state of things should suffice for at least some
642 applications.
643 - Changed the out of memory retry count handling as suggested by
644 Kenjiro Taura. (This matters only if GC_max_retries > 0, which
645 is no longer the default.)
646 - If a /proc read failed repeatedly, GC_written_pages was not updated
647 correctly. (Thanks to Peter Chubb for diagnosing this.)
648 - Under unlikely circumstances, the allocator could infinite loop in
649 an out of memory situation. (Thanks again to Kenjiro Taura for
650 identifying the problem and supplying a fix.)
651 - Fixed a syntactic error in the DJGPP code. (Thanks to Fergus
652 Henderson for finding this by inspection.) Also fixed a test program
653 problem with DJGPP (Thanks to Peter Monks.)
654 - Atomic uncollectable objects were not treated correctly by the
655 incremental collector. This resulted in weird log statistics and
656 occasional performance problems. (Thanks to Peter Chubb for pointing
657 this out.)
658 - Fixed some problems resulting from compilers that dont define
659 __STDC__. In this case void * and char * were used inconsistently
660 in some cases. (Void * should not have been used at all. If
661 you have an ANSI superset compiler that does not define __STDC__,
662 please compile with -D__STDC__=0. Thanks to Manuel Serrano and others
663 for pointing out the problem.)
664 - Fixed a compilation problem on Irix with -n32 and -DIRIX_THREADS.
665 Also fixed some other IRIX_THREADS problems which may or may not have
666 had observable symptoms.
667 - Fixed an HP PA compilation problem in dyn_load.c. (Thanks to
668 Philippe Queinnec.)
669 - SEGV fault handlers sometimes did not get reset correctly. (Thanks
670 to David Pickens.)
671 - Added a fix for SOLARIS_THREADS on Intel. (Thanks again to David
672 Pickens.) This probably needs more work to become functional.
673 - Fixed struct sigcontext_struct in os_dep.c for compilation under
674 Linux 2.1.X. (Thanks to Fergus Henderson.)
675 - Changed the DJGPP STACKBOTTOM and DATASTART values to those suggested
676 by Kristian Kristensen. These may still not be right, but it is
677 it is likely to work more often than what was there before. They may
678 even be exactly right.
679 - Added a #include <string.h> to test_cpp.cc. This appears to help
680 with HP/UX and gcc. (Thanks to assar@sics.se.)
681 - Version 4.11 failed to run in incremental mode on recent 64-bit Irix
682 kernels. This was a problem related to page unaligned heap segments.
683 Changed the code to page align heap sections on all platforms.
684 (I had mistakenly identified this as a kernel problem earlier.
685 It was not.)
686 - Version 4.11 did not make allocated storage executable, except on
687 one or two platforms, due to a bug in a #if test. (Thanks to Dave
688 Grove for pointing this out.)
689 - Added sparc_sunos4_mach_dep.s to support Sun's compilers under SunOS4.
690 - Added GC_exclude_static_roots.
691 - Fixed the object size mapping algorithm. This shouldn't matter,
692 but the old code was ugly.
693 - Heap checking code could die if one of the allocated objects was
694 larger than its base address. (Unsigned underflow problem. Thanks
695 to Clay Spence for isolating the problem.)
696 - Added RS6000 (AIX) dynamic library support and fixed STACK_BOTTOM.
697 (Thanks to Fred Stearns.)
698 - Added Fergus Henderson's patches for improved robustness with large
699 heaps and lots of blacklisting.
700 - Added Peter Chubb's changes to support Solaris Pthreads, to support
701 MMAP allocation in Solaris, to allow Solaris to find dynamic libraries
702 through /proc, to add malloc_typed_ignore_off_page, and a few other
703 minor features and bug fixes.
704 - The Solaris 2 port should not use sbrk. I received confirmation from
705 Sun that the use of sbrk and malloc in the same program is not
706 supported. The collector now defines USE_MMAP by default on Solaris.
707 - Replaced the djgpp makefile with Gary Leavens' version.
708 - Fixed MSWIN32 detection test.
709 - Added Fergus Henderson's patches to allow putting the collector into
710 a DLL under GNU win32.
711 - Added Ivan V. Demakov's port to Watcom C on X86.
712 - Added Ian Piumarta's Linux/PowerPC port.
713 - On Brian Burton's suggestion added PointerFreeGC to the placement
714 options in gc_cpp.h. This is of course unsafe, and may be controversial.
715 On the other hand, it seems to be needed often enough that it's worth
716 adding as a standard facility.
717
718Since 4.12:
719 - Fixed a crucial bug in the Watcom port. There was a redundant decl
720 of GC_push_one in gc_priv.h.
721 - Added FINALIZE_ON_DEMAND.
722 - Fixed some pre-ANSI cc problems in test.c.
723 - Removed getpagesize() use for Solaris. It seems to be missing in one
724 or two versions.
725 - Fixed bool handling for SPARCCompiler version 4.2.
726 - Fixed some files in include that had gotten unlinked from the main
727 copy.
728 - Some RS/6000 fixes (missing casts). Thanks to Toralf Foerster.
729 - Fixed several problems in GC_debug_realloc, affecting mostly the
730 FIND_LEAK case.
731 - GC_exclude_static_roots contained a buggy unsigned comparison to
732 terminate a loop. (Thanks to Wilson Ho.)
733 - CORD_str failed if the substring occurred at the last possible position.
734 (Only affects cord users.)
735 - Fixed Linux code to deal with RedHat 5.0 and integrated Peter Bigot's
736 os_dep.c code for dealing with various Linux versions.
737 - Added workaround for Irix pthreads sigaction bug and possible signal
738 misdirection problems.
739Since alpha1:
740 - Changed RS6000 STACKBOTTOM.
741 - Integrated Patrick Beard's Mac changes.
742 - Alpha1 didn't compile on Irix m.n, m < 6.
743 - Replaced Makefile.dj with a new one from Gary Leavens.
744 - Added Andrew Stitcher's changes to support SCO OpenServer.
745 - Added PRINT_BLACK_LIST, to allow debugging of high densities of false
746 pointers.
747 - Added code to debug allocator to keep track of return address
748 in GC_malloc caller, thus giving a bit more context.
749 - Changed default behavior of large block allocator to more
750 aggressively avoid fragmentation. This is likely to slow down the
751 collector when it succeeds at reducing space cost.
752 - Integrated Fergus Henderson's CYGWIN32 changes. They are untested,
753 but needed for newer versions.
754 - USE_MMAP had some serious bugs. This caused the collector to fail
755 consistently on Solaris with -DSMALL_CONFIG.
756 - Added Linux threads support, thanks largely to Fergus Henderson.
757Since alpha2:
758 - Fixed more Linux threads problems.
759 - Changed default GC_free_space_divisor to 3 with new large block allocation.
760 (Thanks to Matthew Flatt for some measurements that suggest the old
761 value sometimes favors space too much over time.)
762 - More CYGWIN32 fixes.
763 - Integrated Tyson-Dowd's Linux-M68K port.
764 - Minor HP PA and DEC UNIX fixes from Fergus Henderson.
765 - Integrated Christoffe Raffali's Linux-SPARC changes.
766 - Allowed for one more GC fixup iteration after a full GC in incremental
767 mode. Some quick measurements suggested that this significantly
768 reduces pause times even with smaller GC_RATE values.
769 - Moved some more GC data structures into GC_arrays. This decreases
770 pause times and GC overhead, but makes debugging slightly less convenient.
771 - Fixed namespace pollution problem ("excl_table").
772 - Made GC_incremental a constant for -DSMALL_CONFIG, hopefully shrinking
773 that slightly.
774 - Added some win32 threads fixes.
775 - Integrated Ivan Demakov and David Stes' Watcom fixes.
776 - Various other minor fixes contributed by many people.
777 - Renamed config.h to gcconfig.h, since config.h tends to be used for
778 many other things.
779 - Integrated Matthew Flatt's support for 68K MacOS "far globals".
780 - Fixed up some of the dynamic library Makefile targets for consistency
781 across platforms.
782 - Fixed a USE_MMAP typo that caused out-of-memory handling to fail
783 on Solaris.
784 - Added code to test.c to test thread creation a bit more.
785 - Integrated GC_win32_free_heap, as suggested by Ivan Demakov.
786 - Fixed Solaris 2.7 stack base finding problem. (This may actually
787 have been done in an earlier alpha release.)
788Since alpha3:
789 - Fixed MSWIN32 recognition test, which interfered with cygwin.
790 - Removed unnecessary gc_watcom.asm from distribution. Removed
791 some obsolete README.win32 text.
792 - Added Alpha Linux incremental GC support. (Thanks to Philipp Tomsich
793 for code for retrieving the fault address in a signal handler.)
794 Changed Linux signal handler context argument to be a pointer.
795 - Took care of some new warnings generated by the 7.3 SGI compiler.
796 - Integrated Phillip Musumeci's FreeBSD/ELF fixes.
797 - -DIRIX_THREADS was broken with the -o32 ABI (typo in gc_priv.h>
798
799Since 4.13:
800 - Fixed GC_print_source_ptr to not use a prototype.
801 - generalized CYGWIN test.
802 - gc::new did the wrong thing with PointerFreeGC placement.
803 (Thanks to Rauli Ruohonen.)
804 - In the ALL_INTERIOR_POINTERS (default) case, some callee-save register
805 values could fail to be scanned if the register was saved and
806 reused in a GC frame. This showed up in verbose mode with gctest
807 compiled with an unreleased SGI compiler. I vaguely recall an old
808 bug report that may have been related. The bug was probably quite old.
809 (The problem was that the stack scanning could be deferred until
810 after the relevant frame was overwritten, and the new save location
811 might be outside the scanned area. Fixed by more eager stack scanning.)
812 - PRINT_BLACK_LIST had some problems. A few source addresses were garbage.
813 - Replaced Makefile.dj and added -I flags to cord make targets.
814 (Thanks to Gary Leavens.)
815 - GC_try_to_collect was broken with the nonincremental collector.
816 - gc_cleanup destructors could pass the wrong address to
817 GC_register_finalizer_ignore_self in the presence of multiple
818 inheritance. (Thanks to Darrell Schiebel.)
819 - Changed PowerPC Linux stack finding code.
820
821Since 4.14alpha1
822 - -DSMALL_CONFIG did not work reliably with large (> 4K) pages.
823 Recycling the mark stack during expansion could result in a size
824 zero heap segment, which confused things. (This was probably also an
825 issue with the normal config and huge pages.)
826 - Did more work to make sure that callee-save registers were scanned
827 completely, even with the setjmp-based code. Added USE_GENERIC_PUSH_REGS
828 macro to facilitate testing on machines I have access to.
829 - Added code to explicitly push register contents for win32 threads.
830 This seems to be necessary. (Thanks to Pierre de Rop.)
831
832Since 4.14alpha2
833 - changed STACKBOTTOM for DJGPP (Thanks to Salvador Eduardo Tropea).
834
835Since 4.14
836 - Reworked large block allocator. Now uses multiple doubly linked free
837 lists to approximate best fit.
838 - Changed heap expansion heuristic. Entirely free blocks are no longer
839 counted towards the heap size. This seems to have a major impact on
840 heap size stability; the old version could expand the heap way too
841 much in the presence of large block fragmentation.
842 - added -DGC_ASSERTIONS and some simple assertions inside the collector.
843 This is mainlyt for collector debugging.
844 - added -DUSE_MUNMAP to allow the heap to shrink. Suupported on only
845 a few UNIX-like platforms for now.
846 - added GC_dump_regions() for debugging of fragmentation issues.
847 - Changed PowerPC pointer alignment under Linux to 4. (This needs
848 checking by someone who has one. The suggestions came to me via a
849 rather circuitous path.)
850 - Changed the Linux/Alpha port to walk the data segment backwards until
851 it encounters a SIGSEGV. The old way to find the start of the data
852 segment broke with a recent release.
853 - cordxtra.c needed to call GC_REGISTER_FINALIZER instead of
854 GC_register_finalizer, so that it would continue to work with GC_DEBUG.
855 - allochblk sometimes cleared the wrong block for debugging purposes
856 when it dropped blacklisted blocks. This could result in spurious
857 error reports with GC_DEBUG.
858 - added MACOS X Server support. (Thanks to Andrew Stone.)
859 - Changed the Solaris threads code to ignore stack limits > 8 MB with
860 a warning. Empirically, it is not safe to access arbitrary pages
861 in such large stacks. And the dirty bit implementation does not
862 guarantee that none of them will be accessed.
863 - Integrated Martin Tauchmann's Amiga changes.
864 - Integrated James Dominy's OpenBSD/SPARC port.
865
866Since 5.0alpha1
867 - Fixed bugs introduced in alpha1 (OpenBSD & large block initialization).
868 - Added -DKEEP_BACK_PTRS and backptr.h interface. (The implementation
869 idea came from Al Demers.)
870
871Since 5.0alpha2
872 - Added some highly incomplete code to support a copied young generation.
873 Comments on nursery.h are appreciated.
874 - Changed -DFIND_LEAK, -DJAVA_FINALIZATION, and -DFINALIZE_ON_DEMAND,
875 so the same effect could be obtained with a runtime switch. This is
876 a step towards standardizing on a single dynamic GC library.
877 - Significantly changed the way leak detection is handled, as a consequence
878 of the above.
879
880Since 5.0 alpha3
881 - Added protection fault handling patch for Linux/M68K from Fergus
882 Henderson and Roman Hodek.
883 - Removed the tests for SGI_SOURCE in new_gc_alloc.h. This was causing that
884 interface to fail on nonSGI platforms.
885 - Changed the Linux stack finding code to use /proc, after changing it
886 to use HEURISTIC1. (Thanks to David Mossberger for pointing out the
887 /proc hook.)
888 - Added HP/UX incremental GC support and HP/UX 11 thread support.
889 Thread support is currently still flakey.
890 - Added basic Linux/IA64 support.
891 - Integrated Anthony Green's PicoJava support.
892 - Integrated Scott Ananian's StrongARM/NetBSD support.
893 - Fixed some fairly serious performance bugs in the incremental
894 collector. These have probably been there essentially forever.
895 (Mark bits were sometimes set before scanning dirty pages.
896 The reclaim phase unnecessarily dirtied full small object pages.)
897 - Changed the reclaim phase to ignore nearly full pages to avoid
898 touching them.
899 - Limited GC_black_list_spacing to roughly the heap growth increment.
900 - Changed full collection triggering heuristic to decrease full GC
901 frequency by default, but to explicitly trigger full GCs during
902 heap growth. This doesn't always improve things, but on average it's
903 probably a win.
904 - GC_debug_free(0, ...) failed. Thanks to Fergus Henderson for the
905 bug report and fix.
906
907Since 5.0 alpha4
908 - GC_malloc_explicitly_typed and friends sometimes failed to
909 initialize first word.
910 - Added allocation routines and support in the marker for mark descriptors
911 in a type structure referenced by the first word of an object. This was
912 introduced to support gcj, but hopefully in a way that makes it
913 generically useful.
914 - Added GC_requested_heapsize, and inhibited collections in nonincremental
915 mode if the actual used heap size is less than what was explicitly
916 requested.
917 - The Solaris pthreads version of GC_pthread_create didn't handle a NULL
918 attribute pointer. Solaris thread support used the wrong default thread
919 stack size. (Thanks to Melissa O'Neill for the patch.)
920 - Changed PUSH_CONTENTS macro to no longer modify first parameter.
921 This usually doesn't matter, but it was certainly an accident waiting
922 to happen ...
923 - Added GC_register_finalizer_no_order and friends to gc.h. They're
924 needed by Java implementations.
925 - Integrated a fix for a win32 deadlock resulting from clock() calling
926 malloc. (Thanks to Chris Dodd.)
927 - Integrated Hiroshi Kawashima's port to Linux/MIPS. This was designed
928 for a handheld platform, and may or may not be sufficient for other
929 machines.
930 - Fixed a va_arg problem with the %c specifier in cordprnt.c. It appears
931 that this was always broken, but recent versions of gcc are the first to
932 report the (statically detectable) bug.
933 - Added an attempt at a more general solution to dlopen races/deadlocks.
934 GC_dlopen now temporarily disables collection. Still not ideal, but ...
935 - Added -DUSE_I686_PREFETCH, -DUSE_3DNOW_PREFETCH, and support for IA64
936 prefetch instructions. May improve performance measurably, but I'm not
937 sure the code will run correctly on processors that don't support the
938 instruction. Won't build except with very recent gcc.
939 - Added caching for header lookups in the marker. This seems to result
940 in a barely measurable performance gain. Added support for interleaved
941 lookups of two pointers, but unconfigured that since the performance
942 gain is currently near zero, and it adds to code size.
943 - Changed Linux DATA_START definition to check both data_start and
944 __data_start, since nothing else seems to be portable.
945 - Added -DUSE_LD_WRAP to optionally take advantage of the GNU ld function
946 wrapping mechanism. Probably currently useful only on Linux.
947 - Moved some variables for the scratch allocator into GC_arrays, on
948 Martin Hirzel's suggestion.
949 - Fixed a win32 threads bug that caused the collector to not look for
950 interior pointers from one of the thread stacks without
951 ALL_INTERIOR_POINTERS. (Thanks to Jeff Sturm.)
952 - Added Mingw32 support. (Thanks again to Jeff Sturm for the patch.)
953 - Changed the alpha port to use the generic register scanning code instead
954 of alpha_mach_dep.s. Alpha_mach_dep.s doesn't look for pointers in fp
955 registers, but gcc sometimes spills pointers there. (Thanks to Manuel
956 Serrano for helping me debug this by email.) Changed the IA64 code to
957 do something similar for similar reasons.
958
959[5.0alpha5 doesn't really exist, but it may have escaped.]
960
961Since 5.0alpha6:
962 - -DREDIRECT_MALLOC was broken in alpha6. Fixed.
963 - Cleaned up gc_ccp.h slightly, thus also causing the HP C++ compiler to
964 accept it.
965 - Removed accidental reference to dbg_mlc.c, which caused dbg_mlc.o to be
966 linked into every executable.
967 - Added PREFETCH to bitmap marker. Changed it to use the header cache.
968 - GC_push_marked sometimes pushed one object too many, resulting in a
969 segmentation fault in GC_mark_from_mark_stack. This was probably an old
970 bug. It finally showed up in gctest on win32.
971 - Gc_priv.h erroneously #defined GC_incremental to be TRUE instead of FALSE
972 when SMALL_CONFIG was defined. This was no doubt a major performance bug for
973 the default win32 configuration.
974 - Removed -DSMALL_CONFIG from NT_MAKEFILE. It seemed like an anchronism now
975 that the average PC has 64MB or so.
976 - Integrated Bryce McKinley's patches for linux threads and dynamic loading
977 from the libgcj tree. Turned on dynamic loading support for Linux/PPC.
978 - Changed the stack finding code to use environ on HP/UX. (Thanks
979 to Gustavo Rodriguez-Rivera for the suggestion.) This should probably
980 be done on other platforms, too. Since I can't test those, that'll
981 wait until after 5.0.
982
983Since 5.0alpha7:
984 - Fixed threadlibs.c for linux threads. -DUSE_LD_WRAP was broken and
985 -ldl was omitted. Fixed Linux stack finding code to handle
986 -DUSE_LD_WRAP correctly.
987 - Added MSWIN32 exception handler around marker, so that the collector
988 can recover from root segments that are unmapped during the collection.
989 This caused occasional failures under Windows 98, and may also be
990 an issue under Windows NT/2000.
991
992Since 5.0
993 - Fixed a gc.h header bug which showed up under Irix. (Thanks to
994 Dan Sullivan.)
995 - Fixed a typo in GC_double_descr in typd_mlc.c.
996 This probably could result in objects described by array descriptors not
997 getting traced correctly. (Thanks to Ben Hutchings for pointing this out.)
998 - The block nearly full tests in reclaim.c were not correct for 64 bit
999 environments. This could result in unnecessary heap growth under unlikely
1000 conditions.
1001
1002Since 5.1
1003 - dyn_load.c declared GC_scratch_last_end_ptr as an extern even if it
1004 was defined as a macro. This prevented the collector from building on
1005 Irix.
1006 - We quietly assumed that indirect mark descriptors were never 0.
1007 Our own typed allocation interface violated that. This could result
1008 in segmentation faults in the marker with typed allocation.
1009 - Fixed a _DUSE_MUNMAP bug in the heap block allocation code.
1010 (Thanks to Ben Hutchings for the patch.)
1011 - Taught the collector about VC++ handling array operator new.
1012 (Thanks again to Ben Hutchings for the patch.)
1013 - The two copies of gc_hdrs.h had diverged. Made one a link to the other
1014 again.
1015
1016Since 5.2 (A few 5.2 patches are not in 6.0alpha1)
1017 - Fixed _end declaration for OSF1.
1018 - There were lots of spurious leak reports in leak detection mode, caused
1019 by the fact that some pages were not being swept, and hence unmarked
1020 objects weren't making it onto free lists. (This bug dated back to 5.0.)
1021 - Fixed a typo in the liblinuxgc.so Makefile rule.
1022 - Added the GetExitCodeThread to Win32 GC_stop_world to (mostly) work
1023 around a Windows 95 GetOpenFileName problem. (Thanks to Jacob Navia.)
1024
1025Since 5.3
1026 - Fixed a typo that prevented compilation with -DUSE_3DNOW_PREFETCH.
1027 (Thanks to Shawn Wagner for actually testing this.)
1028 - Fixed GC_is_thread_stack in solaris_threads.c. It forgot to return a value
1029 in the common case. I wonder why nobody noticed?
1030 - Fixed another silly syntax problem in GC_double_descr. (Thanks to
1031 Fergus Henderson for finding it.)
1032 - Fixed a GC_gcj_malloc bug: It tended to release the allocator lock twice.
1033
1034Since 5.4 (A few 5.3 patches are not in 6.0alpha2)
1035 - Added HP/PA prefetch support.
1036 - Added -DDBG_HDRS_ALL and -DSHORT_DBG_HDRS to reduce the cost and improve
1037 the reliability of generating pointer backtrace information, e.g. in
1038 the Bigloo environment.
1039 - Added parallel marking support (-DPARALLEL_MARK). This currently
1040 works only under IA32 and IA64 Linux, but it shouldn't be hard to adapt
1041 to other platforms. This is intended to be a lighter-weight (less
1042 new code, probably not as scalable) solution than the work by Toshio Endo
1043 et al, at the University of Tokyo. A number of their ideas were
1044 reused, though the code wasn't, and the underlying data structure
1045 is significantly different. In particular, we keep the global mark
1046 stack as a single shared data structure, but most of the work is done
1047 on smaller thread-local mark stacks.
1048 - Changed GC_malloc_many to be cheaper, and to require less mutual exclusion
1049 with -DPARALLEL_MARK.
1050 - Added full support for thread local allocation under Linux
1051 (-DTHREAD_LOCAL_ALLOC). This is a thin veneer on GC_malloc_many, and
1052 should be easily portable to other platforms, especially those that
1053 support pthreads.
1054 - CLEAR_DOUBLE was not always getting invoked when it should have been.
1055 - GC_gcj_malloc and friends used different out of memory handling than
1056 everything else, probably because I forgot about one when I implemented
1057 the other. They now both call GC_oom_fn(), not GC_oom_action().
1058 - Integrated Jakub Jelinek's fixes for Linux/SPARC.
1059 - Moved GC_objfreelist, GC_aobjfreelist, and GC_words_allocd out of
1060 GC_arrays, and separately registered the first two as excluded roots.
1061 This makes code compiled with gc_inl.h less dependent on the
1062 collector version. (It would be nice to remove the inclusion of
1063 gc_priv.h by gc_inl.h completely, but we're not there yet. The
1064 locking definitions in gc_priv.h are still referenced.)
1065 This change was later coniditoned on SEPARATE_GLOBALS, which
1066 is not defined by default, since it involves a performance hit.
1067 - Register GC_obj_kinds separately as an excluded root region. The
1068 attempt to register it with GC_arrays was usually failing. (This wasn't
1069 serious, but seemed to generate some confusion.)
1070 - Moved backptr.h to gc_backptr.h.
1071
1072Since 6.0alpha1
1073 - Added USE_MARK_BYTES to reduce the need for compare-and-swap on platforms
1074 for which that's expensive.
1075 - Fixed a locking bug ib GC_gcj_malloc and some locking assertion problems.
1076 - Added a missing volatile to OR_WORD and renamed the parameter to
1077 GC_compare_and_swap so it's not a C++ reserved word. (Thanks to
1078 Toshio Endo for pointing out both of those.)
1079 - Changed Linux dynamic library registration code to look at /proc/self/maps
1080 instead of the rld data structures when REDIRECT_MALLOC is defined.
1081 Otherwise some of the rld data data structures may be prematurely garbage
1082 collected. (Thanks to Eric Benson for helping to track this down.)
1083 - Fixed USE_LD_WRAP a bit more, so it should now work without threads.
1084 - Renamed XXX_THREADS macros to GC_XXX_THREADS for namespace correctness.
1085 Tomporarily added some backward compatibility definitions. Renamed
1086 USE_LD_WRAP to GC_USE_LD_WRAP.
1087 - Many MACOSX POWERPC changes, some additions to the gctest output, and
1088 a few minor generic bug fixes. (Thanks to Dietmar Planitzer.)
1089
1090Since 6.0 alpha2
1091 - Fixed the /proc/self/maps code to not seek, since that apparently is not
1092 reliable across all interesting kernels.
1093 - Fixed some compilation problems in the absence of PARALLEL_MARK
1094 (introduced in alpha2).
1095 - Fixed an algorithmic problem with PARALLEL_MARK. If work needs to
1096 be given back to the main mark "stack", the BOTTOM entries of the local
1097 stack should be given away, not the top ones. This has substantial
1098 performance impact, especially for > 2 processors, from what I can tell.
1099 - Extracted gc_lock.h from gc_priv.h. This should eventually make it a
1100 bit easier to avoid including gc_priv.h in clients.
1101 - Moved all include files to include/ and removed duplicate links to the
1102 same file. The old scheme was a bad idea because it was too easy to get the
1103 copies out of sync, and many systems don't support hard links.
1104 Unfortunately, it's likely that I broke some of the non-Unix Makefiles in
1105 the process, although I tried to update them appropriately.
1106 - Removed the partial support for a copied nursery. It's not clear that
1107 this would be a tremendous win, since we don't consistently lose to
1108 generational copying collectors. And it would significantly complicate
1109 many things. May be reintroduced if/when it really turns out to win.
1110 - Removed references to IRIX_JDK_THREADS, since I believe there never
1111 were and never will be any clients.
1112 - Added some code to linux_threads.c to possibly support HPUX threads
1113 using the Linux code. Unfortunately, it doesn't work yet, and is
1114 currently disabled.
1115 - Added support under Linux/X86 for saving the call chain, both in (debug)
1116 objects for client debugging, and in GC_arrays._last_stack for GC
1117 debugging. This was previously supported only under Solaris. It is
1118 not enabled by default under X86, since it requires that code be compiled
1119 to explicitly dave frame pointers on the call stack. (With gcc this
1120 currently happens by default, but is often turned off explicitly.)
1121 To turn it on, define SAVE_CALL_CHAIN.
1122
1123Since 6.0 alpha3
1124 - Moved up the detection of mostly full blocks to the initiatiation of the
1125 sweep phase. This eliminates some lock conention in the PARALLEL_MARK case,
1126 as multiple threads try to look at mostly full blocks concurrently.
1127 - Restored the code in GC_malloc_many that grabs a prefix of the global
1128 free list. This avoids the case in which every GC_malloc_many call
1129 tries and fails to allocate a new heap block, and the returns a single
1130 object from the global free list.
1131 - Some minor fixes in new_hblk.c. (Attempted to build free lists in order
1132 of increasing addresses instead of decreasing addresses for cache performance
1133 reasons. But this seems to be only a very minor gain with -DEAGER_SWEEP,
1134 and a loss in other cases. So the change was backed out.)
1135 - Fixed some of the documentation. (Thanks in large part to Fergus
1136 Henderson.)
1137 - Fixed the Linux USE_PROC_FOR_LIBRARIES code to deal with apps that perform
1138 large numbers of mmaps. (Thanks to Eric Benson.) Also fixed that code to
1139 deal with short reads.
1140 - Added GC_get_total_bytes().
1141 - Fixed leak detection mode to avoid spurious messages under linuxthreads.
1142 (This should also now be easy for the other supported threads packages.
1143 But the code is tricky enough that I'm hesitant to do it without being able
1144 to test. Everything allocated in the GC thread support itself should be
1145 explicitly deallocated.)
1146 - Made it possible (with luck) to redirect malloc to GC_local_malloc.
1147
1148Since 6.0 alpha4
1149 - Changed the definition of GC_pause in linux_threads.c to use a volatile
1150 asm. Some versions of gcc apparently optimize away writes to local volatile
1151 variables. This caused poor locking behaviour starting at about
1152 4 processors.
1153 - Added GC_start_blocking(), GC_end_blocking() calls and wrapper for sleep
1154 to linux_threads.c.
1155 The first two calls could be used to generally avoid sending GC signals to
1156 blocked threads, avoiding both premature wakeups and unnecessary overhead.
1157 - Fixed a serious bug in thread-local allocation. At thread termination,
1158 GC_free could get called on small integers. Changed the code for thread
1159 termination to more efficiently return left-over free-lists.
1160 - Integrated Kjetil Matheussen's BeOS support.
1161 - Rearranged the directory structure to create the doc and tests
1162 subdirectories.
1163 - Sort of integrated Eric Benson's patch for OSF1. This provided basic
1164 OSF1 thread support by suitably extending hpux_irix_threads.c. Based
1165 on earlier email conversations with David Butenhof, I suspect that it
1166 will be more reliable in the long run to base this on linux_threads.c
1167 instead. Thus I attempted to patch up linux_threads.c based on Eric's code.
1168 The result is almost certainly broken, but hopefully close enough that
1169 someone with access to a machine can pick it up.
1170 - Integrated lots of minor changes from the NetBSD distribution. (These
1171 were supplied by David Brownlee. I'm not sure about the original
1172 authors.)
1173 - Hacked a bit more on the HP/UX thread-support in linux_threads.c. It
1174 now appears to work in the absence of incremental collection. Renamed
1175 hpux_irix_threads.c back to irix_threads.c, and removed the attempt to
1176 support HPUX there.
1177 - Changed gc.h to define _REENTRANT in cases in which it should already
1178 have been defined. It is still safer to also define it on the command
1179 line.
1180
1181Since 6.0alpha5:
1182 - Changed the definition of DATASTART on ALPHA and IA64, where data_start
1183 and __data_start are not defined by earlier versions of glibc. This might
1184 need to be fixed on other platforms as well.
1185 - Changed the way the stack base and backing store base are found on IA64.
1186 This should now remain reliable on future kernels. But since it relies
1187 on /proc, it will no longer work in the simulated NUE environment.
1188 - Made the call to random() in dbg_mlc.c with -DKEEP_BACK_PTRS dependent
1189 on the OS. On non-Unix systems, rand() should be used instead. Handled
1190 small RAND_MAX. (Thanks to Peter Ross for pointing this out.)
1191 - Fixed the cord make rules to create the cord subdirectory, if necessary.
1192 (Thanks to Doug Moen.)
1193 - Changed fo_object_size calculation in finalize.c. Turned finalization
1194 of nonheap object into a no-op. Removed anachronism from GC_size()
1195 implementation.
1196 - Changed GC_push_dirty call in solaris_threads.c to GC_push_selected.
1197 It was missed in a previous renaming. (Thanks to Vladimir Tsichevski
1198 for pointing this out.)
1199 - Arranged to not not mask SIGABRT in linux_threads.c. (Thanks to Bryce
1200 McKinlay.)
1201 - Added GC_no_dls hook for applications that want to register their own
1202 roots.
1203 - Integrated Kjetil Matheussen's Amiga changes.
1204 - Added FREEBSD_STACKBOTTOM. Changed the X86/FreeBSD port to use it.
1205 (Thanks to Matthew Flatt.)
1206 - Added pthread_detach interception for platforms supported by linux_threads.c
1207 and irix_threads.c. Should also be added for Solaris?
1208 - Changed the USE_MMAP code to check for the case in which we got the
1209 high end of the address space, i.e. mem_ptr + mem_sz == 0. It appears
1210 that this can happen under Solaris 7. It seems to be allowed by what
1211 I would claim is an oversight in the mmap specification. (Thanks to Toshio
1212 Endo for pointing out the problem.)
1213 - Cleanup of linux_threads.c. Some code was originally cloned from
1214 irix_threads.c and now unnecessary. Some comments were obviously wrong.
1215 - (Mostly) fixed a longstanding problem with setting of dirty bits from
1216 a signal handler. In the presence of threads, dirty bits could get lost,
1217 since the etting of a bit in the bit vector was not atomic with respect
1218 to other updates. The fix is 100% correct only for platforms for which
1219 GC_test_and_set is defined. The goal is to make that all platforms with
1220 thread support. Matters only if incremental GC and threads are both
1221 enabled.
1222 - made GC_all_interior_pointers (a.k.a. ALL_INTERIOR_POINTERS) an
1223 initialization time, instead of build-time option. This is a
1224 nontrivial, high risk change. It should slow down the code measurably
1225 only if MERGE_SIZES is not defined, which is a very nonstandard
1226 configuration.
1227 - Added doc/README.environment, and implemented what it describes. This
1228 allows a number of additional configuration options to be set through
1229 the environment. It documents a few previously undocumented options.
1230 - Integrated Eric Benson's leak testing improvements.
1231 - Removed the option to throw away the beginning of each page (DISCARD_WORDS).
1232 This became less and less useful as processors enforce stricter alignment.
1233 And it hadn't been tested in ages, and was thus probably broken anyway.
1234
1235Since 6.0alpha6:
1236 - Added GC_finalizer_notifier. Fixed GC_finalize_on_demand. (The variable
1237 actually wasn't being tested at the right points. The build-time flag
1238 was.)
1239 - Added Tom Tromey's S390 Linux patch.
1240 - Added code to push GC_finalize_now in GC_push_finalizer_structures.
1241 (Thanks to Matthew Flatt.)
1242 - Added GC_push_gc_structures() to push all GC internal roots.
1243 - Integrated some FreeBSD changes from Matthew Flatt.
1244 - It looks like USRSTACK is not always correctly defined under Solaris.
1245 Hacked gcconfig.h to attempt to work around the problem. The result
1246 is not well tested. (Thanks again to Matthew Flatt for pointing this
1247 out. The gross hack is mine. - HB)
1248 - Added Ji-Yong Chung's win32 threads and C++ fixes.
1249 - Arranged for hpux_test_and_clear.s to no longer be needed or built.
1250 It was causing build problems with gas, and it's not clear this is
1251 better than the pthreads alternative on this platform.
1252 - Some MINGW32 fixes from Hubert Garavel.
1253 - Added Initial Hitachi SH4 port from Kaz Kojima.
1254 - Ported thread-local allocation and parallel mark code to HP/UX on PA_RISC.
1255 - Made include/gc_mark.h more public and separated out the really private
1256 pieces. This is probably still not quite sufficient for clients that
1257 want to supply their own kind of type information. But it's a start.
1258 This involved lots of identifier renaming to make it namespace clean.
1259 - Added GC_dont_precollect for clients that need complete control over
1260 the root set.
1261 - GC_is_visible didn't do the right thing with gcj objects. (Not that
1262 many people are likely to care, but ...)
1263 - Don't redefine read with GC_USE_LD_WRAP.
1264 - Initial port to LINUX/HP_PA. Incremental collection and threads are not
1265 yet supported. (Incremental collection should work if you have the
1266 right kernel. Threads may work with a sufficiently patched pthread
1267 library.)
1268 - Changed gcconfig.h to recognize __i386__ as an alternative to i386 in
1269 many places. (Thanks to Benjamin Lerman.)
1270 - Made win32_threads.c more tolerant of detaching a thread that it didn't
1271 know about. (Thanks to Paul Nash.)
1272 - Added Makefile.am and configure.in from gcc to the distribution, with
1273 minimal changes. For the moment, those are just placeholders. In the
1274 future, we're planning to switch to a GNU-style build environment for
1275 Un*x-like systems, though the old Makefile will remain as a backup.
1276 - Turned off STUBBORN_ALLOC by default, and added it back as a Makefile
1277 option.
1278 - Redistributed some functions between malloc.c and mallocx.c, so that
1279 simple statically linked apps no longer pull in mallocx.o.
1280 - Changed large object allocation to clear the first and last few words
1281 of each block before releassing the lock. Otherwise the marker could see
1282 objects with nonsensical type descriptors.
1283 - Fixed a couple of subtle problems that could result in not recognizing
1284 interior pointers from the stack. (I believe these were introduced
1285 in 6.0alpha6.)
1286 - GC_debug_free_inner called GC_free, which tried to reacquire the
1287 allocator lock, and hence deadlocked. (DBG_HDRS_ALL probably never worked
1288 with threads?)
1289 - Fixed several problems with back traces. Accidental references to a free
1290 list could cause the free list pointer to be overwritten by a back pointer.
1291 There seemed to be some problems with the encoding of root and finalizer
1292 references.
1293
1294Since 6.0alpha7:
1295 - Changed GC_debug_malloc_replacement and GC_debug_realloc_replacement
1296 so that they compile under Irix. (Thanks to Dave Love.)
1297 - Updated powerpc_macosx_mach_dep.s so that it works if the collector
1298 is in a dynamic library. (Thanks to Andrew Begel.)
1299 - Transformed README.debugging into debugging.html, updating and
1300 expanding it in the process. Added gcdescr.html and tree.html
1301 from the web site to the GC distribution.
1302 - Fixed several problems related to PRINT_BLACK_LIST. This involved
1303 restructuring some of the marker macros.
1304 - Fixed some problems with the sizing of objects with debug information.
1305 Finalization was broken KEEP_BACK_PTRS or PRINT_BLACK_LIST. Reduced the
1306 object size with SHORT_DEBUG_HDRS by another word.
1307 - The "Needed to allocate blacklisted ..." warning had inadvertently
1308 been turned off by default, due to a buggy test in allchblk.c. Turned
1309 it back on.
1310 - Removed the marker macros to deal with 2 pointers in interleaved fashion.
1311 They were messy and the performance improvement seemed minimal. We'll
1312 leave such scheduling issues to the compiler.
1313 - Changed Linux/PowerPC test to also check for __powerpc__ in response
1314 to a discussion on the gcc mailing list.
1315 - On Matthew Flatt's suggestion removed the "static" from the jmp_buf
1316 declaration in GC_generic_push_regs. This was causing problems in
1317 systems that register all of their own roots. It looks far more correct
1318 to me without the "static" anyway.
1319 - Fixed several problems with thread local allocation of pointerfree or
1320 typed objects. The collector was reclaiming thread-local free lists, since
1321 it wasn't following the link fields.
1322 - There was apparently a long-standing race condition related to multithreaded
1323 incremental collection. A collection could be started and a thread stopped
1324 between the memory unprotect system call and the setting of the
1325 corresponding dirt bit. I believe this did not affect Solaris or PCR, which
1326 use a different dirty-bit implementation. Fixed this by installing
1327 signal handlers with sigaction instead of signal, and disabling the thread
1328 suspend signal while in the write-protect handler. (It is unclear
1329 whether this scenario ever actually occurred. I found it while tracking
1330 down the following:)
1331 - Incremental collection did not cooperate correctly with the PARALLEL_MARK
1332 implementation of GC_malloc_many or the local_malloc primitves. It still
1333 doesn't work well, but it shouldn't lose memory anymore.
1334 - Integrated some changes from the gcc source tree that I had previously
1335 missed. (Thanks to Bryce McKinley for the reminder/diff.)
1336 - Added Makefile.direct as a copy of the default Makefile, which would
1337 normally be overwritten if configure is run.
1338 - Changed the gc.tar target in Makefile.direct to embed the version number
1339 in the gc directory name. This will affect future tar file distributions.
1340 - Changed the Irix dynamic library finding code to no longer try to
1341 eliminate writable text segments under Irix6.x, since that is probably no
1342 longer necessary, and can apparently be unsafe on occasion. (Thanks to
1343 Shiro Kawai for pointing this out.)
1344 - GC_cleanup with GC_DEBUG enabled passed a real object base address to
1345 GC_debug_register_finalizer_ignore_self, which expected a pointer past the
1346 debug header. Call GC_register_finalizer_ignore_self instead, even with
1347 debugging enabled. (Thanks to Jean-Daniel Fekete for catching this.)
1348 - The collector didn't build with call chain saving enabled but NARGS=0.
1349 (Thanks to Maarten Thibaut.)
1350 - Fixed up the GNU-style build files enough so that they work in some
1351 obvious cases.
1352 - Added initial port to Digital Mars compiler for win32. (Thanks to Walter
1353 Bright.)
1354
1355Since 6.0alpha8:
1356 - added README.macros.
1357 - Made gc.mak a symbolic link to work around winzip's tendency to ignore
1358 hard links.
1359 - Simplified the setting of NEED_FIND_LIMIT in os_dep.c, possibly breaking
1360 it on untested platforms.
1361 - Integrated initial GNU HURD port. (Thanks to Chris Lingard and Igor
1362 Khavkine.)
1363 - A few more fixes for Digital Mars compiler (Walter Bright).
1364 - Fixed gcc version recognition. Renamed OPERATOR_NEW_ARRAY to
1365 GC_OPERATOR_NEW_ARRAY. Changed GC_OPERATOR_NEW_ARRAY to be the default.
1366 It can be overridden with -DGC_NO_OPERATOR_NEW_ARRAY. (Thanks to
1367 Cesar Eduardo Barros.)
1368 - Changed the byte size to free-list mapping in thread local allocation
1369 so that size 0 allocations are handled correctly.
1370 - Fixed Linux/MIPS stackbottom for new toolchain. (Thanks to Ryan Murray.)
1371 - Changed finalization registration to invoke GC_oom_fn when it runs out
1372 of memory.
1373 - Removed lvalue cast in finalize.c. This caused some debug configurations
1374 not to build with some non-gcc compilers.
1375
1376Since 6.0alpha9:
1377 - Two more bug fixes for KEEP_BACK_PTRS and DBG_HDRS_ALL.
1378 - Fixed a stack clearing problem that resulted in SIGILL with a
1379 misaligned stack pointer for multithreaded SPARC builds.
1380 - Integrated another HURD patch (thanks to Igor Khavkine).
1381
1382Since 6.0:
1383 - Non-debug, atomic allocations could result in bogus smashed object
1384 reports with debugging on. (Thanks to Patrick Doyle for the small
1385 test case.)
1386 - Fixed GC_get_register_stack_base (Itanium only) to work around a glibc
1387 2.2.4 bug.
1388 - Initial port to HP/UX on Itanium. Thread support and both 32 and 64
1389 bit ABIs appear to work. Parallel mark support doesn't yet, due to
1390 some inline assembly code issues. Thread local allocation does appear
1391 to work.
1392 - ifdef'ed out glibc2.1/Itanium workaround. I suspect nobody is using
1393 that combination anymore.
1394 - Added a patch to make new_gc_alloc.h usable with gcc3.0. (Thanks to
1395 Dimitris Vyzovitis for the patch.)
1396 - Debugged 64-bit support on HP/UX PA-RISC.
1397 - Turned on dynamic loading support for FreeBSD/ELF. (Thanks to Peter
1398 Housel.)
1399 - Unregistering of finalizers with debugging allocation was broken.
1400 (Thanks to Jani Kajala for the test case.)
1401 - Old finalizers were not returned correctly from GC_debug_register_finalizer.
1402 - Disabled MPROTECT_VDB for Linux/M68K based on a report that it doesn't work.
1403 - Cleaned up some statistics gathering code in reclaim.c (Thanks to Walter
1404 Bright.)
1405 - Added some support for OpenBSD/ELF/Linux. (Thanks to Suzuki Toshiya.)
1406 - Added Jakub Jelinek's patch to use dl_iterate_phdr for dynamic library
1407 traversal to dyn_load.c. Changed it to weakly reference dl_iterate_phdr,
1408 so that the old code is stilll used with old versions of glibc.
1409 - Cleaned up feature test macros for various threads packages and
1410 integrated (partially functional) FreeBSD threads code from Loren Rittle.
1411 It's likely that the cleanup broke something, since it touched lots of
1412 code. It's also likelly that it fixed some unreported bugs in the
1413 less common thread implementations, since some of the original code
1414 didn't stand up to close scrutiny. Support for the next pthreads
1415 implementation should be easier to add.
1416
1417Since 6.1alpha1:
1418 - No longer wrap read by default in multithreaded applications. It was
1419 pointed out on the libgcj list that this holds the allocation lock for
1420 way too long if the read blocks. For now, reads into the heap are
1421 broken with incremental collection. It's possible to turn this back on
1422 if you make sure that read calls don't block (e.g. by calling select
1423 first).
1424 - Fix ifdef in Solaris_threads.h to refer to GC_SOLARIS_THREADS.
1425 - Added check for environment variable GC_IGNORE_GCJ_INFO.
1426 - Added printing of stop-the-world GC times if GC_PRINT_STATS environment
1427 variable is set.
1428 - The calloc definition in leak_detector.h was missing parentheses, and
1429 realloc was missing a second argument to GC_REALLOC.
1430 (Thanks to Elrond (elrond<at>samba-tng.org).)
1431 - Added GC_PRINT_BACK_HEIGHT environment variable and associated
1432 code, mostly in the new file backgraph.c. See doc/README.environment.
1433 - Added -DUSE_GLOBAL_ALLOC to work around a Windows NT issue. (Thanks to
1434 Jonathan Clark.)
1435 - Integrated port to NEC EWS4800 (MIPS-based workstation, with somewhat
1436 different address-space layout). This may help for other machines with
1437 holes in the data segment. (Thanks to Hironori Sakamoto.)
1438 - Changed the order in which GC_push_roots and friends push things onto
1439 the mark stack. GC_push_all calls need to come first, since we can't
1440 necessarily recovere if those overflow the mark stack. (Thanks to
1441 Matthew Flatt for tracking down the problem.)
1442 - Some minor cleanups to mostly support the Intel compiler on Linux/IA64.
1443
1444Since 6.1 alpha2:
1445 - Minor cleanup on the gcconfig.h section for SPARC.
1446 - Minor fix to support Intel compiler for I386/Linux. (Thanks to Sven
1447 Hartrumpf.)
1448 - Added SPARC V9 (64-bit) support. (Thanks to Jeff Sturm.)
1449 - Restructured the way in which we determine whether or not to keep
1450 call stacks for debug allocation. By default SAVE_CALL_COUNT is
1451 now zero on all platforms. Added SAVE_CALL_NARGS parameters.
1452 If possible, use execinfo.h to capture call stack. (This should
1453 add support for a number of new platforms, though often at
1454 considerable runtime expense.)
1455 - Try to print symbolic information for call stacks. On Linux, we
1456 do this with a combination of execinfo.h and running addr2line in
1457 a separate process. This is both much more expensive and much more
1458 useful. Amazingly, it seems to be fast enough for most purposes.
1459 - Redefined strdup if -DREDIRECT_MALLOC is given.
1460 - Changed incremental collector and MPROTECT_VDB implementation so that,
1461 under favorable conditions, pointerfree objects are not protected.
1462 Added GC_incremental_protection_needs() to determine ahead of time whether
1463 pointerfree objects may be protected. Replaced GC_write_hint() with
1464 GC_remove_protection().
1465 - Added test for GC_ENABLE_INCREMENTAL environment variable.
1466 - Made GC_time_limit runtime configurable. Added GC_PAUSE_TIME_TARGET
1467 environment variable.
1468 - Eliminated GC_page_sz, a duplicate of GC_page_size.
1469 - Caused the Solaris and Irix thread creation primitives to call
1470 GC_init_inner().
1471
1472Since 6.1alpha3:
1473 - Fixed typo in sparc_mach_dep.S, preventing the 64-bit version from
1474 building. Increased 64-bit heap size limit in test.c slightly, since
1475 a functional SPARC collector seems to slightly exceed the old limits.
1476 (Thanks again to Jeff Sturm.)
1477 - Use NPRGREG in solaris_threads.c, thus printing all registers if things
1478 go wrong.
1479 - Added GC_MARKERS environment variable to allow use of a single marker
1480 thread on an MP without confusing the lock implementation.
1481 - Collect much less aggressively in incremental mode with GC_TIME_UNLIMITED.
1482 This is really a purely generational mode, and we can afford to
1483 postpone the collection until the heap is (nearly) full.
1484 - Remove read() wrapper for MPROTECT_VDB. It was causing more harm than
1485 good. It is often no longer needed if system calls avoid writing to
1486 pointerfull heap objects.
1487 - Fix MACOSX test in gcconfig.h. (Thanks to John Clements.)
1488 - Change GC_test_and_set so that it consistently has one argument.
1489 Add spaces to ::: in powerpc assembly code in gc_locks.h.
1490 (Thanks to Ryan Murray.)
1491 - Fixed a formatting error in dbg_mlc.c. Added prototype to GC_abort()
1492 declaration. (Thanks to Michael Smith.)
1493 - Removed "source" argument to GC_find_start(). Eliminate GC_FIND_START().
1494 - Added win32 recognition code in configure.in. Changed some of the
1495 dllimport/export defines in gc.h. (Thanks to Adam Megacz.)
1496 - GC_malloc_many didn't set hb_last_reclaimed when it called
1497 GC_reclaim_generic. (I'm not sure this matters much, but ...)
1498 - Allocating uncollectable objects with debug information sometimes
1499 allocated objects that were one byte too small, since uncollectable
1500 objects don't have the extra byte added at the end. (Thanks to
1501 Wink Saville for pointing this out.)
1502 - Added a bit more assertion checking to make sure that gcj objects
1503 on free lists never have a nonzero second word.
1504 - Replaced BCC_MAKEFILE with an up-to-date one. (Thanks to
1505 Andre Leiradella.)
1506 - Upgraded libtool, cinfigure.in and some related files to hopefully
1507 support NetBSD/SPARC. (Thanks to Adrian Bunk.) Unfortunately,
1508 libtool 1.4.2 seemed to be buggy due to missing quotes in several
1509 "test" invocations. Fixed those in the ltmain.sh script.
1510 - Some win32-specific patches, including the introduction of
1511 GC_CreateThread. (Thanks to Adam Megacz.)
1512 - Merged in gcj changes from Anthony Green to support embedded systems.
1513 - Tried to consistently rename preprocessed assembly files with a capital
1514 .S extension.
1515 - Use alpha_mach_dep.S on ALPHA again. It doesn't really matter, but this
1516 makes our distribution consistent with the gcc one, avoiding future merge
1517 problems.
1518 - Move GET_MEM definition into gcconfig.h. Include gcconfig.h slightly
1519 later in gc_priv.h to avoid forward references to ptr_t.
1520 - Add some testing of local allocation to test.c.
1521 - Change definition of INVALID_QTID in specific.h. The -1 value was used
1522 inconsistently, and too likely to collide with a valid stack address.
1523 Some general clean-up of specific.[ch]. Added assertions. (Thanks
1524 to Michael Smith for tracking down an intermittent bug to this
1525 general area. I'm not sure it has been squashed yet, however.)
1526 - On Pthread systems it was not safe to call GC_malloc() between fork()
1527 and exec(). According to the applicable standards, it doesn't appear
1528 to be safe to call malloc() or many other libc functions either, thus
1529 it's not clear this is fixable. Added experimental support for
1530 -DHANDLE_FORK in linux_threads.c which tries to support it. It may
1531 succeed if libc does the right thing. I'm not sure whether it does.
1532 (Thanks to Kenneth Schalk for pointing out this issue.)
1533 - Documented thread local allocation primitives to require an
1534 explicit GC_init call. GC_init_parallel is no longer declared to
1535 be a constructor function, since that isn't portable and often
1536 seems to lead to initialization order problems.
1537 - Changed gc_cpp.cc and gc_cpp.h in one more attempt to make them
1538 compatible with Visual C++ 6. (Thanks to Wink Saville for the
1539 patch.)
1540 - Some more patches for Linux on HP PA-RISC.
1541 - Added include/gc_allocator.h. It implements (hopefully) standard
1542 conforming (as opposed to SGI-style) allocators that allocate
1543 collectable (gc_allocator) or GC-traceable, but not collectable
1544 (traceable_allocator) objects. This borrows heavily from libstc++,
1545 which borrows heavily from the SGI implementation, this part of
1546 which was written by Matt Austern. Changed test_cpp.cc to very
1547 minimally test this.
1548 - On Linux/X86, retry mmap with a different start argument. That should
1549 allow the collector to use more (closer to 3GB) of the address space.
1550 (Thanks to Jeffrey Mark Siskind for tracking this down.)
1551 - Force 64 bit alignment with GCJ support. (Reflects Bryce McKinley's
1552 patch to the gcc tree.)
1553 - Refined the choice of sa_handler vs. sa_sigaction in GC_dirty_init
1554 to accomodate some glibc5 systems. (Thanks to Dan Fandrich for the
1555 patch.)
1556 - Compensated for the fact that current versions of glibc set
1557 __libc_stack_end incorrectly on Linux/IA64 while initialization code
1558 is running. This could cause the collector to miss 16 bytes of
1559 the memory stack if GC_malloc or friends where called before main().
1560 - Mostly integrated Takis Psarogiannakopoulos' port to DG/UX Inix 86.
1561 This will probably take another iteration to work, since his
1562 patch conflicted with the libtool upgrade.
1563 - Added README.arm.cross containing some information about cross-
1564 compiling to an ARM processor from Margaret Fleck.
1565
1566Since 6.1alpha4:
1567 - Added GC_finalizer_mem_freed, and changed some of the code that
1568 decided on heap expansion to look at it. Memory explicitly
1569 deallocated by finalizers essentially needs to be counted as reclaimed
1570 by the GC. Otherwise there are cases in which the heap can grow
1571 unboundedly. (Thanks to Mark Reichert for the test case.)
1572 - Integrated Adam Megacz patches to not scan dynamic libraries if
1573 we are compiling with gcc on win32. Otherwise we need structured
1574 exception handling to deal with asynchronously unmapped root
1575 segments, and gcc doesn't directly support that.
1576 - Integrated Anthony Green's patch to support Wine.
1577 - GC_OPERATOR_NEW_ARRAY was misspelled OPERATOR_NEW_ARRAY in several
1578 places, including gc_cpp.cc. (Thanks to Wink Saville for pointing
1579 this out.)
1580 - Integrated Loren James Rittle's Alpha FreeBSD patches. In
1581 response to Richard Henderson's suggestion, these also
1582 changed the declarations of symbols like _end on many platforms to
1583 that they wouldn't mistakenly be declared as short data symbols.
1584 - Integrated changes from the Debian distribution. (Thanks to Ryan Murray
1585 for pointing these out.) Fix C++ comments in POWERPC port. Add ARM32
1586 incremental GC support. Get rid of USE_GENERIC_PUSH_REGS for alpha/Linux,
1587 this time for real. Use va_copy to get rid of cord printf problems
1588 (finally).
1589 - Close file descriptor used to count cpus. Thanks to Jeff Sturm for
1590 pointing out the omission.
1591 - Don't just drop gcj free lists in GC_start_reclaim, since that can
1592 eventually cause the marker to see a bogus mark descriptor in the
1593 dropped objects. The usual symptom was a very intermittent segmentation
1594 fault in the marker. This mattered only if one of the GC_gcj_malloc
1595 variants was used. (Thanks to Michael Smith, Jeff Sturm, Bryce
1596 McKinley and Tom Tromey for helping to track this down.)
1597 - Fixed Linux and Solaris/64 SPARC configuration. (Thanks to David Miller,
1598 Jeff Sturm, Tom Tromey, and Christian Joensson.)
1599 - Fixed a typo in strdup definition. (Thanks to Gerard A Allan.)
1600 - Changed Makefile.direct to invoke $(CC) to assemble alpha_mach_dep.S.
1601 This is needed on Linux. I'm not sure whether it's better or worse
1602 on Tru64.
1603 - Changed gc_cpp.h once more to declare operator new and friends only in
1604 a Microsoft environment. This may need further fine tuning. (Thanks to
1605 Johannes Schmidt for pointing out that the older code breaks on gcc3.0.4.)
1606 - Don't ever override strdup if it's already macro defined. (Thanks to
1607 Adnan Ali for pointing out the problem.)
1608 - Changed gc_cpp.h yet again to also overload placement new. Due to the
1609 C++ overloading rules, the other overloaded new operations otherwise hide
1610 placement new, which causes many STL uses to break. (Thanks to Reza
1611 Shahidi for reporting this, and to Matt Austern for proposing a fix.)
1612 - Integrated cygwin pthreads support from Dan Bonachea.
1613 - Turn on DYNAMIC_LOADING for NetBSD. (Thanks to Krister Walfridsson.)
1614 - Changed printing code to print more complete GC times.
1615 - Applied Mark Mitchell's Irix patch to correct some bitrot.
1616 - Clarified which object-printing routines in dbg_mlc.c should hold
1617 the allocation lock. Restructured the code to allow reasonable object
1618 printing with -DREDIRECT_MALLOC.
1619 - Fix the Linux mmap code to always start with 0x1000 as the initial hint.
1620 Minor patches for 64-bit AIX, particularly to STACKBOTTOM.
1621 (Thanks again to Jeffrey Mark Siskind.)
1622 - Renamed "SUSPENDED" flag for Solaris threads support to avoid a conflict
1623 with a system header. (Thanks to Philp Brown.)
1624 - Cause win32_threads.c to handle an out of range stack pointer correctly,
1625 though currently with a warning. (Thanks to Jonathan Clark for
1626 observing that win32 applications may temporarily use the stack
1627 pointer for other purposes, and suggesting a fix. Unfortunately, it's
1628 not clear that there is a complete solution to this problem.)
1629
1630Since 6.1alpha5:
1631 - Added GC_MAXIMUM_HEAP_SIZE environment variable.
1632 - Fix configure.in for MIPS/LINUX. (Thanks to H.J. Lu.)
1633 - Double page hash table size for -DLARGE_CONFIG.
1634 - Integrated Bo Thorsen's X86-64 support.
1635 - STACKBOTTOM definition for LINUX/MIPS was partially changed back.
1636 (Thanks to H.J. Lu and Hiroshi Kawashima for resolving this.)
1637 - Replaced all occurrences of LINUX_DATA_START in gcconfig.h with
1638 SEARCH_FOR_DATA_START. It doesn't hurt to falll back to a search.
1639 And __data_start doesn't seem to get defined correctly of the GC
1640 library is loaded with LD_PRELOAD, e.g. for leak detection.
1641 - If the GC_find_leak environment variable is set, do a
1642 atexit(GC_gcollect) to give us at least one chance to detect leaks.
1643 This may report some very benign leaks, but ...
1644 - Addeded REDIRECT_FREE. It's necessary if we want leak detection with
1645 LD_PRELOAD.
1646 - Defer printing of leaked objects, as for smashed objects.
1647 - Fixed process and descriptor leak in GC_print_callers. Try for
1648 line number even if we got function name.)
1649 - Ported parallel GC support and thread local allocation to Alpha.
1650 Not yet well-tested.
1651 - Added GC_DUMP_REGULARLY and added finalization statistics to GC_dump().
1652 - Fixed Makefile.am to mention alpha_mach_dep.S instead of the defunct
1653 alpha_mach_dep.s. (Thanks to Fergus Henderson.)
1654 - Incorporated a change to new_gc_alloc.h, suggested by Johannes Schmidt,
1655 which should make it work with gcc3.1. (I would still like to encourage
1656 use of gc_allocator.h instead.)
1657 - Use alpha_mach_dep.S only on Linux. (It's not clear that this is
1658 optimal, but it otherwise didn't build on Tru64. Thanks to Fergus
1659 Henderson.)
1660 - Added ifdef to guard free() in os_dep.c. Otherwise we get a
1661 compilation error on Irix. (Thanks to Dai Sato.)
1662 - Added an experimental version of GC_memalign to mallocx.c. This can't
1663 always work, since we don't handle alignment requests in the hblk-level
1664 allocator, and we can't handle arbitrary pointer displacements unless
1665 GC_all_interior_pointers is enabled. But it should work for alignment
1666 requests up to HBLKSIZE. This is not yet documented in the standard
1667 places.
1668 - Finally debugged the OSF1/Tru64 thread support. This needs more testing,
1669 since I needed to add a somewhat unconvincing workaround for signal
1670 delivery issues that I don't yet completely understand. But it does
1671 pass my tests, even in parallel GC mode. Incremental GC support is
1672 disabled if thread support is enabled, due to the signal issues.
1673 - Eliminated name-space-incorrect definition of _cdecl from gc_cpp.h.
1674 - Added GC_debug_malloc_replacement and GC_debug_realloc_replacement
1675 declarations to gc.h. On IA64, this is required for REDIRECT_MALLOC
1676 to work correctly with these.
1677 - Fixed Linux USE_PROC_FOR_LIBRARIES to work with a 64-bit /proc format.
1678
1679Since 6.1:
1680 - Guard the test for GC_DUMP_REGULARLY in misc.c with
1681 "#ifndef NO_DEBUGGING". Otherwise it fails to build with NO_DEBUGGING
1682 defined. (Thanks to Manuel Serrano.)
1683 - Message about retrying suspend signals was incorrectly generated even when
1684 flag was not set.
1685 - Cleaned up MACOSX/NEXT root registration code. There was apparently a
1686 separate ifdef case in GC_register_data_segments() for no reason.
1687 - Removed MPROTECT_VDB for MACOSX port, based on one negative report.
1688 - Arrange for gc.h and friends to be correctly installed with GNU-style
1689 "make install".
1690 - Enable the GNU-style build facility include C++ support in the library
1691 with --enable-cplusplus. (Thanks to Thomas Maier for some of the patch.)
1692 - Mark from GC_thread_key in linux_threads.c, in case that's allocated
1693 from the garbage collected heap, as it is with our own thread-specific
1694 storage implementation. (Thanks to Jeff Sturm.)
1695 - Mark all free list header blocks if they are heap allocated. This avoids
1696 some unnecessary tracing. And it remains correct if we clear the
1697 root set. (Thanks to Jeff Sturm for identifying the bug.)
1698 - Improved S390/Linux support. Add S390/Linux 64-bit support. (Thanks
1699 to Ulrich Weigand.)
1700 - Corrected the spelling of GC_{M,C}ALLOC_EXPLICTLY_TYPED to
1701 GC_{M,C}ALLOC_EXPLICITLY_TYPED in gc_typed.h. This is technically
1702 an interface change. Based on the fact that nobody reported this,
1703 I suspect/hope there were no clients.
1704 - Cleaned up gc_typed.h so that (1) it adds an extern "C" declaration
1705 when appropriate, (2) doesn't generate references to undefined internal
1706 macros, and (3) allows easier manual construction of descriptors.
1707 - Close the file descriptor used by GC_print_address_map().
1708 - Set the "close-on-exec" bit for various file descriptors maintained
1709 for the collector's internal use.
1710 - Added a hack to find memory segments owned by the system allocator
1711 under win32. Based on my tests, this tends to eventually find all
1712 segments, though it may take a while. There appear to be cleaner,
1713 but slower solutions under NT/XP. But they rely on an API that's
1714 unsupported under 9X.
1715 - Changed Linux PowerPC stack finding to LINUX_STACKBOTTOM. (Thanks
1716 to Akira Tagoh for pointing out that HEURISTIC1 doesn't work on
1717 64-bit kernels.)
1718 - Added GC_set_free_space_divisor to avoid some Windows dll issues.
1719 - Added FIXUP_POINTER, POINTER_SHIFT, POINTER_MASK to allow preprocessing
1720 of candidate pointers for tagging, etc.
1721 - Always lock around GC_notify_full_gc(). Simplified code for
1722 invoking GC_notify_full_gc().
1723 - Changed the way DATASTART is defined on FreeBSD to be robust against
1724 an unmapped page after etext. (Thanks to Hironori Sakamoto for
1725 tracking down the intermittent failure.)
1726 - Made GC_enable() and GC_disable() official. Deprecated direct update
1727 of GC_dont_gc. Changed GC_gcollect to be a noop when garbage collection
1728 is disabled.
1729 - Call GC_register_dynamic_libraries before stopping the world on Linux,
1730 in order to avoid a potential deadlock due to the dl_iterate_phdr lock.
1731 - Introduced a more general mechanism for platform-dependent code to
1732 decide whether the main data segment should be handled separately
1733 from dynamic libraries, or registered by GC_register_dynamic_libraries.
1734 The latter is more reliable and easier on Linux with dl_iterate_phdr.
1735
1736Since 6.2alpha1:
1737 - Fixed the completely broken FreeBSD code in 6.2alpha1. (Thanks to
1738 Hironori Sakamoto for the patch.)
1739 - Changed IRIX reference in dbg_mlc.c to IRIX5. (Thanks to Marcus Herbert.)
1740 - Attempted to work around the problems with .S filenames and the SGI
1741 compiler. (Reported by several people. Untested.)
1742 - Worked around an HP/UX make issue with the GNU-style build process.
1743 - Fixed the --enable-cplusplus build machinery to allow builds without
1744 a C++ compiler. (That was always the intent ...)
1745 - Changed the debugging allocation macros to explicitly pass the return
1746 address for Linux and XXXBSD on hardware for which we can't get stack
1747 traces. Use __builtin_return_address(0) to generate it when possible.
1748 Some of the configuration work was cleaned up (good) and moved to gc.h
1749 (bad, but necessary). This should make leak detection more useful
1750 on a number of platforms. (Thanks to Fabian Thylman for the suggestion.)
1751 - Fixed compilation problems in dbg_mlc.c with GC_ADD_CALLER.
1752 - Bumped revision number for dynamic library.
1753
1754Since 6.2alpha2:
1755 - Don't include execinfo.h in os_dep.c when it's not needed, and may not exist.
1756
1757Since 6.2alpha3:
1758 - Use LINUX_STACKBOTTOM for >= glibc2.2 on Linux/MIPS. (See Debian bug
1759 # 177204)
1760 - Integrated Jeff Sturm and Jesse Rosenstock's MACOSX threads patches.
1761 - Integrated Grzegorz Jakacki's substantial GNU build patch. "Make dist"
1762 should now work for the GNU build process. Documentation files
1763 are installed under share/gc.
1764 - Tweaked gc_cpp.h to again support the Borland compiler. (Thanks to
1765 Rene Girard for pointing out the problems.)
1766 - Updated BCC_MAKEFILE (thanks to Rene Girard).
1767 - Added GC_ASSERT check for minimum thread stack size.
1768 - Added --enable-gc-assertions.
1769 - Added some web documentation to the distribution. Updated it in the
1770 process.
1771 - Separate gc_conf_macros.h from gc.h.
1772 - Added generic GC_THREADS client-defined macro to set the appropriate
1773 GC_XXX_THREADS internal macro. (gc_config_macros.h.)
1774 - Add debugging versions of _ignore_off_page allocation primitves.
1775 - Moved declarations of GC_make_closure and GC_debug_invoke_finalizer
1776 from gc.h to gc_priv.h.
1777 - Reset GC_fail_count even if only a small allocation succeeds.
1778 - Integrated Brian Alliet's patch for dynamic library support on Darwin.
1779 - gc_cpp.h's gc_cleanup destructor called GC_REGISTER_FINALIZER_IGNORE_SELF
1780 when it should have called the lower case version, since it was
1781 explicitly computing a base pointer.
1782
1783To do:
1784 - MacOSX thread support still appears to be a bit unreliable.
1785 - A dynamic libgc.so references dlopen unconditionally, but doesn't link
1786 against libdl.
1787 - GC_proc_fd for Solaris is not correctly updated in response to a
1788 fork() call. Thus incremental collection in the child won't work
1789 correctly. (Thanks to Ben Cottrell for pointing this out.)
1790 - --enable-redirect-malloc is mostly untested and known not to work
1791 on some platforms.
1792 - There seem to be outstanding issues on Solaris/X86, possibly with
1793 finding the data segment starting address. Information/patches would
1794 be appreciated.
1795 - Very large root set sizes (> 16 MB or so) could cause the collector
1796 to abort with an unexpected mark stack overflow. (Thanks again to
1797 Peter Chubb.) NOT YET FIXED. Workaround is to increase the initial
1798 size.
1799 - The SGI version of the collector marks from mmapped pages, even
1800 if they are not part of dynamic library static data areas. This
1801 causes performance problems with some SGI libraries that use mmap
1802 as a bitmap allocator. NOT YET FIXED. It may be possible to turn
1803 off DYNAMIC_LOADING in the collector as a workaround. It may also
1804 be possible to conditionally intercept mmap and use GC_exclude_static_roots.
1805 The real fix is to walk rld data structures, which looks possible.
1806 - Incremental collector should handle large objects better. Currently,
1807 it looks like the whole object is treated as dirty if any part of it
1808 is.
1809
diff --git a/gc/doc/README.contributors b/gc/doc/README.contributors
deleted file mode 100644
index fd5c95f2297..00000000000
--- a/gc/doc/README.contributors
+++ /dev/null
@@ -1,57 +0,0 @@
1This is an attempt to acknowledge early contributions to the garbage
2collector. Later contributions should instead be mentioned in
3README.changes.
4
5HISTORY -
6
7 Early versions of this collector were developed as a part of research
8projects supported in part by the National Science Foundation
9and the Defense Advance Research Projects Agency.
10
11The garbage collector originated as part of the run-time system for
12the Russell programming language implementation. The first version of the
13garbage collector was written primarily by Al Demers. It was then refined
14and mostly rewritten, primarily by Hans-J. Boehm, at Cornell U.,
15the University of Washington, Rice University (where it was first used for
16C and assembly code), Xerox PARC, SGI, and HP Labs. However, significant
17contributions have also been made by many others.
18
19Some other contributors:
20
21More recent contributors are mentioned in the modification history in
22README.changes. My apologies for any omissions.
23
24The SPARC specific code was originally contributed by Mark Weiser.
25The Encore Multimax modifications were supplied by
26Kevin Kenny (kenny@m.cs.uiuc.edu). The adaptation to the IBM PC/RT is largely
27due to Vernon Lee, on machines made available to Rice by IBM.
28Much of the HP specific code and a number of good suggestions for improving the
29generic code are due to Walter Underwood.
30Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code.
31Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk)
32subsequently provided updates and information on variation between ULTRIX
33systems. Parag Patel (parag@netcom.com) supplied the A/UX code.
34Jesper Peterson(jep@mtiame.mtia.oz.au), Michel Schinz, and
35Martin Tauchmann (martintauchmann@bigfoot.com) supplied the Amiga port.
36Thomas Funke (thf@zelator.in-berlin.de(?)) and
37Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports.
38Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code.
39Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader
40specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and
41Sony News specific code. Al Dosser provided Alpha/OSF/1 code. He and
42Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes.
43Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports.
44Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port.
45Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to
46a Motorola 88K processor running CX/UX (Harris NightHawk).
47Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to
48nonIBM development environments (a nontrivial task).
49Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port.
50David Chase, then at Olivetti Research, suggested several improvements.
51Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the
52code to save and print call stacks for leak detection on a SPARC.
53Jesse Hull and John Ellis supplied the C++ interface code.
54Zhong Shao performed much of the experimentation that led to the
55current typed allocation facility. (His dynamic type inference code hasn't
56made it into the released version of the collector, yet.)
57
diff --git a/gc/doc/README.cords b/gc/doc/README.cords
deleted file mode 100644
index 3485e0145af..00000000000
--- a/gc/doc/README.cords
+++ /dev/null
@@ -1,53 +0,0 @@
1Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
2
3THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
5
6Permission is hereby granted to use or copy this program
7for any purpose, provided the above notices are retained on all copies.
8Permission to modify the code and to distribute modified code is granted,
9provided the above notices are retained, and a notice that the code was
10modified is included with the above copyright notice.
11
12Please send bug reports to Hans-J. Boehm (Hans_Boehm@hp.com or
13boehm@acm.org).
14
15This is a string packages that uses a tree-based representation.
16See cord.h for a description of the functions provided. Ec.h describes
17"extensible cords", which are essentially output streams that write
18to a cord. These allow for efficient construction of cords without
19requiring a bound on the size of a cord.
20
21More details on the data structure can be found in
22
23Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings",
24Software Practice and Experience 25, 12, December 1995, pp. 1315-1330.
25
26A fundamentally similar "rope" data structure is also part of SGI's standard
27template library implementation, and its descendents, which include the
28GNU C++ library. That uses reference counting by default.
29There is a short description of that data structure at
30http://reality.sgi.com/boehm/ropeimpl.html . (The more official location
31http://www.sgi.com/tech/stl/ropeimpl.html is missing a figure.)
32
33All of these are descendents of the "ropes" in Xerox Cedar.
34
35de.c is a very dumb text editor that illustrates the use of cords.
36It maintains a list of file versions. Each version is simply a
37cord representing the file contents. Nonetheless, standard
38editing operations are efficient, even on very large files.
39(Its 3 line "user manual" can be obtained by invoking it without
40arguments. Note that ^R^N and ^R^P move the cursor by
41almost a screen. It does not understand tabs, which will show
42up as highlighred "I"s. Use the UNIX "expand" program first.)
43To build the editor, type "make cord/de" in the gc directory.
44
45This package assumes an ANSI C compiler such as gcc. It will
46not compile with an old-style K&R compiler.
47
48Note that CORD_printf iand friends use C functions with variable numbers
49of arguments in non-standard-conforming ways. This code is known to
50break on some platforms, notably PowerPC. It should be possible to
51build the remainder of the library (everything but cordprnt.c) on
52any platform that supports the collector.
53
diff --git a/gc/doc/README.dj b/gc/doc/README.dj
deleted file mode 100644
index 613bc423cb1..00000000000
--- a/gc/doc/README.dj
+++ /dev/null
@@ -1,12 +0,0 @@
1[Original version supplied by Xiaokun Zhu <xiaokun@aero.gla.ac.uk>]
2[This version came mostly from Gary Leavens. ]
3
4Look first at Makefile.dj, and possibly change the definitions of
5RM and MV if you don't have rm and mv installed.
6Then use Makefile.dj to compile the garbage collector.
7For example, you can do:
8
9 make -f Makefile.dj test
10
11All the tests should work fine.
12
diff --git a/gc/doc/README.environment b/gc/doc/README.environment
deleted file mode 100644
index d1f3b5c053b..00000000000
--- a/gc/doc/README.environment
+++ /dev/null
@@ -1,120 +0,0 @@
1The garbage collector looks at a number of environment variables which are
2then used to affect its operation. These are examined only on Un*x-like
3platforms.
4
5GC_INITIAL_HEAP_SIZE=<bytes> - Initial heap size in bytes. May speed up
6 process start-up.
7
8GC_MAXIMUM_HEAP_SIZE=<bytes> - Maximum collected heap size.
9
10GC_LOOP_ON_ABORT - Causes the collector abort routine to enter a tight loop.
11 This may make it easier to debug, such a process, especially
12 for multithreaded platforms that don't produce usable core
13 files, or if a core file would be too large. On some
14 platforms, this also causes SIGSEGV to be caught and
15 result in an infinite loop in a handler, allowing
16 similar debugging techniques.
17
18GC_PRINT_STATS - Turn on as much logging as is easily feasible without
19 adding signifcant runtime overhead. Doesn't work if
20 the collector is built with SMALL_CONFIG. Overridden
21 by setting GC_quiet. On by default if the collector
22 was built without -DSILENT.
23
24GC_DUMP_REGULARLY - Generate a GC debugging dump GC_dump() on startup
25 and during every collection. Very verbose. Useful
26 if you have a bug to report, but please include only the
27 last complete dump.
28
29GC_PRINT_ADDRESS_MAP - Linux only. Dump /proc/self/maps, i.e. various address
30 maps for the process, to stderr on every GC. Useful for
31 mapping root addresses to source for deciphering leak
32 reports.
33
34GC_NPROCS=<n> - Linux w/threads only. Explicitly sets the number of processors
35 that the GC should expect to use. Note that setting this to 1
36 when multiple processors are available will preserve
37 correctness, but may lead to really horrible performance,
38 since the lock implementation will immediately yield without
39 first spinning.
40
41GC_MARKERS=<n> - Linux w/threads and parallel marker only. Set the number
42 of marker threads. This is normaly set to the number of
43 processors. It is safer to adjust GC_MARKERS than GC_NPROCS,
44 since GC_MARKERS has no impact on the lock implementation.
45
46GC_NO_BLACKLIST_WARNING - Prevents the collector from issuing
47 warnings about allocations of very large blocks.
48 Deprecated. Use GC_LARGE_ALLOC_WARN_INTERVAL instead.
49
50GC_LARGE_ALLOC_WARN_INTERVAL=<n> - Print every nth warning about very large
51 block allocations, starting with the nth one. Small values
52 of n are generally benign, in that a bounded number of
53 such warnings generally indicate at most a bounded leak.
54 For best results it should be set at 1 during testing.
55 Default is 5. Very large numbers effectively disable the
56 warning.
57
58GC_IGNORE_GCJ_INFO - Ignore the type descriptors implicitly supplied by
59 GC_gcj_malloc and friends. This is useful for debugging
60 descriptor generation problems, and possibly for
61 temporarily working around such problems. It forces a
62 fully conservative scan of all heap objects except
63 those known to be pointerfree, and may thus have other
64 adverse effects.
65
66GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects
67 ending in a reachable one. If this number remains
68 bounded, then the program is "GC robust". This ensures
69 that a fixed number of misidentified pointers can only
70 result in a bounded space leak. This currently only
71 works if debugging allocation is used throughout.
72 It increases GC space and time requirements appreciably.
73 This feature is still somewhat experimental, and requires
74 that the collector have been built with MAKE_BACK_GRAPH
75 defined. For details, see Boehm, "Bounding Space Usage
76 of Conservative Garbage Collectors", POPL 2001, or
77 http://lib.hpl.hp.com/techpubs/2001/HPL-2001-251.html .
78
79GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost
80 thread suspend signals in linux_threads.c. On by
81 default for GC_OSF1_THREADS, off otherwise. Note
82 that this does not work around a possible loss of
83 thread restart signals. This seems to be necessary for
84 some versions of Tru64. Since we've previously seen
85 similar issues on some other operating systems, it
86 was turned into a runtime flag to enable last-minute
87 work-arounds.
88
89The following turn on runtime flags that are also program settable. Checked
90only during initialization. We expect that they will usually be set through
91other means, but this may help with debugging and testing:
92
93GC_ENABLE_INCREMENTAL - Turn on incremental collection at startup. Note that,
94 depending on platform and collector configuration, this
95 may involve write protecting pieces of the heap to
96 track modifications. These pieces may include pointerfree
97 objects or not. Although this is intended to be
98 transparent, it may cause unintended system call failures.
99 Use with caution.
100
101GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs.
102 This only has an effect if incremental collection is
103 enabled. If a collection requires appreciably more time
104 than this, the client will be restarted, and the collector
105 will need to do additional work to compensate. The
106 special value "999999" indicates that pause time is
107 unlimited, and the incremental collector will behave
108 completely like a simple generational collector. If
109 the collector is configured for parallel marking, and
110 run on a multiprocessor, incremental collection should
111 only be used with unlimited pause time.
112
113GC_FIND_LEAK - Turns on GC_find_leak and thus leak detection. Forces a
114 collection at program termination to detect leaks that would
115 otherwise occur after the last GC.
116
117GC_ALL_INTERIOR_POINTERS - Turns on GC_all_interior_pointers and thus interior
118 pointer recognition.
119
120GC_DONT_GC - Turns off garbage collection. Use cautiously.
diff --git a/gc/doc/README.ews4800 b/gc/doc/README.ews4800
deleted file mode 100644
index 80bca2b3d95..00000000000
--- a/gc/doc/README.ews4800
+++ /dev/null
@@ -1,81 +0,0 @@
1GC on EWS4800
2-------------
3
41. About EWS4800
5 EWS4800 is 32bit/64bit workstation.
6
7 Vender: NEC Corporation
8 OS: UX/4800 R9.* - R13.* (SystemV R4.2)
9 CPU: R4000, R4400, R10000 (MIPS)
10
112. Compiler
12
13 32bit:
14 Use ANSI C compiler.
15 CC = /usr/abiccs/bin/cc
16
17 64bit:
18 Use 64bit ANSI C compiler.
19 CC = /usr/ccs64/bin/cc
20 AR = /usr/ccs64/bin/ar
21
223. ELF file format
23 *** Caution: The following infomation is empirical. ***
24
25 32bit:
26 ELF file has an unique format. (See a.out(4) and end(3C).)
27
28 &_start
29 : text segment
30 &etext
31 DATASTART
32 : data segment (initialized)
33 &edata
34 DATASTART2
35 : data segment (uninitialized)
36 &end
37
38 Here, DATASTART and DATASTART2 are macros of GC, and are defined as
39 the following equations. (See include/private/gcconfig.h.)
40 The algorithm for DATASTART is similar with the function
41 GC_SysVGetDataStart() in os_dep.c.
42
43 DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff)
44
45 Dynamically linked:
46 DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff
47
48 Statically linked:
49 DATASTART2 = &edata
50
51 GC has to check addresses both between DATASTART and &edata, and
52 between DATASTART2 and &end. If a program accesses between &etext
53 and DATASTART, or between &edata and DATASTART2, the segmentation
54 error occurs and the program stops.
55
56 If a program is statically linked, there is not a gap between
57 &edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used
58 for the detection.
59
60 64bit:
61 ELF file has a simple format. (See end(3C).)
62
63 _ftext
64 : text segment
65 _etext
66 _fdata = DATASTART
67 : data segment (initialized)
68 _edata
69 _fbss
70 : data segment (uninitialized)
71 _end = DATAEND
72
73--
74Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
75
76
77When using the new "configure; make" build process, please
78run configure with the --disable-shared option. "Make check" does not
79yet pass with dynamic libraries. Ther reasons for that are not yet
80understood. (HB, paraphrasing message from Hironori SAKAMOTO.)
81
diff --git a/gc/doc/README.hp b/gc/doc/README.hp
deleted file mode 100644
index caa8bdd19f5..00000000000
--- a/gc/doc/README.hp
+++ /dev/null
@@ -1,18 +0,0 @@
1Dynamic loading support requires that executables be linked with -ldld.
2The alternative is to build the collector without defining DYNAMIC_LOADING
3in gcconfig.h and ensuring that all garbage collectable objects are
4accessible without considering statically allocated variables in dynamic
5libraries.
6
7The collector should compile with either plain cc or cc -Ae. Cc -Aa
8fails to define _HPUX_SOURCE and thus will not configure the collector
9correctly.
10
11Incremental collection support was reccently added, and should now work.
12
13In spite of past claims, pthread support under HP/UX 11 should now work.
14Define GC_HPUX_THREADS for the build. Incremental collection still does not
15work in combination with it.
16
17The stack finding code can be confused by putenv calls before collector
18initialization. Call GC_malloc or GC_init before any putenv calls.
diff --git a/gc/doc/README.linux b/gc/doc/README.linux
deleted file mode 100644
index 1d0fd4c3fb6..00000000000
--- a/gc/doc/README.linux
+++ /dev/null
@@ -1,132 +0,0 @@
1See README.alpha for Linux on DEC AXP info.
2
3This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K, IA64,
4SPARC, MIPS, Alpha and PowerPC are also integrated. They should behave
5similarly, except that the PowerPC port lacks incremental GC support, and
6it is unknown to what extent the Linux threads code is functional.
7See below for M68K specific notes.
8
9Incremental GC is generally supported.
10
11Dynamic libraries are supported on an ELF system. A static executable
12should be linked with the gcc option "-Wl,-defsym,_DYNAMIC=0".
13
14The collector appears to work reliably with Linux threads, but beware
15of older versions of glibc and gdb.
16
17The garbage collector uses SIGPWR and SIGXCPU if it is used with
18Linux threads. These should not be touched by the client program.
19
20To use threads, you need to abide by the following requirements:
21
221) You need to use LinuxThreads (which are included in libc6).
23
24 The collector relies on some implementation details of the LinuxThreads
25 package. It is unlikely that this code will work on other
26 pthread implementations (in particular it will *not* work with
27 MIT pthreads).
28
292) You must compile the collector with -DGC_LINUX_THREADS and -D_REENTRANT
30 specified in the Makefile.
31
323a) Every file that makes thread calls should define GC_LINUX_THREADS and
33 _REENTRANT and then include gc.h. Gc.h redefines some of the
34 pthread primitives as macros which also provide the collector with
35 information it requires.
36
373b) A new alternative to (3a) is to build the collector and compile GC clients
38 with -DGC_USE_LD_WRAP, and to link the final program with
39
40 (for ld) --wrap read --wrap dlopen --wrap pthread_create \
41 --wrap pthread_join --wrap pthread_detach \
42 --wrap pthread_sigmask --wrap sleep
43
44 (for gcc) -Wl,--wrap -Wl,read -Wl,--wrap -Wl,dlopen -Wl,--wrap \
45 -Wl,pthread_create -Wl,--wrap -Wl,pthread_join -Wl,--wrap \
46 -Wl,pthread_detach -Wl,--wrap -Wl,pthread_sigmask \
47 -Wl,--wrap -Wl,sleep
48
49 In any case, _REENTRANT should be defined during compilation.
50
514) Dlopen() disables collection during its execution. (It can't run
52 concurrently with the collector, since the collector looks at its
53 data structures. It can't acquire the allocator lock, since arbitrary
54 user startup code may run as part of dlopen().) Under unusual
55 conditions, this may cause unexpected heap growth.
56
575) The combination of GC_LINUX_THREADS, REDIRECT_MALLOC, and incremental
58 collection fails in seemingly random places. This hasn't been tracked
59 down yet, but is perhaps not completely astonishing. The thread package
60 uses malloc, and thus can presumably get SIGSEGVs while inside the
61 package. There is no real guarantee that signals are handled properly
62 at that point.
63
646) Thread local storage may not be viewed as part of the root set by the
65 collector. This probably depends on the linuxthreads version. For the
66 time being, any collectable memory referenced by thread local storage should
67 also be referenced from elsewhere, or be allocated as uncollectable.
68 (This is really a bug that should be fixed somehow.)
69
70
71M68K LINUX:
72(From Richard Zidlicky)
73The bad news is that it can crash every linux-m68k kernel on a 68040,
74so an additional test is needed somewhere on startup. I have meanwhile
75patches to correct the problem in 68040 buserror handler but it is not
76yet in any standard kernel.
77
78Here is a simple test program to detect whether the kernel has the
79problem. It could be run as a separate check in configure or tested
80upon startup. If it fails (return !0) than mprotect can't be used
81on that system.
82
83/*
84 * test for bug that may crash 68040 based Linux
85 */
86
87#include <sys/mman.h>
88#include <signal.h>
89#include <unistd.h>
90#include <stdio.h>
91#include <stdlib.h>
92
93
94char *membase;
95int pagesize=4096;
96int pageshift=12;
97int x_taken=0;
98
99int sighandler(int sig)
100{
101 mprotect(membase,pagesize,PROT_READ|PROT_WRITE);
102 x_taken=1;
103}
104
105main()
106{
107 long l;
108
109 signal(SIGSEGV,sighandler);
110 l=(long)mmap(NULL,pagesize,PROT_READ,MAP_PRIVATE | MAP_ANON,-1,0);
111 if (l==-1)
112 {
113 perror("mmap/malloc");
114 abort();
115 }
116 membase=(char*)l;
117 *(long*)(membase+sizeof(long))=123456789;
118 if (*(long*)(membase+sizeof(long)) != 123456789 )
119 {
120 fprintf(stderr,"writeback failed !\n");
121 exit(1);
122 }
123 if (!x_taken)
124 {
125 fprintf(stderr,"exception not taken !\n");
126 exit(1);
127 }
128 fprintf(stderr,"vmtest Ok\n");
129 exit(0);
130}
131
132
diff --git a/gc/doc/README.macros b/gc/doc/README.macros
deleted file mode 100644
index d9df8dd31a6..00000000000
--- a/gc/doc/README.macros
+++ /dev/null
@@ -1,78 +0,0 @@
1The collector uses a large amount of conditional compilation in order to
2deal with platform dependencies. This violates a number of known coding
3standards. On the other hand, it seems to be the only practical way to
4support this many platforms without excessive code duplication.
5
6A few guidelines have mostly been followed in order to keep this manageable:
7
81) #if and #ifdef directives are properly indented whenever easily possible.
9All known C compilers allow whitespace between the "#" and the "if" to make
10this possible. ANSI C also allows white space before the "#", though we
11avoid that. It has the known disadvantages that it differs from the normal
12GNU conventions, and that it makes patches larger than otherwise necessary.
13In my opinion, it's still well worth it, for the same reason that we indent
14ordinary "if" statements.
15
162) Whenever possible, tests are performed on the macros defined in gcconfig.h
17instead of directly testing patform-specific predefined macros. This makes it
18relatively easy to adapt to new compilers with a different set of predefined
19macros. Currently these macros generally identify platforms instead of
20features. In many cases, this is a mistake.
21
223) The code currently avoids #elif, eventhough that would make it more
23readable. This was done since #elif would need to be understood by ALL
24compilers used to build the collector, and that hasn't always been the case.
25It makes sense to reconsider this decision at some point, since #elif has been
26standardized at least since 1989.
27
28Many of the tested configuration macros are at least somewhat defined in
29either include/private/gcconfig.h or in Makefile.direct. Here is an attempt
30at defining some of the remainder: (Thanks to Walter Bright for suggesting
31this. This is a work in progress)
32
33MACRO EXPLANATION
34----- -----------
35
36__DMC__ Always #define'd by the Digital Mars compiler. Expands
37 to the compiler version number in hex, i.e. 0x810 is
38 version 8.1b0
39
40_ENABLE_ARRAYNEW
41 #define'd by the Digital Mars C++ compiler when
42 operator new[] and delete[] are separately
43 overloadable. Used in gc_cpp.h.
44
45_MSC_VER Expands to the Visual C++ compiler version. Assumed to
46 not be defined for other compilers (at least if they behave
47 appreciably differently).
48
49_DLL Defined by Visual C++ if dynamic libraries are being built
50 or used. Used to test whether __declspec(dllimport) or
51 __declspec(dllexport) needs to be added to declarations
52 to support the case in which the collector is in a dll.
53
54GC_DLL User-settable macro that forces the effect of _DLL.
55
56GC_NOT_DLL User-settable macro that overrides _DLL, e.g. if dynamic
57 libraries are used, but the collector is in a static library.
58
59__STDC__ Assumed to be defined only by compilers that understand
60 prototypes and other C89 features. Its value is generally
61 not used, since we are fine with most nonconforming extensions.
62
63SUNOS5SIGS Solaris-like signal handling. This is probably misnamed,
64 since it really doesn't guarantee much more than Posix.
65 Currently set only for Solaris2.X, HPUX, and DRSNX. Should
66 probably be set for some other platforms.
67
68PCR Set if the collector is being built as part of the Xerox
69 Portable Common Runtime.
70
71SRC_M3 Set if the collector is being built as a replacement of the
72 one in the DEC/Compaq SRC Modula-3 runtime. I suspect this
73 was last used around 1994, and no doubt broke a long time ago.
74 It's there primarily incase someone wants to port to a similar
75 system.
76
77
78
diff --git a/gc/doc/README.rs6000 b/gc/doc/README.rs6000
deleted file mode 100644
index f5630b20a32..00000000000
--- a/gc/doc/README.rs6000
+++ /dev/null
@@ -1,9 +0,0 @@
1We have so far failed to find a good way to determine the stack base.
2It is highly recommended that GC_stackbottom be set explicitly on program
3startup. The supplied value sometimes causes failure under AIX 4.1, though
4it appears to work under 3.X. HEURISTIC2 seems to work under 4.1, but
5involves a substantial performance penalty, and will fail if there is
6no limit on stack size.
7
8There is no thread support. (I assume recent versions of AIX provide
9pthreads? I no longer have access to a machine ...)
diff --git a/gc/doc/README.sgi b/gc/doc/README.sgi
deleted file mode 100644
index 7bdb50a4ef9..00000000000
--- a/gc/doc/README.sgi
+++ /dev/null
@@ -1,41 +0,0 @@
1Performance of the incremental collector can be greatly enhanced with
2-DNO_EXECUTE_PERMISSION.
3
4The collector should run with all of the -32, -n32 and -64 ABIs. Remember to
5define the AS macro in the Makefile to be "as -64", or "as -n32".
6
7If you use -DREDIRECT_MALLOC=GC_malloc with C++ code, your code should make
8at least one explicit call to malloc instead of new to ensure that the proper
9version of malloc is linked in.
10
11Sproc threads are not supported in this version, though there may exist other
12ports.
13
14Pthreads support is provided. This requires that:
15
161) You compile the collector with -DGC_IRIX_THREADS specified in the Makefile.
17
182) You have the latest pthreads patches installed.
19
20(Though the collector makes only documented pthread calls,
21it relies on signal/threads interactions working just right in ways
22that are not required by the standard. It is unlikely that this code
23will run on other pthreads platforms. But please tell me if it does.)
24
253) Every file that makes thread calls should define IRIX_THREADS and then
26include gc.h. Gc.h redefines some of the pthread primitives as macros which
27also provide the collector with information it requires.
28
294) pthread_cond_wait and pthread_cond_timed_wait should be prepared for
30premature wakeups. (I believe the pthreads and realted standards require this
31anyway. Irix pthreads often terminate a wait if a signal arrives.
32The garbage collector uses signals to stop threads.)
33
345) It is expensive to stop a thread waiting in IO at the time the request is
35initiated. Applications with many such threads may not exhibit acceptable
36performance with the collector. (Increasing the heap size may help.)
37
386) The collector should not be compiled with -DREDIRECT_MALLOC. This
39confuses some library calls made by the pthreads implementation, which
40expect the standard malloc.
41
diff --git a/gc/doc/README.solaris2 b/gc/doc/README.solaris2
deleted file mode 100644
index 6ed61dc83dc..00000000000
--- a/gc/doc/README.solaris2
+++ /dev/null
@@ -1,62 +0,0 @@
1The collector supports both incremental collection and threads under
2Solaris 2. The incremental collector normally retrieves page dirty information
3through the appropriate /proc calls. But it can also be configured
4(by defining MPROTECT_VDB instead of PROC_VDB in gcconfig.h) to use mprotect
5and signals. This may result in shorter pause times, but it is no longer
6safe to issue arbitrary system calls that write to the heap.
7
8Under other UNIX versions,
9the collector normally obtains memory through sbrk. There is some reason
10to expect that this is not safe if the client program also calls the system
11malloc, or especially realloc. The sbrk man page strongly suggests this is
12not safe: "Many library routines use malloc() internally, so use brk()
13and sbrk() only when you know that malloc() definitely will not be used by
14any library routine." This doesn't make a lot of sense to me, since there
15seems to be no documentation as to which routines can transitively call malloc.
16Nonetheless, under Solaris2, the collector now (since 4.12) allocates
17memory using mmap by default. (It defines USE_MMAP in gcconfig.h.)
18You may want to reverse this decisions if you use -DREDIRECT_MALLOC=...
19
20
21SOLARIS THREADS:
22
23The collector must be compiled with -DGC_SOLARIS_THREADS (thr_ functions)
24or -DGC_SOLARIS_PTHREADS (pthread_ functions) to be thread safe.
25It is also essential that gc.h be included in files that call thr_create,
26thr_join, thr_suspend, thr_continue, or dlopen. Gc.h macro defines
27these to also do GC bookkeeping, etc. Gc.h must be included with
28one or both of these macros defined, otherwise
29these replacements are not visible.
30A collector built in this way way only be used by programs that are
31linked with the threads library.
32
33In this mode, the collector contains various workarounds for older Solaris
34bugs. Mostly, these should not be noticeable unless you look at system
35call traces. However, it cannot protect a guard page at the end of
36a thread stack. If you know that you will only be running Solaris2.5
37or later, it should be possible to fix this by compiling the collector
38with -DSOLARIS23_MPROTECT_BUG_FIXED.
39
40Since 5.0 alpha5, dlopen disables collection temporarily,
41unless USE_PROC_FOR_LIBRARIES is defined. In some unlikely cases, this
42can result in unpleasant heap growth. But it seems better than the
43race/deadlock issues we had before.
44
45If solaris_threads are used on an X86 processor with malloc redirected to
46GC_malloc, it is necessary to call GC_thr_init explicitly before forking the
47first thread. (This avoids a deadlock arising from calling GC_thr_init
48with the allocation lock held.)
49
50It appears that there is a problem in using gc_cpp.h in conjunction with
51Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator
52is invoked by some iostream initialization code before threads are correctly
53initialized. As a result, call to thr_self() in garbage collector
54initialization segfaults. Currently the only known workaround is to not
55invoke the garbage collector from a user defined global operator new, or to
56have it invoke the garbage-collector's allocators only after main has started.
57(Note that the latter requires a moderately expensive test in operator
58delete.)
59
60Hans-J. Boehm
61(The above contains my personal opinions, which are probably not shared
62by anyone else.)
diff --git a/gc/doc/README.uts b/gc/doc/README.uts
deleted file mode 100644
index 6be49667d7b..00000000000
--- a/gc/doc/README.uts
+++ /dev/null
@@ -1,2 +0,0 @@
1Alistair Crooks supplied the port. He used Lexa C version 2.1.3 with
2-Xa to compile.
diff --git a/gc/doc/README.win32 b/gc/doc/README.win32
deleted file mode 100644
index c95f149faa1..00000000000
--- a/gc/doc/README.win32
+++ /dev/null
@@ -1,170 +0,0 @@
1The collector has at various times been compiled under Windows 95 & NT,
2with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with
3the GNU win32 environment, with Borland 4.5, with Watcom C, and recently
4with the Digital Mars compiler. It is likely that some of these have been
5broken in the meantime. Patches are appreciated.
6
7It runs under both win32s and win32, but with different semantics.
8Under win32, all writable pages outside of the heaps and stack are
9scanned for roots. Thus the collector sees pointers in DLL data
10segments. Under win32s, only the main data segment is scanned.
11(The main data segment should always be scanned. Under some
12versions of win32s, other regions may also be scanned.)
13Thus all accessible objects should be accessible from local variables
14or variables in the main data segment. Alternatively, other data
15segments (e.g. in DLLs) may be registered with the collector by
16calling GC_init() and then GC_register_root_section(a), where
17a is the address of some variable inside the data segment. (Duplicate
18registrations are ignored, but not terribly quickly.)
19
20(There are two reasons for this. We didn't want to see many 16:16
21pointers. And the VirtualQuery call has different semantics under
22the two systems, and under different versions of win32s.)
23
24Win32 applications compiled with some flavor of gcc currently behave
25like win32s applications, in that dynamic library data segments are
26not scanned. (Gcc does not directly support Microsoft's "structured
27exception handling". It turns out that use of this feature is
28unavoidable if you scan arbitrary memory segments obtained from
29VirtualQuery.)
30
31The collector test program "gctest" is linked as a GUI application,
32but does not open any windows. Its output appears in the file
33"gc.log". It may be started from the file manager. The hour glass
34cursor may appear as long as it's running. If it is started from the
35command line, it will usually run in the background. Wait a few
36minutes (a few seconds on a modern machine) before you check the output.
37You should see either a failure indication or a "Collector appears to
38work" message.
39
40The cord test program has not been ported (but should port
41easily). A toy editor (cord/de.exe) based on cords (heavyweight
42strings represented as trees) has been ported and is included.
43It runs fine under either win32 or win32S. It serves as an example
44of a true Windows application, except that it was written by a
45nonexpert Windows programmer. (There are some peculiarities
46in the way files are displayed. The <cr> is displayed explicitly
47for standard DOS text files. As in the UNIX version, control
48characters are displayed explicitly, but in this case as red text.
49This may be suboptimal for some tastes and/or sets of default
50window colors.)
51
52In general -DREDIRECT_MALLOC is unlikely to work unless the
53application is completely statically linked.
54
55The collector normally allocates memory from the OS with VirtualAlloc.
56This appears to cause problems under Windows NT and Windows 2000 (but
57not Windows 95/98) if the memory is later passed to CreateDIBitmap.
58To work around this problem, build the collector with -DUSE_GLOBAL_ALLOC.
59This is currently incompatible with -DUSE_MUNMAP. (Thanks to Jonathan
60Clark for tracking this down. There's some chance this may be fixed
61in 6.1alpha4, since we now separate heap sections with an unused page.)
62
63For Microsoft development tools, rename NT_MAKEFILE as
64MAKEFILE. (Make sure that the CPU environment variable is defined
65to be i386.) In order to use the gc_cpp.h C++ interface, all
66client code should include gc_cpp.h.
67
68If you would prefer a VC++.NET project file, ask boehm@acm.org. One has
69been contributed, but it seems to contain some absolute paths etc., so
70it can presumably only be a starting point, and is not in the standard
71distribution. It is unclear (to me, Hans Boehm) whether it is feasible to
72change that.
73
74Clients may need to define GC_NOT_DLL before including gc.h, if the
75collector was built as a static library (as it normally is in the
76absence of thread support).
77
78For GNU-win32, use the regular makefile, possibly after uncommenting
79the line "include Makefile.DLLs". The latter should be necessary only
80if you want to package the collector as a DLL. The GNU-win32 port is
81believed to work only for b18, not b19, probably due to linker changes
82in b19. This is probably fixable with a different definition of
83DATASTART and DATAEND in gcconfig.h.
84
85For Borland tools, use BCC_MAKEFILE. Note that
86Borland's compiler defaults to 1 byte alignment in structures (-a1),
87whereas Visual C++ appears to default to 8 byte alignment (/Zp8).
88The garbage collector in its default configuration EXPECTS AT
89LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST
90BE OVERRIDDEN. (In my opinion, it should usually be anyway.
91I expect that -a1 introduces major performance penalties on a
92486 or Pentium.) Note that this changes structure layouts. (As a last
93resort, gcconfig.h can be changed to allow 1 byte alignment. But
94this has significant negative performance implications.)
95The Makefile is set up to assume Borland 4.5. If you have another
96version, change the line near the top. By default, it does not
97require the assembler. If you do have the assembler, I recommend
98removing the -DUSE_GENERIC.
99
100There is some support for incremental collection. This is
101currently pretty simple-minded. Pages are protected. Protection
102faults are caught by a handler installed at the bottom of the handler
103stack. This is both slow and interacts poorly with a debugger.
104Whenever possible, I recommend adding a call to
105GC_enable_incremental at the last possible moment, after most
106debugging is complete. Unlike the UNIX versions, no system
107calls are wrapped by the collector itself. It may be necessary
108to wrap ReadFile calls that use a buffer in the heap, so that the
109call does not encounter a protection fault while it's running.
110(As usual, none of this is an issue unless GC_enable_incremental
111is called.)
112
113Note that incremental collection is disabled with -DSMALL_CONFIG.
114
115James Clark has contributed the necessary code to support win32 threads.
116Use NT_THREADS_MAKEFILE (a.k.a gc.mak) instead of NT_MAKEFILE
117to build this version. Note that this requires some files whose names
118are more than 8 + 3 characters long. Thus you should unpack the tar file
119so that long file names are preserved. To build the garbage collector
120test with VC++ from the command line, use
121
122nmake /F ".\gc.mak" CFG="gctest - Win32 Release"
123
124This requires that the subdirectory gctest\Release exist.
125The test program and DLL will reside in the Release directory.
126
127This version relies on the collector residing in a dll.
128
129This version currently supports incremental collection only if it is
130enabled before any additional threads are created.
131Version 4.13 attempts to fix some of the earlier problems, but there
132may be other issues. If you need solid support for win32 threads, you
133might check with Geodesic Systems. Their collector must be licensed,
134but they have invested far more time in win32-specific issues.
135
136Hans
137
138Ivan V. Demakov's README for the Watcom port:
139
140The collector has been compiled with Watcom C 10.6 and 11.0.
141It runs under win32, win32s, and even under msdos with dos4gw
142dos-extender. It should also run under OS/2, though this isn't
143tested. Under win32 the collector can be built either as dll
144or as static library.
145
146Note that all compilations were done under Windows 95 or NT.
147For unknown reason compiling under Windows 3.11 for NT (one
148attempt has been made) leads to broken executables.
149
150Incremental collection is not supported.
151
152cord is not ported.
153
154Before compiling you may need to edit WCC_MAKEFILE to set target
155platform, library type (dynamic or static), calling conventions, and
156optimization options.
157
158To compile the collector and testing programs use the command:
159 wmake -f WCC_MAKEFILE
160
161All programs using gc should be compiled with 4-byte alignment.
162For further explanations on this see comments about Borland.
163
164If gc compiled as dll, the macro ``GC_DLL'' should be defined before
165including "gc.h" (for example, with -DGC_DLL compiler option). It's
166important, otherwise resulting programs will not run.
167
168Ivan Demakov (email: ivan@tgrad.nsk.su)
169
170
diff --git a/gc/doc/barrett_diagram b/gc/doc/barrett_diagram
deleted file mode 100644
index 27e80dc15cd..00000000000
--- a/gc/doc/barrett_diagram
+++ /dev/null
@@ -1,106 +0,0 @@
1This is an ASCII diagram of the data structure used to check pointer
2validity. It was provided by Dave Barrett <barrett@asgard.cs.colorado.edu>,
3and should be of use to others attempting to understand the code.
4The data structure in GC4.X is essentially the same. -HB
5
6
7
8
9 Data Structure used by GC_base in gc3.7:
10 21-Apr-94
11
12
13
14
15 63 LOG_TOP_SZ[11] LOG_BOTTOM_SZ[10] LOG_HBLKSIZE[13]
16 +------------------+----------------+------------------+------------------+
17 p:| | TL_HASH(hi) | | HBLKDISPL(p) |
18 +------------------+----------------+------------------+------------------+
19 \-----------------------HBLKPTR(p)-------------------/
20 \------------hi-------------------/
21 \______ ________/ \________ _______/ \________ _______/
22 V V V
23 | | |
24 GC_top_index[] | | |
25 --- +--------------+ | | |
26 ^ | | | | |
27 | | | | | |
28 TOP +--------------+<--+ | |
29 _SZ +-<| [] | * | |
30(items)| +--------------+ if 0 < bi< HBLKSIZE | |
31 | | | | then large object | |
32 | | | | starts at the bi'th | |
33 v | | | HBLK before p. | i |
34 --- | +--------------+ | (word- |
35 v | aligned) |
36 bi= |GET_BI(p){->hash_link}->key==hi | |
37 v | |
38 | (bottom_index) \ scratch_alloc'd | |
39 | ( struct bi ) / by get_index() | |
40 --- +->+--------------+ | |
41 ^ | | | |
42 ^ | | | |
43 BOTTOM | | ha=GET_HDR_ADDR(p) | |
44_SZ(items)+--------------+<----------------------+ +-------+
45 | +--<| index[] | |
46 | | +--------------+ GC_obj_map: v
47 | | | | from / +-+-+-----+-+-+-+-+ ---
48 v | | | GC_add < 0| | | | | | | | ^
49 --- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ |
50 | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ
51 | +--------------+ +-->| | | j | | | | | +1
52 | | key | | +-+-+-----+-+-+-+-+ |
53 | +--------------+ | +-+-+-----+-+-+-+-+ |
54 | | hash_link | | | | | | | | | | v
55 | +--------------+ | +-+-+-----+-+-+-+-+ ---
56 | | |<--MAX_OFFSET--->|
57 | | (bytes)
58HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->|
59 | \ from | =HBLKSIZE/WORDSZ
60 | (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha)
61 +-->+----------------------+ | (8/16 bits each)
62GET_HDR(p)| word hb_sz (words) | |
63 +----------------------+ |
64 | struct hblk *hb_next | |
65 +----------------------+ |
66 |mark_proc hb_mark_proc| |
67 +----------------------+ |
68 | char * hb_map |>-------------+
69 +----------------------+
70 | ushort hb_obj_kind |
71 +----------------------+
72 | hb_last_reclaimed |
73 --- +----------------------+
74 ^ | |
75 MARK_BITS| hb_marks[] | *if hdr is free, hb_sz + DISCARD_WORDS
76_SZ(words)| | is the size of a heap chunk (struct hblk)
77 v | | of at least MININCR*HBLKSIZE bytes (below),
78 --- +----------------------+ otherwise, size of each object in chunk.
79
80Dynamic data structures above are interleaved throughout the heap in blocks of
81size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be
82freed; free lists are used (e.g. alloc_hdr). HBLKs's below are collected.
83
84 (struct hblk)
85 --- +----------------------+ < HBLKSIZE --- --- DISCARD_
86 ^ |garbage[DISCARD_WORDS]| aligned ^ ^ HDR_BYTES WORDS
87 | | | | v (bytes) (words)
88 | +-----hb_body----------+ < WORDSZ | --- ---
89 | | | aligned | ^ ^
90 | | Object 0 | | hb_sz |
91 | | | i |(word- (words)|
92 | | | (bytes)|aligned) v |
93 | + - - - - - - - - - - -+ --- | --- |
94 | | | ^ | ^ |
95 n * | | j (words) | hb_sz BODY_SZ
96 HBLKSIZE | Object 1 | v v | (words)
97 (bytes) | |--------------- v MAX_OFFSET
98 | + - - - - - - - - - - -+ --- (bytes)
99 | | | !All_INTERIOR_PTRS ^ |
100 | | | sets j only for hb_sz |
101 | | Object N | valid object offsets. | |
102 v | | All objects WORDSZ v v
103 --- +----------------------+ aligned. --- ---
104
105DISCARD_WORDS is normally zero. Indeed the collector has not been tested
106with another value in ages.
diff --git a/gc/doc/debugging.html b/gc/doc/debugging.html
deleted file mode 100644
index 22273fed4bc..00000000000
--- a/gc/doc/debugging.html
+++ /dev/null
@@ -1,295 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Debugging Garbage Collector Related Problems</title>
4</head>
5<BODY>
6<H1>Debugging Garbage Collector Related Problems</h1>
7This page contains some hints on
8debugging issues specific to
9the Boehm-Demers-Weiser conservative garbage collector.
10It applies both to debugging issues in client code that manifest themselves
11as collector misbehavior, and to debugging the collector itself.
12<P>
13If you suspect a bug in the collector itself, it is strongly recommended
14that you try the latest collector release, even if it is labelled as "alpha",
15before proceeding.
16<H2>Bus Errors and Segmentation Violations</h2>
17<P>
18If the fault occurred in GC_find_limit, or with incremental collection enabled,
19this is probably normal. The collector installs handlers to take care of
20these. You will not see these unless you are using a debugger.
21Your debugger <I>should</i> allow you to continue.
22It's often preferable to tell the debugger to ignore SIGBUS and SIGSEGV
23("<TT>handle SIGSEGV SIGBUS nostop noprint</tt>" in gdb,
24"<TT>ignore SIGSEGV SIGBUS</tt>" in most versions of dbx)
25and set a breakpoint in <TT>abort</tt>.
26The collector will call abort if the signal had another cause,
27and there was not other handler previously installed.
28<P>
29We recommend debugging without incremental collection if possible.
30(This applies directly to UNIX systems.
31Debugging with incremental collection under win32 is worse. See README.win32.)
32<P>
33If the application generates an unhandled SIGSEGV or equivalent, it may
34often be easiest to set the environment variable GC_LOOP_ON_ABORT. On many
35platforms, this will cause the collector to loop in a handler when the
36SIGSEGV is encountered (or when the collector aborts for some other reason),
37and a debugger can then be attached to the looping
38process. This sidesteps common operating system problems related
39to incomplete core files for multithreaded applications, etc.
40<H2>Other Signals</h2>
41On most platforms, the multithreaded version of the collector needs one or
42two other signals for internal use by the collector in stopping threads.
43It is normally wise to tell the debugger to ignore these. On Linux,
44the collector currently uses SIGPWR and SIGXCPU by default.
45<H2>Warning Messages About Needing to Allocate Blacklisted Blocks</h2>
46The garbage collector generates warning messages of the form
47<PRE>
48Needed to allocate blacklisted block at 0x...
49</pre>
50when it needs to allocate a block at a location that it knows to be
51referenced by a false pointer. These false pointers can be either permanent
52(<I>e.g.</i> a static integer variable that never changes) or temporary.
53In the latter case, the warning is largely spurious, and the block will
54eventually be reclaimed normally.
55In the former case, the program will still run correctly, but the block
56will never be reclaimed. Unless the block is intended to be
57permanent, the warning indicates a memory leak.
58<OL>
59<LI>Ignore these warnings while you are using GC_DEBUG. Some of the routines
60mentioned below don't have debugging equivalents. (Alternatively, write
61the missing routines and send them to me.)
62<LI>Replace allocator calls that request large blocks with calls to
63<TT>GC_malloc_ignore_off_page</tt> or
64<TT>GC_malloc_atomic_ignore_off_page</tt>. You may want to set a
65breakpoint in <TT>GC_default_warn_proc</tt> to help you identify such calls.
66Make sure that a pointer to somewhere near the beginning of the resulting block
67is maintained in a (preferably volatile) variable as long as
68the block is needed.
69<LI>
70If the large blocks are allocated with realloc, we suggest instead allocating
71them with something like the following. Note that the realloc size increment
72should be fairly large (e.g. a factor of 3/2) for this to exhibit reasonable
73performance. But we all know we should do that anyway.
74<PRE>
75void * big_realloc(void *p, size_t new_size)
76{
77 size_t old_size = GC_size(p);
78 void * result;
79
80 if (new_size <= 10000) return(GC_realloc(p, new_size));
81 if (new_size <= old_size) return(p);
82 result = GC_malloc_ignore_off_page(new_size);
83 if (result == 0) return(0);
84 memcpy(result,p,old_size);
85 GC_free(p);
86 return(result);
87}
88</pre>
89
90<LI> In the unlikely case that even relatively small object
91(&lt;20KB) allocations are triggering these warnings, then your address
92space contains lots of "bogus pointers", i.e. values that appear to
93be pointers but aren't. Usually this can be solved by using GC_malloc_atomic
94or the routines in gc_typed.h to allocate large pointer-free regions of bitmaps, etc. Sometimes the problem can be solved with trivial changes of encoding
95in certain values. It is possible, to identify the source of the bogus
96pointers by building the collector with <TT>-DPRINT_BLACK_LIST</tt>,
97which will cause it to print the "bogus pointers", along with their location.
98
99<LI> If you get only a fixed number of these warnings, you are probably only
100introducing a bounded leak by ignoring them. If the data structures being
101allocated are intended to be permanent, then it is also safe to ignore them.
102The warnings can be turned off by calling GC_set_warn_proc with a procedure
103that ignores these warnings (e.g. by doing absolutely nothing).
104</ol>
105
106<H2>The Collector References a Bad Address in <TT>GC_malloc</tt></h2>
107
108This typically happens while the collector is trying to remove an entry from
109its free list, and the free list pointer is bad because the free list link
110in the last allocated object was bad.
111<P>
112With &gt; 99% probability, you wrote past the end of an allocated object.
113Try setting <TT>GC_DEBUG</tt> before including <TT>gc.h</tt> and
114allocating with <TT>GC_MALLOC</tt>. This will try to detect such
115overwrite errors.
116
117<H2>Unexpectedly Large Heap</h2>
118
119Unexpected heap growth can be due to one of the following:
120<OL>
121<LI> Data structures that are being unintentionally retained. This
122is commonly caused by data structures that are no longer being used,
123but were not cleared, or by caches growing without bounds.
124<LI> Pointer misidentification. The garbage collector is interpreting
125integers or other data as pointers and retaining the "referenced"
126objects.
127<LI> Heap fragmentation. This should never result in unbounded growth,
128but it may account for larger heaps. This is most commonly caused
129by allocation of large objects. On some platforms it can be reduced
130by building with -DUSE_MUNMAP, which will cause the collector to unmap
131memory corresponding to pages that have not been recently used.
132<LI> Per object overhead. This is usually a relatively minor effect, but
133it may be worth considering. If the collector recognizes interior
134pointers, object sizes are increased, so that one-past-the-end pointers
135are correctly recognized. The collector can be configured not to do this
136(<TT>-DDONT_ADD_BYTE_AT_END</tt>).
137<P>
138The collector rounds up object sizes so the result fits well into the
139chunk size (<TT>HBLKSIZE</tt>, normally 4K on 32 bit machines, 8K
140on 64 bit machines) used by the collector. Thus it may be worth avoiding
141objects of size 2K + 1 (or 2K if a byte is being added at the end.)
142</ol>
143The last two cases can often be identified by looking at the output
144of a call to <TT>GC_dump()</tt>. Among other things, it will print the
145list of free heap blocks, and a very brief description of all chunks in
146the heap, the object sizes they correspond to, and how many live objects
147were found in the chunk at the last collection.
148<P>
149Growing data structures can usually be identified by
150<OL>
151<LI> Building the collector with <TT>-DKEEP_BACK_PTRS</tt>,
152<LI> Preferably using debugging allocation (defining <TT>GC_DEBUG</tt>
153before including <TT>gc.h</tt> and allocating with <TT>GC_MALLOC</tt>),
154so that objects will be identified by their allocation site,
155<LI> Running the application long enough so
156that most of the heap is composed of "leaked" memory, and
157<LI> Then calling <TT>GC_generate_random_backtrace()</tt> from backptr.h
158a few times to determine why some randomly sampled objects in the heap are
159being retained.
160</ol>
161<P>
162The same technique can often be used to identify problems with false
163pointers, by noting whether the reference chains printed by
164<TT>GC_generate_random_backtrace()</tt> involve any misidentified pointers.
165An alternate technique is to build the collector with
166<TT>-DPRINT_BLACK_LIST</tt> which will cause it to report values that
167are almost, but not quite, look like heap pointers. It is very likely that
168actual false pointers will come from similar sources.
169<P>
170In the unlikely case that false pointers are an issue, it can usually
171be resolved using one or more of the following techniques:
172<OL>
173<LI> Use <TT>GC_malloc_atomic</tt> for objects containing no pointers.
174This is especially important for large arrays containing compressed data,
175pseudo-random numbers, and the like. It is also likely to improve GC
176performance, perhaps drastically so if the application is paging.
177<LI> If you allocate large objects containing only
178one or two pointers at the beginning, either try the typed allocation
179primitives is <TT>gc_typed.h</tt>, or separate out the pointerfree component.
180<LI> Consider using <TT>GC_malloc_ignore_off_page()</tt>
181to allocate large objects. (See <TT>gc.h</tt> and above for details.
182Large means &gt; 100K in most environments.)
183</ol>
184<H2>Prematurely Reclaimed Objects</h2>
185The usual symptom of this is a segmentation fault, or an obviously overwritten
186value in a heap object. This should, of course, be impossible. In practice,
187it may happen for reasons like the following:
188<OL>
189<LI> The collector did not intercept the creation of threads correctly in
190a multithreaded application, <I>e.g.</i> because the client called
191<TT>pthread_create</tt> without including <TT>gc.h</tt>, which redefines it.
192<LI> The last pointer to an object in the garbage collected heap was stored
193somewhere were the collector couldn't see it, <I>e.g.</i> in an
194object allocated with system <TT>malloc</tt>, in certain types of
195<TT>mmap</tt>ed files,
196or in some data structure visible only to the OS. (On some platforms,
197thread-local storage is one of these.)
198<LI> The last pointer to an object was somehow disguised, <I>e.g.</i> by
199XORing it with another pointer.
200<LI> Incorrect use of <TT>GC_malloc_atomic</tt> or typed allocation.
201<LI> An incorrect <TT>GC_free</tt> call.
202<LI> The client program overwrote an internal garbage collector data structure.
203<LI> A garbage collector bug.
204<LI> (Empirically less likely than any of the above.) A compiler optimization
205that disguised the last pointer.
206</ol>
207The following relatively simple techniques should be tried first to narrow
208down the problem:
209<OL>
210<LI> If you are using the incremental collector try turning it off for
211debugging.
212<LI> If you are using shared libraries, try linking statically. If that works,
213ensure that DYNAMIC_LOADING is defined on your platform.
214<LI> Try to reproduce the problem with fully debuggable unoptimized code.
215This will eliminate the last possibility, as well as making debugging easier.
216<LI> Try replacing any suspect typed allocation and <TT>GC_malloc_atomic</tt>
217calls with calls to <TT>GC_malloc</tt>.
218<LI> Try removing any GC_free calls (<I>e.g.</i> with a suitable
219<TT>#define</tt>).
220<LI> Rebuild the collector with <TT>-DGC_ASSERTIONS</tt>.
221<LI> If the following works on your platform (i.e. if gctest still works
222if you do this), try building the collector with
223<TT>-DREDIRECT_MALLOC=GC_malloc_uncollectable</tt>. This will cause
224the collector to scan memory allocated with malloc.
225</ol>
226If all else fails, you will have to attack this with a debugger.
227Suggested steps:
228<OL>
229<LI> Call <TT>GC_dump()</tt> from the debugger around the time of the failure. Verify
230that the collectors idea of the root set (i.e. static data regions which
231it should scan for pointers) looks plausible. If not, i.e. if it doesn't
232include some static variables, report this as
233a collector bug. Be sure to describe your platform precisely, since this sort
234of problem is nearly always very platform dependent.
235<LI> Especially if the failure is not deterministic, try to isolate it to
236a relatively small test case.
237<LI> Set a break point in <TT>GC_finish_collection</tt>. This is a good
238point to examine what has been marked, i.e. found reachable, by the
239collector.
240<LI> If the failure is deterministic, run the process
241up to the last collection before the failure.
242Note that the variable <TT>GC_gc_no</tt> counts collections and can be used
243to set a conditional breakpoint in the right one. It is incremented just
244before the call to GC_finish_collection.
245If object <TT>p</tt> was prematurely recycled, it may be helpful to
246look at <TT>*GC_find_header(p)</tt> at the failure point.
247The <TT>hb_last_reclaimed</tt> field will identify the collection number
248during which its block was last swept.
249<LI> Verify that the offending object still has its correct contents at
250this point.
251Then call <TT>GC_is_marked(p)</tt> from the debugger to verify that the
252object has not been marked, and is about to be reclaimed. Note that
253<TT>GC_is_marked(p)</tt> expects the real address of an object (the
254address of the debug header if there is one), and thus it may
255be more appropriate to call <TT>GC_is_marked(GC_base(p))</tt>
256instead.
257<LI> Determine a path from a root, i.e. static variable, stack, or
258register variable,
259to the reclaimed object. Call <TT>GC_is_marked(q)</tt> for each object
260<TT>q</tt> along the path, trying to locate the first unmarked object, say
261<TT>r</tt>.
262<LI> If <TT>r</tt> is pointed to by a static root,
263verify that the location
264pointing to it is part of the root set printed by <TT>GC_dump()</tt>. If it
265is on the stack in the main (or only) thread, verify that
266<TT>GC_stackbottom</tt> is set correctly to the base of the stack. If it is
267in another thread stack, check the collector's thread data structure
268(<TT>GC_thread[]</tt> on several platforms) to make sure that stack bounds
269are set correctly.
270<LI> If <TT>r</tt> is pointed to by heap object <TT>s</tt>, check that the
271collector's layout description for <TT>s</tt> is such that the pointer field
272will be scanned. Call <TT>*GC_find_header(s)</tt> to look at the descriptor
273for the heap chunk. The <TT>hb_descr</tt> field specifies the layout
274of objects in that chunk. See gc_mark.h for the meaning of the descriptor.
275(If it's low order 2 bits are zero, then it is just the length of the
276object prefix to be scanned. This form is always used for objects allocated
277with <TT>GC_malloc</tt> or <TT>GC_malloc_atomic</tt>.)
278<LI> If the failure is not deterministic, you may still be able to apply some
279of the above technique at the point of failure. But remember that objects
280allocated since the last collection will not have been marked, even if the
281collector is functioning properly. On some platforms, the collector
282can be configured to save call chains in objects for debugging.
283Enabling this feature will also cause it to save the call stack at the
284point of the last GC in GC_arrays._last_stack.
285<LI> When looking at GC internal data structures remember that a number
286of <TT>GC_</tt><I>xxx</i> variables are really macro defined to
287<TT>GC_arrays._</tt><I>xxx</i>, so that
288the collector can avoid scanning them.
289</ol>
290</body>
291</html>
292
293
294
295
diff --git a/gc/doc/gc.man b/gc/doc/gc.man
deleted file mode 100644
index 5409e706550..00000000000
--- a/gc/doc/gc.man
+++ /dev/null
@@ -1,80 +0,0 @@
1.TH GC_MALLOC 1L "12 February 1996"
2.SH NAME
3GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement
4.SH SYNOPSIS
5#include "gc.h"
6.br
7# define malloc(n) GC_malloc(n)
8.br
9... malloc(...) ...
10.br
11.sp
12cc ... gc.a
13.LP
14.SH DESCRIPTION
15.I GC_malloc
16and
17.I GC_free
18are plug-in replacements for standard malloc and free. However,
19.I
20GC_malloc
21will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by
22.I
23GC_malloc
24or friends.
25.LP
26See the documentation in the include file gc_cpp.h for an alternate, C++ specific interface to the garbage collector.
27.LP
28Unlike the standard implementations of malloc,
29.I
30GC_malloc
31clears the newly allocated storage.
32.I
33GC_malloc_atomic
34does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector.
35.LP
36.I
37GC_free
38can be used to deallocate objects, but its use is optional, and generally discouraged.
39.I
40GC_realloc
41has the standard realloc semantics. It preserves pointer-free-ness.
42.I
43GC_register_finalizer
44allows for registration of functions that are invoked when an object becomes inaccessible.
45.LP
46The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning.
47.LP
48.I
49GC_malloc_ignore_off_page
50and
51.I
52GC_malloc_atomic_ignore_off_page
53inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.)
54.LP
55It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed.
56.LP
57The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with
58.I
59GC_set_warn_proc.
60This is recommended for production code. See gc.h for details.
61.LP
62Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions.
63.LP
64On some machines, collection will be performed incrementally after a call to
65.I
66GC_enable_incremental.
67This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap.
68.LP
69Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
70.LP
71.SH "SEE ALSO"
72The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.)
73.LP
74Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
75\fISoftware Practice & Experience\fP, September 1988, pp. 807-820.
76.LP
77The malloc(3) man page.
78.LP
79.SH AUTHOR
80Hans-J. Boehm (boehm@parc.xerox.com). Some of the code was written by others, most notably Alan Demers.
diff --git a/gc/doc/gcdescr.html b/gc/doc/gcdescr.html
deleted file mode 100644
index 8ecbac8db62..00000000000
--- a/gc/doc/gcdescr.html
+++ /dev/null
@@ -1,520 +0,0 @@
1<HTML>
2<HEAD>
3 <TITLE> Conservative GC Algorithmic Overview </TITLE>
4 <AUTHOR> Hans-J. Boehm, HP Labs (Much of this was written at SGI)</author>
5</HEAD>
6<BODY>
7<H1> <I>This is under construction</i> </h1>
8<H1> Conservative GC Algorithmic Overview </h1>
9<P>
10This is a description of the algorithms and data structures used in our
11conservative garbage collector. I expect the level of detail to increase
12with time. For a survey of GC algorithms, see for example
13<A HREF="ftp://ftp.cs.utexas.edu/pub/garbage/gcsurvey.ps"> Paul Wilson's
14excellent paper</a>. For an overview of the collector interface,
15see <A HREF="gcinterface.html">here</a>.
16<P>
17This description is targeted primarily at someone trying to understand the
18source code. It specifically refers to variable and function names.
19It may also be useful for understanding the algorithms at a higher level.
20<P>
21The description here assumes that the collector is used in default mode.
22In particular, we assume that it used as a garbage collector, and not just
23a leak detector. We initially assume that it is used in stop-the-world,
24non-incremental mode, though the presence of the incremental collector
25will be apparent in the design.
26We assume the default finalization model, but the code affected by that
27is very localized.
28<H2> Introduction </h2>
29The garbage collector uses a modified mark-sweep algorithm. Conceptually
30it operates roughly in four phases:
31
32<OL>
33
34<LI>
35<I>Preparation</i> Clear all mark bits, indicating that all objects
36are potentially unreachable.
37
38<LI>
39<I>Mark phase</i> Marks all objects that can be reachable via chains of
40pointers from variables. Normally the collector has no real information
41about the location of pointer variables in the heap, so it
42views all static data areas, stacks and registers as potentially containing
43containing pointers. Any bit patterns that represent addresses inside
44heap objects managed by the collector are viewed as pointers.
45Unless the client program has made heap object layout information
46available to the collector, any heap objects found to be reachable from
47variables are again scanned similarly.
48
49<LI>
50<I>Sweep phase</i> Scans the heap for inaccessible, and hence unmarked,
51objects, and returns them to an appropriate free list for reuse. This is
52not really a separate phase; even in non incremental mode this is operation
53is usually performed on demand during an allocation that discovers an empty
54free list. Thus the sweep phase is very unlikely to touch a page that
55would not have been touched shortly thereafter anyway.
56
57<LI>
58<I>Finalization phase</i> Unreachable objects which had been registered
59for finalization are enqueued for finalization outside the collector.
60
61</ol>
62
63<P>
64The remaining sections describe the memory allocation data structures,
65and then the last 3 collection phases in more detail. We conclude by
66outlining some of the additional features implemented in the collector.
67
68<H2>Allocation</h2>
69The collector includes its own memory allocator. The allocator obtains
70memory from the system in a platform-dependent way. Under UNIX, it
71uses either <TT>malloc</tt>, <TT>sbrk</tt>, or <TT>mmap</tt>.
72<P>
73Most static data used by the allocator, as well as that needed by the
74rest of the garbage collector is stored inside the
75<TT>_GC_arrays</tt> structure.
76This allows the garbage collector to easily ignore the collectors own
77data structures when it searches for root pointers. Other allocator
78and collector internal data structures are allocated dynamically
79with <TT>GC_scratch_alloc</tt>. <TT>GC_scratch_alloc</tt> does not
80allow for deallocation, and is therefore used only for permanent data
81structures.
82<P>
83The allocator allocates objects of different <I>kinds</i>.
84Different kinds are handled somewhat differently by certain parts
85of the garbage collector. Certain kinds are scanned for pointers,
86others are not. Some may have per-object type descriptors that
87determine pointer locations. Or a specific kind may correspond
88to one specific object layout. Two built-in kinds are uncollectable.
89One (<TT>STUBBORN</tt>) is immutable without special precautions.
90In spite of that, it is very likely that most applications currently
91use at most two kinds: <TT>NORMAL</tt> and <TT>PTRFREE</tt> objects.
92<P>
93The collector uses a two level allocator. A large block is defined to
94be one larger than half of <TT>HBLKSIZE</tt>, which is a power of 2,
95typically on the order of the page size.
96<P>
97Large block sizes are rounded up to
98the next multiple of <TT>HBLKSIZE</tt> and then allocated by
99<TT>GC_allochblk</tt>. Recent versions of the collector
100use an approximate best fit algorithm by keeping free lists for
101several large block sizes.
102The actual
103implementation of <TT>GC_allochblk</tt>
104is significantly complicated by black-listing issues
105(see below).
106<P>
107Small blocks are allocated in chunks of size <TT>HBLKSIZE</tt>.
108Each chunk is
109dedicated to only one object size and kind. The allocator maintains
110separate free lists for each size and kind of object.
111<P>
112Once a large block is split for use in smaller objects, it can only
113be used for objects of that size, unless the collector discovers a completely
114empty chunk. Completely empty chunks are restored to the appropriate
115large block free list.
116<P>
117In order to avoid allocating blocks for too many distinct object sizes,
118the collector normally does not directly allocate objects of every possible
119request size. Instead request are rounded up to one of a smaller number
120of allocated sizes, for which free lists are maintained. The exact
121allocated sizes are computed on demand, but subject to the constraint
122that they increase roughly in geometric progression. Thus objects
123requested early in the execution are likely to be allocated with exactly
124the requested size, subject to alignment constraints.
125See <TT>GC_init_size_map</tt> for details.
126<P>
127The actual size rounding operation during small object allocation is
128implemented as a table lookup in <TT>GC_size_map</tt>.
129<P>
130Both collector initialization and computation of allocated sizes are
131handled carefully so that they do not slow down the small object fast
132allocation path. An attempt to allocate before the collector is initialized,
133or before the appropriate <TT>GC_size_map</tt> entry is computed,
134will take the same path as an allocation attempt with an empty free list.
135This results in a call to the slow path code (<TT>GC_generic_malloc_inner</tt>)
136which performs the appropriate initialization checks.
137<P>
138In non-incremental mode, we make a decision about whether to garbage collect
139whenever an allocation would otherwise have failed with the current heap size.
140If the total amount of allocation since the last collection is less than
141the heap size divided by <TT>GC_free_space_divisor</tt>, we try to
142expand the heap. Otherwise, we initiate a garbage collection. This ensures
143that the amount of garbage collection work per allocated byte remains
144constant.
145<P>
146The above is in fact an oversimplification of the real heap expansion
147and GC triggering heuristic, which adjusts slightly for root size
148and certain kinds of
149fragmentation. In particular:
150<UL>
151<LI> Programs with a large root set size and
152little live heap memory will expand the heap to amortize the cost of
153scanning the roots.
154<LI> Versions 5.x of the collector actually collect more frequently in
155nonincremental mode. The large block allocator usually refuses to split
156large heap blocks once the garbage collection threshold is
157reached. This often has the effect of collecting well before the
158heap fills up, thus reducing fragmentation and working set size at the
159expense of GC time. Versions 6.x choose an intermediate strategy depending
160on how much large object allocation has taken place in the past.
161(If the collector is configured to unmap unused pages, versions 6.x
162use the 5.x strategy.)
163<LI> In calculating the amount of allocation since the last collection we
164give partial credit for objects we expect to be explicitly deallocated.
165Even if all objects are explicitly managed, it is often desirable to collect
166on rare occasion, since that is our only mechanism for coalescing completely
167empty chunks.
168</ul>
169<P>
170It has been suggested that this should be adjusted so that we favor
171expansion if the resulting heap still fits into physical memory.
172In many cases, that would no doubt help. But it is tricky to do this
173in a way that remains robust if multiple application are contending
174for a single pool of physical memory.
175
176<H2>Mark phase</h2>
177
178The marker maintains an explicit stack of memory regions that are known
179to be accessible, but that have not yet been searched for contained pointers.
180Each stack entry contains the starting address of the block to be scanned,
181as well as a descriptor of the block. If no layout information is
182available for the block, then the descriptor is simply a length.
183(For other possibilities, see <TT>gc_mark.h</tt>.)
184<P>
185At the beginning of the mark phase, all root segments are pushed on the
186stack by <TT>GC_push_roots</tt>. If <TT>ALL_INTERIOR_PTRS</tt> is not
187defined, then stack roots require special treatment. In this case, the
188normal marking code ignores interior pointers, but <TT>GC_push_all_stack</tt>
189explicitly checks for interior pointers and pushes descriptors for target
190objects.
191<P>
192The marker is structured to allow incremental marking.
193Each call to <TT>GC_mark_some</tt> performs a small amount of
194work towards marking the heap.
195It maintains
196explicit state in the form of <TT>GC_mark_state</tt>, which
197identifies a particular sub-phase. Some other pieces of state, most
198notably the mark stack, identify how much work remains to be done
199in each sub-phase. The normal progression of mark states for
200a stop-the-world collection is:
201<OL>
202<LI> <TT>MS_INVALID</tt> indicating that there may be accessible unmarked
203objects. In this case <TT>GC_objects_are_marked</tt> will simultaneously
204be false, so the mark state is advanced to
205<LI> <TT>MS_PUSH_UNCOLLECTABLE</tt> indicating that it suffices to push
206uncollectable objects, roots, and then mark everything reachable from them.
207<TT>Scan_ptr</tt> is advanced through the heap until all uncollectable
208objects are pushed, and objects reachable from them are marked.
209At that point, the next call to <TT>GC_mark_some</tt> calls
210<TT>GC_push_roots</tt> to push the roots. It the advances the
211mark state to
212<LI> <TT>MS_ROOTS_PUSHED</tt> asserting that once the mark stack is
213empty, all reachable objects are marked. Once in this state, we work
214only on emptying the mark stack. Once this is completed, the state
215changes to
216<LI> <TT>MS_NONE</tt> indicating that reachable objects are marked.
217</ol>
218
219The core mark routine <TT>GC_mark_from</tt>, is called
220repeatedly by several of the sub-phases when the mark stack starts to fill
221up. It is also called repeatedly in <TT>MS_ROOTS_PUSHED</tt> state
222to empty the mark stack.
223The routine is designed to only perform a limited amount of marking at
224each call, so that it can also be used by the incremental collector.
225It is fairly carefully tuned, since it usually consumes a large majority
226of the garbage collection time.
227<P>
228The fact that it perform a only a small amount of work per call also
229allows it to be used as the core routine of the parallel marker. In that
230case it is normally invoked on thread-private mark stacks instead of the
231global mark stack. More details can be found in
232<A HREF="scale.html">scale.html</a>
233<P>
234The marker correctly handles mark stack overflows. Whenever the mark stack
235overflows, the mark state is reset to <TT>MS_INVALID</tt>.
236Since there are already marked objects in the heap,
237this eventually forces a complete
238scan of the heap, searching for pointers, during which any unmarked objects
239referenced by marked objects are again pushed on the mark stack. This
240process is repeated until the mark phase completes without a stack overflow.
241Each time the stack overflows, an attempt is made to grow the mark stack.
242All pieces of the collector that push regions onto the mark stack have to be
243careful to ensure forward progress, even in case of repeated mark stack
244overflows. Every mark attempt results in additional marked objects.
245<P>
246Each mark stack entry is processed by examining all candidate pointers
247in the range described by the entry. If the region has no associated
248type information, then this typically requires that each 4-byte aligned
249quantity (8-byte aligned with 64-bit pointers) be considered a candidate
250pointer.
251<P>
252We determine whether a candidate pointer is actually the address of
253a heap block. This is done in the following steps:
254<NL>
255<LI> The candidate pointer is checked against rough heap bounds.
256These heap bounds are maintained such that all actual heap objects
257fall between them. In order to facilitate black-listing (see below)
258we also include address regions that the heap is likely to expand into.
259Most non-pointers fail this initial test.
260<LI> The candidate pointer is divided into two pieces; the most significant
261bits identify a <TT>HBLKSIZE</tt>-sized page in the address space, and
262the least significant bits specify an offset within that page.
263(A hardware page may actually consist of multiple such pages.
264HBLKSIZE is usually the page size divided by a small power of two.)
265<LI>
266The page address part of the candidate pointer is looked up in a
267<A HREF="tree.html">table</a>.
268Each table entry contains either 0, indicating that the page is not part
269of the garbage collected heap, a small integer <I>n</i>, indicating
270that the page is part of large object, starting at least <I>n</i> pages
271back, or a pointer to a descriptor for the page. In the first case,
272the candidate pointer i not a true pointer and can be safely ignored.
273In the last two cases, we can obtain a descriptor for the page containing
274the beginning of the object.
275<LI>
276The starting address of the referenced object is computed.
277The page descriptor contains the size of the object(s)
278in that page, the object kind, and the necessary mark bits for those
279objects. The size information can be used to map the candidate pointer
280to the object starting address. To accelerate this process, the page header
281also contains a pointer to a precomputed map of page offsets to displacements
282from the beginning of an object. The use of this map avoids a
283potentially slow integer remainder operation in computing the object
284start address.
285<LI>
286The mark bit for the target object is checked and set. If the object
287was previously unmarked, the object is pushed on the mark stack.
288The descriptor is read from the page descriptor. (This is computed
289from information <TT>GC_obj_kinds</tt> when the page is first allocated.)
290</nl>
291<P>
292At the end of the mark phase, mark bits for left-over free lists are cleared,
293in case a free list was accidentally marked due to a stray pointer.
294
295<H2>Sweep phase</h2>
296
297At the end of the mark phase, all blocks in the heap are examined.
298Unmarked large objects are immediately returned to the large object free list.
299Each small object page is checked to see if all mark bits are clear.
300If so, the entire page is returned to the large object free list.
301Small object pages containing some reachable object are queued for later
302sweeping, unless we determine that the page contains very little free
303space, in which case it is not examined further.
304<P>
305This initial sweep pass touches only block headers, not
306the blocks themselves. Thus it does not require significant paging, even
307if large sections of the heap are not in physical memory.
308<P>
309Nonempty small object pages are swept when an allocation attempt
310encounters an empty free list for that object size and kind.
311Pages for the correct size and kind are repeatedly swept until at
312least one empty block is found. Sweeping such a page involves
313scanning the mark bit array in the page header, and building a free
314list linked through the first words in the objects themselves.
315This does involve touching the appropriate data page, but in most cases
316it will be touched only just before it is used for allocation.
317Hence any paging is essentially unavoidable.
318<P>
319Except in the case of pointer-free objects, we maintain the invariant
320that any object in a small object free list is cleared (except possibly
321for the link field). Thus it becomes the burden of the small object
322sweep routine to clear objects. This has the advantage that we can
323easily recover from accidentally marking a free list, though that could
324also be handled by other means. The collector currently spends a fair
325amount of time clearing objects, and this approach should probably be
326revisited.
327<P>
328In most configurations, we use specialized sweep routines to handle common
329small object sizes. Since we allocate one mark bit per word, it becomes
330easier to examine the relevant mark bits if the object size divides
331the word length evenly. We also suitably unroll the inner sweep loop
332in each case. (It is conceivable that profile-based procedure cloning
333in the compiler could make this unnecessary and counterproductive. I
334know of no existing compiler to which this applies.)
335<P>
336The sweeping of small object pages could be avoided completely at the expense
337of examining mark bits directly in the allocator. This would probably
338be more expensive, since each allocation call would have to reload
339a large amount of state (e.g. next object address to be swept, position
340in mark bit table) before it could do its work. The current scheme
341keeps the allocator simple and allows useful optimizations in the sweeper.
342
343<H2>Finalization</h2>
344Both <TT>GC_register_disappearing_link</tt> and
345<TT>GC_register_finalizer</tt> add the request to a corresponding hash
346table. The hash table is allocated out of collected memory, but
347the reference to the finalizable object is hidden from the collector.
348Currently finalization requests are processed non-incrementally at the
349end of a mark cycle.
350<P>
351The collector makes an initial pass over the table of finalizable objects,
352pushing the contents of unmarked objects onto the mark stack.
353After pushing each object, the marker is invoked to mark all objects
354reachable from it. The object itself is not explicitly marked.
355This assures that objects on which a finalizer depends are neither
356collected nor finalized.
357<P>
358If in the process of marking from an object the
359object itself becomes marked, we have uncovered
360a cycle involving the object. This usually results in a warning from the
361collector. Such objects are not finalized, since it may be
362unsafe to do so. See the more detailed
363<A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/finalization.html"> discussion of finalization semantics</a>.
364<P>
365Any objects remaining unmarked at the end of this process are added to
366a queue of objects whose finalizers can be run. Depending on collector
367configuration, finalizers are dequeued and run either implicitly during
368allocation calls, or explicitly in response to a user request.
369(Note that the former is unfortunately both the default and not generally safe.
370If finalizers perform synchronization, it may result in deadlocks.
371Nontrivial finalizers generally need to perform synchronization, and
372thus require a different collector configuration.)
373<P>
374The collector provides a mechanism for replacing the procedure that is
375used to mark through objects. This is used both to provide support for
376Java-style unordered finalization, and to ignore certain kinds of cycles,
377<I>e.g.</i> those arising from C++ implementations of virtual inheritance.
378
379<H2>Generational Collection and Dirty Bits</h2>
380We basically use the concurrent and generational GC algorithm described in
381<A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/papers/pldi91.ps.Z">"Mostly Parallel Garbage Collection"</a>,
382by Boehm, Demers, and Shenker.
383<P>
384The most significant modification is that
385the collector always starts running in the allocating thread.
386There is no separate garbage collector thread. (If parallel GC is
387enabled, helper threads may also be woken up.)
388If an allocation attempt either requests a large object, or encounters
389an empty small object free list, and notices that there is a collection
390in progress, it immediately performs a small amount of marking work
391as described above.
392<P>
393This change was made both because we wanted to easily accommodate
394single-threaded environments, and because a separate GC thread requires
395very careful control over the scheduler to prevent the mutator from
396out-running the collector, and hence provoking unneeded heap growth.
397<P>
398In incremental mode, the heap is always expanded when we encounter
399insufficient space for an allocation. Garbage collection is triggered
400whenever we notice that more than
401<TT>GC_heap_size</tt>/2 * <TT>GC_free_space_divisor</tt>
402bytes of allocation have taken place.
403After <TT>GC_full_freq</tt> minor collections a major collection
404is started.
405<P>
406All collections initially run interrupted until a predetermined
407amount of time (50 msecs by default) has expired. If this allows
408the collection to complete entirely, we can avoid correcting
409for data structure modifications during the collection. If it does
410not complete, we return control to the mutator, and perform small
411amounts of additional GC work during those later allocations that
412cannot be satisfied from small object free lists. When marking completes,
413the set of modified pages is retrieved, and we mark once again from
414marked objects on those pages, this time with the mutator stopped.
415<P>
416We keep track of modified pages using one of several distinct mechanisms:
417<OL>
418<LI>
419Through explicit mutator cooperation. Currently this requires
420the use of <TT>GC_malloc_stubborn</tt>, and is rarely used.
421<LI>
422(<TT>MPROTECT_VDB</tt>) By write-protecting physical pages and
423catching write faults. This is
424implemented for many Unix-like systems and for win32. It is not possible
425in a few environments.
426<LI>
427(<TT>PROC_VDB</tt>) By retrieving dirty bit information from /proc.
428(Currently only Sun's
429Solaris supports this. Though this is considerably cleaner, performance
430may actually be better with mprotect and signals.)
431<LI>
432(<TT>PCR_VDB</tt>) By relying on an external dirty bit implementation, in this
433case the one in Xerox PCR.
434<LI>
435(<TT>DEFAULT_VDB</tt>) By treating all pages as dirty. This is the default if
436none of the other techniques is known to be usable, and
437<TT>GC_malloc_stubborn</tt> is not used. Practical only for testing, or if
438the vast majority of objects use <TT>GC_malloc_stubborn</tt>.
439</ol>
440
441<H2>Black-listing</h2>
442
443The collector implements <I>black-listing</i> of pages, as described
444in
445<A HREF="http://www.acm.org/pubs/citations/proceedings/pldi/155090/p197-boehm/">
446Boehm, ``Space Efficient Conservative Collection'', PLDI '93</a>, also available
447<A HREF="papers/pldi93.ps.Z">here</a>.
448<P>
449During the mark phase, the collector tracks ``near misses'', i.e. attempts
450to follow a ``pointer'' to just outside the garbage-collected heap, or
451to a currently unallocated page inside the heap. Pages that have been
452the targets of such near misses are likely to be the targets of
453misidentified ``pointers'' in the future. To minimize the future
454damage caused by such misidentifications they will be allocated only to
455small pointerfree objects.
456<P>
457The collector understands two different kinds of black-listing. A
458page may be black listed for interior pointer references
459(<TT>GC_add_to_black_list_stack</tt>), if it was the target of a near
460miss from a location that requires interior pointer recognition,
461<I>e.g.</i> the stack, or the heap if <TT>GC_all_interior_pointers</tt>
462is set. In this case, we also avoid allocating large blocks that include
463this page.
464<P>
465If the near miss came from a source that did not require interior
466pointer recognition, it is black-listed with
467<TT>GC_add_to_black_list_normal</tt>.
468A page black-listed in this way may appear inside a large object,
469so long as it is not the first page of a large object.
470<P>
471The <TT>GC_allochblk</tt> routine respects black-listing when assigning
472a block to a particular object kind and size. It occasionally
473drops (i.e. allocates and forgets) blocks that are completely black-listed
474in order to avoid excessively long large block free lists containing
475only unusable blocks. This would otherwise become an issue
476if there is low demand for small pointerfree objects.
477
478<H2>Thread support</h2>
479We support several different threading models. Unfortunately Pthreads,
480the only reasonably well standardized thread model, supports too narrow
481an interface for conservative garbage collection. There appears to be
482no completely portable way to allow the collector to coexist with various Pthreads
483implementations. Hence we currently support only a few of the more
484common Pthreads implementations.
485<P>
486In particular, it is very difficult for the collector to stop all other
487threads in the system and examine the register contents. This is currently
488accomplished with very different mechanisms for some Pthreads
489implementations. The Solaris implementation temporarily disables much
490of the user-level threads implementation by stopping kernel-level threads
491("lwp"s). The Linux/HPUX/OSF1 and Irix implementations sends signals to
492individual Pthreads and has them wait in the signal handler.
493<P>
494The Linux and Irix implementations use
495only documented Pthreads calls, but rely on extensions to their semantics.
496The Linux implementation <TT>linux_threads.c</tt> relies on only very
497mild extensions to the pthreads semantics, and already supports a large number
498of other Unix-like pthreads implementations. Our goal is to make this the
499only pthread support in the collector.
500<P>
501(The Irix implementation is separate only for historical reasons and should
502clearly be merged. The current Solaris implementation probably performs
503better in the uniprocessor case, but does not support thread operations in the
504collector. Hence it cannot support the parallel marker.)
505<P>
506All implementations must
507intercept thread creation and a few other thread-specific calls to allow
508enumeration of threads and location of thread stacks. This is current
509accomplished with <TT># define</tt>'s in <TT>gc.h</tt>
510(really <TT>gc_pthread_redirects.h</tt>), or optionally
511by using ld's function call wrapping mechanism under Linux.
512<P>
513Comments are appreciated. Please send mail to
514<A HREF="mailto:boehm@acm.org"><TT>boehm@acm.org</tt></a> or
515<A HREF="mailto:Hans.Boehm@hp.com"><TT>Hans.Boehm@hp.com</tt></a>
516<P>
517This is a modified copy of a page written while the author was at SGI.
518The original was <A HREF="http://reality.sgi.com/boehm/gcdescr.html">here</a>.
519</body>
520</html>
diff --git a/gc/doc/gcinterface.html b/gc/doc/gcinterface.html
deleted file mode 100644
index 7b336ec811b..00000000000
--- a/gc/doc/gcinterface.html
+++ /dev/null
@@ -1,203 +0,0 @@
1<!DOCTYPE HTML>
2<HEAD>
3<TITLE>Garbage Collector Interface</TITLE>
4</HEAD>
5<BODY>
6<H1>C Interface</h1>
7On many platforms, a single-threaded garbage collector library can be built
8to act as a plug-in malloc replacement. (Build with -DREDIRECT_MALLOC=GC_malloc
9-DIGNORE_FREE.) This is often the best way to deal with third-party libraries
10which leak or prematurely free objects. -DREDIRECT_MALLOC is intended
11primarily as an easy way to adapt old code, not for new development.
12<P>
13New code should use the interface discussed below.
14<P>
15Code must be linked against the GC library. On most UNIX platforms,
16this will be gc.a.
17<P>
18The following describes the standard C interface to the garbage collector.
19It is not a complete definition of the interface. It describes only the
20most commonly used functionality, approximately in decreasing order of
21frequency of use. The description assumes an ANSI C compiler.
22The full interface is described in
23<A HREF="http://hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gch.txt">gc.h</a>
24or <TT>gc.h</tt> in the distribution.
25<P>
26Clients should include gc.h.
27<P>
28In the case of multithreaded code,
29gc.h should be included after the threads header file, and
30after defining the appropriate GC_XXXX_THREADS macro.
31(For 6.2alpha4 and later, simply defining GC_THREADS should suffice.)
32Gc.h must be included
33in files that use either GC or threads primitives, since threads primitives
34will be redefined to cooperate with the GC on many platforms.
35<DL>
36<DT> <B>void * GC_MALLOC(size_t <I>nbytes</i>)</b>
37<DD>
38Allocates and clears <I>nbytes</i> of storage.
39Requires (amortized) time proportional to <I>nbytes</i>.
40The resulting object will be automatically deallocated when unreferenced.
41References from objects allocated with the system malloc are usually not
42considered by the collector. (See GC_MALLOC_UNCOLLECTABLE, however.)
43GC_MALLOC is a macro which invokes GC_malloc by default or, if GC_DEBUG
44is defined before gc.h is included, a debugging version that checks
45occasionally for overwrite errors, and the like.
46<DT> <B>void * GC_MALLOC_ATOMIC(size_t <I>nbytes</i>)</b>
47<DD>
48Allocates <I>nbytes</i> of storage.
49Requires (amortized) time proportional to <I>nbytes</i>.
50The resulting object will be automatically deallocated when unreferenced.
51The client promises that the resulting object will never contain any pointers.
52The memory is not cleared.
53This is the preferred way to allocate strings, floating point arrays,
54bitmaps, etc.
55More precise information about pointer locations can be communicated to the
56collector using the interface in
57<A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc_typedh.txt">gc_typed.h</a> in the distribution.
58<DT> <B>void * GC_MALLOC_UNCOLLECTABLE(size_t <I>nbytes</i>)</b>
59<DD>
60Identical to GC_MALLOC, except that the resulting object is not automatically
61deallocated. Unlike the system-provided malloc, the collector does
62scan the object for pointers to garbage-collectable memory, even if the
63block itself does not appear to be reachable. (Objects allocated in this way
64are effectively treated as roots by the collector.)
65<DT> <B> void * GC_REALLOC(void *old, size_t new_size) </b>
66<DD>
67Allocate a new object of the indicated size and copy (a prefix of) the
68old object into the new object. The old object is reused in place if
69convenient. If the original object was allocated with GC_malloc_atomic,
70the new object is subject to the same constraints. If it was allocated
71as an uncollectable object, then the new object is uncollectable, and
72the old object (if different) is deallocated.
73(Use GC_REALLOC with GC_MALLOC, etc.)
74<DT> <B> void GC_FREE(void *dead) </b>
75<DD>
76Explicitly deallocate an object. Typically not useful for small
77collectable objects. (Use GC_FREE with GC_MALLOC, etc.)
78<DT> <B> void * GC_MALLOC_IGNORE_OFF_PAGE(size_t <I>nbytes</i>) </b>
79<DD>
80<DT> <B> void * GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(size_t <I>nbytes</i>) </b>
81<DD>
82Analogous to GC_MALLOC and GC_MALLOC_ATOMIC, except that the client
83guarantees that as long
84as the resulting object is of use, a pointer is maintained to someplace
85inside the first 512 bytes of the object. This pointer should be declared
86volatile to avoid interference from compiler optimizations.
87(Other nonvolatile pointers to the object may exist as well.)
88This is the
89preferred way to allocate objects that are likely to be > 100KBytes in size.
90It greatly reduces the risk that such objects will be accidentally retained
91when they are no longer needed. Thus space usage may be significantly reduced.
92<DT> <B> void GC_gcollect(void) </b>
93<DD>
94Explicitly force a garbage collection.
95<DT> <B> void GC_enable_incremental(void) </b>
96<DD>
97Cause the garbage collector to perform a small amount of work
98every few invocations of GC_malloc or the like, instead of performing
99an entire collection at once. This is likely to increase total
100running time. It will improve response on a platform that either has
101suitable support in the garbage collector (Irix and most other Unix
102versions, win32 if the collector was suitably built) or if "stubborn"
103allocation is used (see <A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gch.txt">gc.h</a>).
104On many platforms this interacts poorly with system calls
105that write to the garbage collected heap.
106<DT> <B> GC_warn_proc GC_set_warn_proc(GC_warn_proc p) </b>
107<DD>
108Replace the default procedure used by the collector to print warnings.
109The collector
110may otherwise write to sterr, most commonly because GC_malloc was used
111in a situation in which GC_malloc_ignore_off_page would have been more
112appropriate. See <A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gch.txt">gc.h</a> for details.
113<DT> <B> void GC_register_finalizer(...) </b>
114<DD>
115Register a function to be called when an object becomes inaccessible.
116This is often useful as a backup method for releasing system resources
117(<I>e.g.</i> closing files) when the object referencing them becomes
118inaccessible.
119It is not an acceptable method to perform actions that must be performed
120in a timely fashion.
121See <A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gch.txt">gc.h</a> for details of the interface.
122See <A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/finalization.html">here</a> for a more detailed discussion
123of the design.
124<P>
125Note that an object may become inaccessible before client code is done
126operating on its fields. Suitable synchronization is usually required.
127See <A HREF="http://portal.acm.org/citation.cfm?doid=604131.604153">here</a>
128or <A HREF="http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html">here</a>
129for details.
130</dl>
131<P>
132If you are concerned with multiprocessor performance and scalability,
133you should consider enabling and using thread local allocation (<I>e.g.</i>
134GC_LOCAL_MALLOC, see <TT>gc_local_alloc.h</tt>. If your platform
135supports it, you should build the collector with parallel marking support
136(-DPARALLEL_MARK, or --enable-parallel-mark).
137<P>
138If the collector is used in an environment in which pointer location
139information for heap objects is easily available, this can be passed on
140to the colllector using the interfaces in either <TT>gc_typed.h</tt>
141or <TT>gc_gcj.h</tt>.
142<P>
143The collector distribution also includes a <B>string package</b> that takes
144advantage of the collector. For details see
145<A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/cordh.txt">cord.h</a>
146
147<H1>C++ Interface</h1>
148There are three distinct ways to use the collector from C++:
149<DL>
150<DT> <B> STL allocators </b>
151<DD>
152Users of the <A HREF="http://www.sgi.com/tech/stl">SGI extended STL</a>
153can include <TT>new_gc_alloc.h</tt> before including
154STL header files.
155(<TT>gc_alloc.h</tt> corresponds to now obsolete versions of the
156SGI STL.)
157This defines SGI-style allocators
158<UL>
159<LI> alloc
160<LI> single_client_alloc
161<LI> gc_alloc
162<LI> single_client_gc_alloc
163</ul>
164which may be used either directly to allocate memory or to instantiate
165container templates. The first two allocate uncollectable but traced
166memory, while the second two allocate collectable memory.
167The single_client versions are not safe for concurrent access by
168multiple threads, but are faster.
169<P>
170For an example, click <A HREF="http://hpl.hp.com/personal/Hans_Boehm/gc/gc_alloc_exC.txt">here</a>.
171<P>
172Recent versions of the collector also include a more standard-conforming
173allocator implemention in <TT>gc_allocator.h</tt>. It defines
174<UL>
175<LI> traceable_allocator
176<LI> gc_allocator
177</ul>
178Again the former allocates uncollectable but traced memory.
179This should work with any fully standard-conforming C++ compiler.
180<DT> <B> Class inheritance based interface </b>
181<DD>
182Users may include gc_cpp.h and then cause members of certain classes to
183be allocated in garbage collectable memory by inheriting from class gc.
184For details see <A HREF="http://hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc_cpph.txt">gc_cpp.h</a>.
185<DT> <B> C interface </b>
186<DD>
187It is also possible to use the C interface from
188<A HREF="http://hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gch.txt">gc.h</a> directly.
189On platforms which use malloc to implement ::new, it should usually be possible
190to use a version of the collector that has been compiled as a malloc
191replacement. It is also possible to replace ::new and other allocation
192functions suitably.
193<P>
194Note that user-implemented small-block allocation often works poorly with
195an underlying garbage-collected large block allocator, since the collector
196has to view all objects accessible from the user's free list as reachable.
197This is likely to cause problems if GC_malloc is used with something like
198the original HP version of STL.
199This approach works with the SGI versions of the STL only if the
200<TT>malloc_alloc</tt> allocator is used.
201</dl>
202</body>
203</html>
diff --git a/gc/doc/leak.html b/gc/doc/leak.html
deleted file mode 100644
index 91fa8ea8402..00000000000
--- a/gc/doc/leak.html
+++ /dev/null
@@ -1,197 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Using the Garbage Collector as Leak Detector</title>
4</head>
5<BODY>
6<H1>Using the Garbage Collector as Leak Detector</h1>
7The garbage collector may be used as a leak detector.
8In this case, the primary function of the collector is to report
9objects that were allocated (typically with <TT>GC_MALLOC</tt>),
10not deallocated (normally with <TT>GC_FREE</tt>), but are
11no longer accessible. Since the object is no longer accessible,
12there in normally no way to deallocate the object at a later time;
13thus it can safely be assumed that the object has been "leaked".
14<P>
15This is substantially different from counting leak detectors,
16which simply verify that all allocated objects are eventually
17deallocated. A garbage-collector based leak detector can provide
18somewhat more precise information when an object was leaked.
19More importantly, it does not report objects that are never
20deallocated because they are part of "permanent" data structures.
21Thus it does not require all objects to be deallocated at process
22exit time, a potentially useless activity that often triggers
23large amounts of paging.
24<P>
25All non-ancient versions of the garbage collector provide
26leak detection support. Version 5.3 adds the following
27features:
28<OL>
29<LI> Leak detection mode can be initiated at run-time by
30setting GC_find_leak instead of building the collector with FIND_LEAK
31defined. This variable should be set to a nonzero value
32at program startup.
33<LI> Leaked objects should be reported and then correctly garbage collected.
34Prior versions either reported leaks or functioned as a garbage collector.
35</ol>
36For the rest of this description we will give instructions that work
37with any reasonable version of the collector.
38<P>
39To use the collector as a leak detector, follow the following steps:
40<OL>
41<LI> Build the collector with -DFIND_LEAK. Otherwise use default
42build options.
43<LI> Change the program so that all allocation and deallocation goes
44through the garbage collector.
45<LI> Arrange to call <TT>GC_gcollect</tt> at appropriate points to check
46for leaks.
47(For sufficiently long running programs, this will happen implicitly,
48but probably not with sufficient frequency.)
49</ol>
50The second step can usually be accomplished with the
51<TT>-DREDIRECT_MALLOC=GC_malloc</tt> option when the collector is built,
52or by defining <TT>malloc</tt>, <TT>calloc</tt>,
53<TT>realloc</tt> and <TT>free</tt>
54to call the corresponding garbage collector functions.
55But this, by itself, will not yield very informative diagnostics,
56since the collector does not keep track of information about
57how objects were allocated. The error reports will include
58only object addresses.
59<P>
60For more precise error reports, as much of the program as possible
61should use the all uppercase variants of these functions, after
62defining <TT>GC_DEBUG</tt>, and then including <TT>gc.h</tt>.
63In this environment <TT>GC_MALLOC</tt> is a macro which causes
64at least the file name and line number at the allocation point to
65be saved as part of the object. Leak reports will then also include
66this information.
67<P>
68Many collector features (<I>e.g</i> stubborn objects, finalization,
69and disappearing links) are less useful in this context, and are not
70fully supported. Their use will usually generate additional bogus
71leak reports, since the collector itself drops some associated objects.
72<P>
73The same is generally true of thread support. However, as of 6.0alpha4,
74correct leak reports should be generated with linuxthreads.
75<P>
76On a few platforms (currently Solaris/SPARC, Irix, and, with -DSAVE_CALL_CHAIN,
77Linux/X86), <TT>GC_MALLOC</tt>
78also causes some more information about its call stack to be saved
79in the object. Such information is reproduced in the error
80reports in very non-symbolic form, but it can be very useful with the
81aid of a debugger.
82<H2>An Example</h2>
83The following header file <TT>leak_detector.h</tt> is included in the
84"include" subdirectory of the distribution:
85<PRE>
86#define GC_DEBUG
87#include "gc.h"
88#define malloc(n) GC_MALLOC(n)
89#define calloc(m,n) GC_MALLOC((m)*(n))
90#define free(p) GC_FREE(p)
91#define realloc(p,n) GC_REALLOC((p),(n))
92#define CHECK_LEAKS() GC_gcollect()
93</pre>
94<P>
95Assume the collector has been built with -DFIND_LEAK. (For very
96new versions of the collector, we could instead add the statement
97<TT>GC_find_leak = 1</tt> as the first statement in <TT>main</tt>.
98<P>
99The program to be tested for leaks can then look like:
100<PRE>
101#include "leak_detector.h"
102
103main() {
104 int *p[10];
105 int i;
106 /* GC_find_leak = 1; for new collector versions not */
107 /* compiled with -DFIND_LEAK. */
108 for (i = 0; i < 10; ++i) {
109 p[i] = malloc(sizeof(int)+i);
110 }
111 for (i = 1; i < 10; ++i) {
112 free(p[i]);
113 }
114 for (i = 0; i < 9; ++i) {
115 p[i] = malloc(sizeof(int)+i);
116 }
117 CHECK_LEAKS();
118}
119</pre>
120<P>
121On an Intel X86 Linux system this produces on the stderr stream:
122<PRE>
123Leaked composite object at 0x806dff0 (leak_test.c:8, sz=4)
124</pre>
125(On most unmentioned operating systems, the output is similar to this.
126If the collector had been built on Linux/X86 with -DSAVE_CALL_CHAIN,
127the output would be closer to the Solaris example. For this to work,
128the program should not be compiled with -fomit_frame_pointer.)
129<P>
130On Irix it reports
131<PRE>
132Leaked composite object at 0x10040fe0 (leak_test.c:8, sz=4)
133 Caller at allocation:
134 ##PC##= 0x10004910
135</pre>
136and on Solaris the error report is
137<PRE>
138Leaked composite object at 0xef621fc8 (leak_test.c:8, sz=4)
139 Call chain at allocation:
140 args: 4 (0x4), 200656 (0x30FD0)
141 ##PC##= 0x14ADC
142 args: 1 (0x1), -268436012 (0xEFFFFDD4)
143 ##PC##= 0x14A64
144</pre>
145In the latter two cases some additional information is given about
146how malloc was called when the leaked object was allocated. For
147Solaris, the first line specifies the arguments to <TT>GC_debug_malloc</tt>
148(the actual allocation routine), The second the program counter inside
149main, the third the arguments to <TT>main</tt>, and finally the program
150counter inside the caller to main (i.e. in the C startup code).
151<P>
152In the Irix case, only the address inside the caller to main is given.
153<P>
154In many cases, a debugger is needed to interpret the additional information.
155On systems supporting the "adb" debugger, the <TT>callprocs</tt> script
156can be used to replace program counter values with symbolic names.
157As of version 6.1, the collector tries to generate symbolic names for
158call stacks if it knows how to do so on the platform. This is true on
159Linux/X86, but not on most other platforms.
160<H2>Simplified leak detection under Linux</h2>
161Since version 6.1, it should be possible to run the collector in leak
162detection mode on a program a.out under Linux/X86 as follows:
163<OL>
164<LI> Ensure that a.out is a single-threaded executable. This doesn't yet work
165for multithreaded programs.
166<LI> If possible, ensure that the addr2line program is installed in
167/usr/bin. (It comes with RedHat Linux.)
168<LI> If possible, compile a.out with full debug information.
169This will improve the quality of the leak reports. With this approach, it is
170no longer necessary to call GC_ routines explicitly, though that can also
171improve the quality of the leak reports.
172<LI> Build the collector and install it in directory <I>foo</i> as follows:
173<UL>
174<LI> configure --prefix=<I>foo</i> --enable-full-debug --enable-redirect-malloc
175--disable-threads
176<LI> make
177<LI> make install
178</ul>
179<LI> Set environment variables as follows:
180<UL>
181<LI> LD_PRELOAD=<I>foo</i>/lib/libgc.so
182<LI> GC_FIND_LEAK
183<LI> You may also want to set GC_PRINT_STATS (to confirm that the collector
184is running) and/or GC_LOOP_ON_ABORT (to facilitate debugging from another
185window if something goes wrong).
186</ul
187<LI> Simply run a.out as you normally would. Note that if you run anything
188else (<I>e.g.</i> your editor) with those environment variables set,
189it will also be leak tested. This may or may not be useful and/or
190embarrassing. It can generate
191mountains of leak reports if the application wasn't designed to avoid leaks,
192<I>e.g.</i> because it's always short-lived.
193</ol>
194This has not yet been thropughly tested on large applications, but it's known
195to do the right thing on at least some small ones.
196</body>
197</html>
diff --git a/gc/doc/scale.html b/gc/doc/scale.html
deleted file mode 100644
index 2e70148dfb7..00000000000
--- a/gc/doc/scale.html
+++ /dev/null
@@ -1,210 +0,0 @@
1<HTML>
2<HEAD>
3<TITLE>Garbage collector scalability</TITLE>
4</HEAD>
5<BODY>
6<H1>Garbage collector scalability</h1>
7In its default configuration, the Boehm-Demers-Weiser garbage collector
8is not thread-safe. It can be made thread-safe for a number of environments
9by building the collector with the appropriate
10<TT>-D</tt><I>XXX</i><TT>-THREADS</tt> compilation
11flag. This has primarily two effects:
12<OL>
13<LI> It causes the garbage collector to stop all other threads when
14it needs to see a consistent memory state.
15<LI> It causes the collector to acquire a lock around essentially all
16allocation and garbage collection activity.
17</ol>
18Since a single lock is used for all allocation-related activity, only one
19thread can be allocating or collecting at one point. This inherently
20limits performance of multi-threaded applications on multiprocessors.
21<P>
22On most platforms, the allocator/collector lock is implemented as a
23spin lock with exponential back-off. Longer wait times are implemented
24by yielding and/or sleeping. If a collection is in progress, the pure
25spinning stage is skipped. This has the advantage that uncontested and
26thus most uniprocessor lock acquisitions are very cheap. It has the
27disadvantage that the application may sleep for small periods of time
28even when there is work to be done. And threads may be unnecessarily
29woken up for short periods. Nonetheless, this scheme empirically
30outperforms native queue-based mutual exclusion implementations in most
31cases, sometimes drastically so.
32<H2>Options for enhanced scalability</h2>
33Version 6.0 of the collector adds two facilities to enhance collector
34scalability on multiprocessors. As of 6.0alpha1, these are supported
35only under Linux on X86 and IA64 processors, though ports to other
36otherwise supported Pthreads platforms should be straightforward.
37They are intended to be used together.
38<UL>
39<LI>
40Building the collector with <TT>-DPARALLEL_MARK</tt> allows the collector to
41run the mark phase in parallel in multiple threads, and thus on multiple
42processors. The mark phase typically consumes the large majority of the
43collection time. Thus this largely parallelizes the garbage collector
44itself, though not the allocation process. Currently the marking is
45performed by the thread that triggered the collection, together with
46<I>N</i>-1 dedicated
47threads, where <I>N</i> is the number of processors detected by the collector.
48The dedicated threads are created once at initialization time.
49<P>
50A second effect of this flag is to switch to a more concurrent
51implementation of <TT>GC_malloc_many</tt>, so that free lists can be
52built, and memory can be cleared, by more than one thread concurrently.
53<LI>
54Building the collector with -DTHREAD_LOCAL_ALLOC adds support for thread
55local allocation. It does not, by itself, cause thread local allocation
56to be used. It simply allows the use of the interface in
57<TT>gc_local_alloc.h</tt>.
58<P>
59Memory returned from thread-local allocators is completely interchangeable
60with that returned by the standard allocators. It may be used by other
61threads. The only difference is that, if the thread allocates enough
62memory of a certain kind, it will build a thread-local free list for
63objects of that kind, and allocate from that. This greatly reduces
64locking. The thread-local free lists are refilled using
65<TT>GC_malloc_many</tt>.
66<P>
67An important side effect of this flag is to replace the default
68spin-then-sleep lock to be replace by a spin-then-queue based implementation.
69This <I>reduces performance</i> for the standard allocation functions,
70though it usually improves performance when thread-local allocation is
71used heavily, and thus the number of short-duration lock acquisitions
72is greatly reduced.
73</ul>
74<P>
75The easiest way to switch an application to thread-local allocation is to
76<OL>
77<LI> Define the macro <TT>GC_REDIRECT_TO_LOCAL</tt>,
78and then include the <TT>gc.h</tt>
79header in each client source file.
80<LI> Invoke <TT>GC_thr_init()</tt> before any allocation.
81<LI> Allocate using <TT>GC_MALLOC</tt>, <TT>GC_MALLOC_ATOMIC</tt>,
82and/or <TT>GC_GCJ_MALLOC</tt>.
83</ol>
84<H2>The Parallel Marking Algorithm</h2>
85We use an algorithm similar to
86<A HREF="http://www.yl.is.s.u-tokyo.ac.jp/gc/">that developed by
87Endo, Taura, and Yonezawa</a> at the University of Tokyo.
88However, the data structures and implementation are different,
89and represent a smaller change to the original collector source,
90probably at the expense of extreme scalability. Some of
91the refinements they suggest, <I>e.g.</i> splitting large
92objects, were also incorporated into out approach.
93<P>
94The global mark stack is transformed into a global work queue.
95Unlike the usual case, it never shrinks during a mark phase.
96The mark threads remove objects from the queue by copying them to a
97local mark stack and changing the global descriptor to zero, indicating
98that there is no more work to be done for this entry.
99This removal
100is done with no synchronization. Thus it is possible for more than
101one worker to remove the same entry, resulting in some work duplication.
102<P>
103The global work queue grows only if a marker thread decides to
104return some of its local mark stack to the global one. This
105is done if the global queue appears to be running low, or if
106the local stack is in danger of overflowing. It does require
107synchronization, but should be relatively rare.
108<P>
109The sequential marking code is reused to process local mark stacks.
110Hence the amount of additional code required for parallel marking
111is minimal.
112<P>
113It should be possible to use generational collection in the presence of the
114parallel collector, by calling <TT>GC_enable_incremental()</tt>.
115This does not result in fully incremental collection, since parallel mark
116phases cannot currently be interrupted, and doing so may be too
117expensive.
118<P>
119Gcj-style mark descriptors do not currently mix with the combination
120of local allocation and incremental collection. They should work correctly
121with one or the other, but not both.
122<P>
123The number of marker threads is set on startup to the number of
124available processors (or to the value of the <TT>GC_NPROCS</tt>
125environment variable). If only a single processor is detected,
126parallel marking is disabled.
127<P>
128Note that setting GC_NPROCS to 1 also causes some lock acquisitions inside
129the collector to immediately yield the processor instead of busy waiting
130first. In the case of a multiprocessor and a client with multiple
131simultaneously runnable threads, this may have disastrous performance
132consequences (e.g. a factor of 10 slowdown).
133<H2>Performance</h2>
134We conducted some simple experiments with a version of
135<A HREF="gc_bench.html">our GC benchmark</a> that was slightly modified to
136run multiple concurrent client threads in the same address space.
137Each client thread does the same work as the original benchmark, but they share
138a heap.
139This benchmark involves very little work outside of memory allocation.
140This was run with GC 6.0alpha3 on a dual processor Pentium III/500 machine
141under Linux 2.2.12.
142<P>
143Running with a thread-unsafe collector, the benchmark ran in 9
144seconds. With the simple thread-safe collector,
145built with <TT>-DLINUX_THREADS</tt>, the execution time
146increased to 10.3 seconds, or 23.5 elapsed seconds with two clients.
147(The times for the <TT>malloc</tt>/i<TT>free</tt> version
148with glibc <TT>malloc</tt>
149are 10.51 (standard library, pthreads not linked),
15020.90 (one thread, pthreads linked),
151and 24.55 seconds respectively. The benchmark favors a
152garbage collector, since most objects are small.)
153<P>
154The following table gives execution times for the collector built
155with parallel marking and thread-local allocation support
156(<TT>-DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC</tt>). We tested
157the client using either one or two marker threads, and running
158one or two client threads. Note that the client uses thread local
159allocation exclusively. With -DTHREAD_LOCAL_ALLOC the collector
160switches to a locking strategy that is better tuned to less frequent
161lock acquisition. The standard allocation primitives thus peform
162slightly worse than without -DTHREAD_LOCAL_ALLOC, and should be
163avoided in time-critical code.
164<P>
165(The results using <TT>pthread_mutex_lock</tt>
166directly for allocation locking would have been worse still, at
167least for older versions of linuxthreads.
168With THREAD_LOCAL_ALLOC, we first repeatedly try to acquire the
169lock with pthread_mutex_try_lock(), busy_waiting between attempts.
170After a fixed number of attempts, we use pthread_mutex_lock().)
171<P>
172These measurements do not use incremental collection, nor was prefetching
173enabled in the marker. We used the C version of the benchmark.
174All measurements are in elapsed seconds on an unloaded machine.
175<P>
176<TABLE BORDER ALIGN="CENTER">
177<TR><TH>Number of threads</th><TH>1 marker thread (secs.)</th>
178<TH>2 marker threads (secs.)</th></tr>
179<TR><TD>1 client</td><TD ALIGN="CENTER">10.45</td><TD ALIGN="CENTER">7.85</td>
180<TR><TD>2 clients</td><TD ALIGN="CENTER">19.95</td><TD ALIGN="CENTER">12.3</td>
181</table>
182<PP>
183The execution time for the single threaded case is slightly worse than with
184simple locking. However, even the single-threaded benchmark runs faster than
185even the thread-unsafe version if a second processor is available.
186The execution time for two clients with thread local allocation time is
187only 1.4 times the sequential execution time for a single thread in a
188thread-unsafe environment, even though it involves twice the client work.
189That represents close to a
190factor of 2 improvement over the 2 client case with the old collector.
191The old collector clearly
192still suffered from some contention overhead, in spite of the fact that the
193locking scheme had been fairly well tuned.
194<P>
195Full linear speedup (i.e. the same execution time for 1 client on one
196processor as 2 clients on 2 processors)
197is probably not achievable on this kind of
198hardware even with such a small number of processors,
199since the memory system is
200a major constraint for the garbage collector,
201the processors usually share a single memory bus, and thus
202the aggregate memory bandwidth does not increase in
203proportion to the number of processors.
204<P>
205These results are likely to be very sensitive to both hardware and OS
206issues. Preliminary experiments with an older Pentium Pro machine running
207an older kernel were far less encouraging.
208
209</body>
210</html>
diff --git a/gc/doc/tree.html b/gc/doc/tree.html
deleted file mode 100644
index c46a281cc67..00000000000
--- a/gc/doc/tree.html
+++ /dev/null
@@ -1,199 +0,0 @@
1<HTML>
2<HEAD>
3 <TITLE> Two-Level Tree Structure for Fast Pointer Lookup</TITLE>
4 <AUTHOR> Hans-J. Boehm, Silicon Graphics (now at HP)</author>
5</HEAD>
6<BODY>
7<H1>Two-Level Tree Structure for Fast Pointer Lookup</h1>
8<P>
9The conservative garbage collector described
10<A HREF="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">here</a>
11uses a 2-level tree
12data structure to aid in fast pointer identification.
13This data structure is described in a bit more detail here, since
14<OL>
15<LI> Variations of the data structure are more generally useful.
16<LI> It appears to be hard to understand by reading the code.
17<LI> Some other collectors appear to use inferior data structures to
18solve the same problem.
19<LI> It is central to fast collector operation.
20</ol>
21A candidate pointer is divided into three sections, the <I>high</i>,
22<I>middle</i>, and <I>low</i> bits. The exact division between these
23three groups of bits is dependent on the detailed collector configuration.
24<P>
25The high and middle bits are used to look up an entry in the table described
26here. The resulting table entry consists of either a block descriptor
27(<TT>struct hblkhdr *</tt> or <TT>hdr *</tt>)
28identifying the layout of objects in the block, or an indication that this
29address range corresponds to the middle of a large block, together with a
30hint for locating the actual block descriptor. Such a hint consist
31of a displacement that can be subtracted from the middle bits of the candidate
32pointer without leaving the object.
33<P>
34In either case, the block descriptor (<TT>struct hblkhdr</tt>)
35refers to a table of object starting addresses (the <TT>hb_map</tt> field).
36The starting address table is indexed by the low bits if the candidate pointer.
37The resulting entry contains a displacement to the beginning of the object,
38or an indication that this cannot be a valid object pointer.
39(If all interior pointer are recognized, pointers into large objects
40are handled specially, as appropriate.)
41
42<H2>The Tree</h2>
43<P>
44The rest of this discussion focuses on the two level data structure
45used to map the high and middle bits to the block descriptor.
46<P>
47The high bits are used as an index into the <TT>GC_top_index</tt> (really
48<TT>GC_arrays._top_index</tt>) array. Each entry points to a
49<TT>bottom_index</tt> data structure. This structure in turn consists
50mostly of an array <TT>index</tt> indexed by the middle bits of
51the candidate pointer. The <TT>index</tt> array contains the actual
52<TT>hdr</tt> pointers.
53<P>
54Thus a pointer lookup consists primarily of a handful of memory references,
55and can be quite fast:
56<OL>
57<LI> The appropriate <TT>bottom_index</tt> pointer is looked up in
58<TT>GC_top_index</tt>, based on the high bits of the candidate pointer.
59<LI> The appropriate <TT>hdr</tt> pointer is looked up in the
60<TT>bottom_index</tt> structure, based on the middle bits.
61<LI> The block layout map pointer is retrieved from the <TT>hdr</tt>
62structure. (This memory reference is necessary since we try to share
63block layout maps.)
64<LI> The displacement to the beginning of the object is retrieved from the
65above map.
66</ol>
67<P>
68In order to conserve space, not all <TT>GC_top_index</tt> entries in fact
69point to distinct <TT>bottom_index</tt> structures. If no address with
70the corresponding high bits is part of the heap, then the entry points
71to <TT>GC_all_nils</tt>, a single <TT>bottom_index</tt> structure consisting
72only of NULL <TT>hdr</tt> pointers.
73<P>
74<TT>Bottom_index</tt> structures contain slightly more information than
75just <TT>hdr</tt> pointers. The <TT>asc_link</tt> field is used to link
76all <TT>bottom_index</tt> structures in ascending order for fast traversal.
77This list is pointed to be <TT>GC_all_bottom_indices</tt>.
78It is maintained with the aid of <TT>key</tt> field that contains the
79high bits corresponding to the <TT>bottom_index</tt>.
80
81<H2>64 bit addresses</h2>
82<P>
83In the case of 64 bit addresses, this picture is complicated slightly
84by the fact that one of the index structures would have to be huge to
85cover the entire address space with a two level tree. We deal with this
86by turning <TT>GC_top_index</tt> into a chained hash table, instead of
87a simple array. This adds a <TT>hash_link</tt> field to the
88<TT>bottom_index</tt> structure.
89<P>
90The "hash function" consists of dropping the high bits. This is cheap to
91compute, and guarantees that there will be no collisions if the heap
92is contiguous and not excessively large.
93
94<H2>A picture</h2>
95<P>
96The following is an ASCII diagram of the data structure.
97This was contributed by Dave Barrett several years ago.
98<PRE>
99
100 Data Structure used by GC_base in gc3.7:
101 21-Apr-94
102
103
104
105
106 63 LOG_TOP_SZ[11] LOG_BOTTOM_SZ[10] LOG_HBLKSIZE[13]
107 +------------------+----------------+------------------+------------------+
108 p:| | TL_HASH(hi) | | HBLKDISPL(p) |
109 +------------------+----------------+------------------+------------------+
110 \-----------------------HBLKPTR(p)-------------------/
111 \------------hi-------------------/
112 \______ ________/ \________ _______/ \________ _______/
113 V V V
114 | | |
115 GC_top_index[] | | |
116 --- +--------------+ | | |
117 ^ | | | | |
118 | | | | | |
119 TOP +--------------+<--+ | |
120 _SZ +-<| [] | * | |
121(items)| +--------------+ if 0 < bi< HBLKSIZE | |
122 | | | | then large object | |
123 | | | | starts at the bi'th | |
124 v | | | HBLK before p. | i |
125 --- | +--------------+ | (word- |
126 v | aligned) |
127 bi= |GET_BI(p){->hash_link}->key==hi | |
128 v | |
129 | (bottom_index) \ scratch_alloc'd | |
130 | ( struct bi ) / by get_index() | |
131 --- +->+--------------+ | |
132 ^ | | | |
133 ^ | | | |
134 BOTTOM | | ha=GET_HDR_ADDR(p) | |
135_SZ(items)+--------------+<----------------------+ +-------+
136 | +--<| index[] | |
137 | | +--------------+ GC_obj_map: v
138 | | | | from / +-+-+-----+-+-+-+-+ ---
139 v | | | GC_add < 0| | | | | | | | ^
140 --- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ |
141 | | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ
142 | +--------------+ +-->| | | j | | | | | +1
143 | | key | | +-+-+-----+-+-+-+-+ |
144 | +--------------+ | +-+-+-----+-+-+-+-+ |
145 | | hash_link | | | | | | | | | | v
146 | +--------------+ | +-+-+-----+-+-+-+-+ ---
147 | | |<--MAX_OFFSET--->|
148 | | (bytes)
149HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->|
150 | \ from | =HBLKSIZE/WORDSZ
151 | (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha)
152 +-->+----------------------+ | (8/16 bits each)
153GET_HDR(p)| word hb_sz (words) | |
154 +----------------------+ |
155 | struct hblk *hb_next | |
156 +----------------------+ |
157 |mark_proc hb_mark_proc| |
158 +----------------------+ |
159 | char * hb_map |>-------------+
160 +----------------------+
161 | ushort hb_obj_kind |
162 +----------------------+
163 | hb_last_reclaimed |
164 --- +----------------------+
165 ^ | |
166 MARK_BITS| hb_marks[] | *if hdr is free, hb_sz + DISCARD_WORDS
167_SZ(words)| | is the size of a heap chunk (struct hblk)
168 v | | of at least MININCR*HBLKSIZE bytes (below),
169 --- +----------------------+ otherwise, size of each object in chunk.
170
171Dynamic data structures above are interleaved throughout the heap in blocks of
172size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be
173freed; free lists are used (e.g. alloc_hdr). HBLK's below are collected.
174
175 (struct hblk)
176 --- +----------------------+ < HBLKSIZE --- --- DISCARD_
177 ^ |garbage[DISCARD_WORDS]| aligned ^ ^ HDR_BYTES WORDS
178 | | | | v (bytes) (words)
179 | +-----hb_body----------+ < WORDSZ | --- ---
180 | | | aligned | ^ ^
181 | | Object 0 | | hb_sz |
182 | | | i |(word- (words)|
183 | | | (bytes)|aligned) v |
184 | + - - - - - - - - - - -+ --- | --- |
185 | | | ^ | ^ |
186 n * | | j (words) | hb_sz BODY_SZ
187 HBLKSIZE | Object 1 | v v | (words)
188 (bytes) | |--------------- v MAX_OFFSET
189 | + - - - - - - - - - - -+ --- (bytes)
190 | | | !All_INTERIOR_PTRS ^ |
191 | | | sets j only for hb_sz |
192 | | Object N | valid object offsets. | |
193 v | | All objects WORDSZ v v
194 --- +----------------------+ aligned. --- ---
195
196DISCARD_WORDS is normally zero. Indeed the collector has not been tested
197with another value in ages.
198</pre>
199</body>