README.DGUX386
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-gc-debug" flag during configuration.
27 2) Pass "CFLAGS=-DDEBUG_THREADS" to "make".
28
29 In a machine with 4 CPUs (my own machine) the option parallel
30 mark (aka --enable-parallel-mark) makes a BIG difference.
31
32 Takis Psarogiannakopoulos
33
34Note (HB):
35 The integration of this patch is currently not complete.
36 The following patches against 6.1alpha3 where hard to move
37 to alpha4, and are not integrated. There may also be minor
38 problems with stylistic corrections made by me.
39[The diff for ltconfig and ltmain.sh was removed from this file on 2011-08-22]
40
README.Mac
1The contents of this file are old and pertain to pre-MacOSX versions.
2You probably really wanted README.darwin.
3
4---------------------------------------------
5
6Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2:
7----------------------------------------------------------------------------
8The current build environment for the collector is CodeWarrior Pro 2.
9Projects for CodeWarrior Pro 2 (and for quite a few older versions)
10are distributed in the file Mac_projects.sit.hqx. The project file
11:Mac_projects:gc.prj builds static library versions of the collector.
12:Mac_projects:gctest.prj builds the GC test suite.
13
14Configuring the collector is still done by editing the file
15:extra:Mac_files:MacOS_config.h.
16
17Lars Farm's suggestions on building the collector:
18----------------------------------------------------------------------------
19Garbage Collection on MacOS - a manual 'MakeFile'
20-------------------------------------------------
21
22Project files and IDE's are great on the Macintosh, but they do have
23problems when used as distribution media. This note tries to provide
24porting instructions in pure TEXT form to avoid those problems. A manual
25'makefile' if you like.
26
27 GC version: 4.12a2
28 Codewarrior: CWPro1
29 date: 18 July 1997
30
31The notes may or may not apply to earlier or later versions of the
32GC/CWPro. Actually, they do apply to earlier versions of both except that
33until recently a project could only build one target so each target was a
34separate project. The notes will most likely apply to future versions too.
35Possibly with minor tweaks.
36
37This is just to record my experiences. These notes do not mean I now
38provide a supported port of the GC to MacOS. It works for me. If it works
39for you, great. If it doesn't, sorry, try again...;-) Still, if you find
40errors, please let me know.
41
42
43Porting to MacOS is a bit more complex than it first seems. Which MacOS?
4468K/PowerPC? Which compiler? Each supports both 68K and PowerPC and offer a
45large number of (unique to each environment) compiler settings. Each
46combination of compiler/68K/PPC/settings require a unique combination of
47standard libraries. And the IDE's does not select them for you. They don't
48even check that the library is built with compatible setting and this is
49the major source of problems when porting the GC (and otherwise too).
50
51You will have to make choices when you configure the GC. I've made some
52choices here, but there are other combinations of settings and #defines
53that work too.
54
55As for target settings the major obstacles may be:
56- 68K Processor: check "4-byte Ints".
57- PPC Processor: uncheck "Store Static Data in TOC".
58
59What you need to do:
601) Build the GC as a library
612) Test that the library works with 'test.c'.
623) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
63
64== 1. The Libraries ==
65
66I made one project with four targets (68K/PPC tempmem or appheap). One target
67will suffice if you're able to decide which one you want. I wasn't...
68
69Codewarrior allows a large number of compiler/linker settings. I used these:
70
71Settings shared by all targets:
72------------------------------
73o Access Paths:
74 - User Paths: the GC folder
75 - System Paths: {Compiler}:Metrowerks Standard Library:
76 {Compiler}:MacOS Support:Headers:
77 {Compiler}:MacOS Support:MacHeaders:
78o C/C++ language:
79 - inlining: normal
80 - direct to SOM: off
81 - enable/check: exceptions, RTTI, bool (and if you like pool strings)
82
83PowerPC target settings
84-----------------------
85o Target Settings:
86 - name of target
87 - MacOS PPC Linker
88o PPC Target
89 - name of library
90o C/C++ language
91 - prefix file as described below
92o PPC Processor
93 - Struct Alignment: PowerPC
94 - uncheck "Store Static Data in TOC" -- important!
95 I don't think the others matter, I use full optimization and it is OK
96o PPC Linker
97 - Factory Settings (SYM file with full paths, faster linking, dead-strip
98 static init, Main: __start)
99
100
10168K target settings
102-------------------
103o Target Settings:
104 - name of target
105 - MacOS 68K Linker
106o 68K Target
107 - name of library
108 - A5 relative data
109o C/C++ language
110 - prefix file as described below
111o 68K Processor
112 - Code model: smart
113 - Struct alignment: 68K
114 - FP: SANE
115 - enable 4-Byte Ints -- important!
116 I don't think the others matter. I selected...
117 - enable: 68020
118 - enable: global register allocation
119o IR Optimizer
120 - enable: Optimize Space, Optimize Speed
121 I suppose the others would work too, but haven't tried...
122o 68K Linker
123 - Factory Settings (New Style MacsBug, SYM file with full paths,
124 A6 Frames, fast link, Merge compiler glue into segment 1,
125 dead-strip static init)
126
127Prefix Files to configure the GC sources
128----------------------------------------
129The Codewarrior equivalent of commandline compilers -DNAME=X is to use
130prefix-files. A TEXT file that is automatically #included before the first byte
131of every source file. I used these:
132
133---- ( cut here ) ---- gc_prefix_tempmem.h -- 68K and PPC -----
134 #include "gc_prefix_common.h"
135 #undef USE_TEMPORARY_MEMORY
136 #define USE_TEMPORARY_MEMORY
137---- ( cut here ) ---- gc_prefix_appmem.h -- 68K and PPC -----
138 #include "gc_prefix_common.h"
139 #undef USE_TEMPORARY_MEMORY
140// #define USE_TEMPORARY_MEMORY
141
142---- ( cut here ) ---- gc_prefix_common.h --------------------
143// gc_prefix_common.h
144// ------------------
145// Codewarrior prefix file to configure the GC libraries
146//
147// prefix files are the Codewarrior equivalent of the
148// command line option -Dname=x frequently seen in makefiles
149
150#if !__MWERKS__
151 #error only tried this with Codewarrior
152#endif
153
154#if macintosh
155 #define MSL_USE_PRECOMPILED_HEADERS 0
156 #include <ansi_prefix.mac.h>
157
158 // See list of #defines to configure the library in: 'MakeFile'
159 // see also README
160
161 #define ALL_INTERIOR_POINTERS // follows interior pointers.
162//#define DONT_ADD_BYTE_AT_END // disables the padding if defined.
163//#define SMALL_CONFIG // whether to use a smaller heap.
164 #define ATOMIC_UNCOLLECTABLE // GC_malloc_atomic_uncollectable()
165
166 // define either or none as per personal preference
167 // used in malloc.c
168 #define REDIRECT_MALLOC GC_malloc
169//#define REDIRECT_MALLOC GC_malloc_uncollectable
170 // if REDIRECT_MALLOC is #defined make sure that the GC library
171 // is listed before the ANSI/ISO libs in the Codewarrior
172 // 'Link order' panel
173//#define IGNORE_FREE
174
175 // mac specific configs
176//#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
177//#define SHARED_LIBRARY_BUILD // build for use in a shared library.
178
179#else
180 // could build Win32 here too, or in the future
181 // Rhapsody PPC-mach, Rhapsody PPC-MacOS,
182 // Rhapsody Intel-mach, Rhapsody Intel-Win32,...
183 // ... ugh this will get messy ...
184#endif
185
186// make sure ints are at least 32-bit
187// ( could be set to 16-bit by compiler settings (68K) )
188
189struct gc_private_assert_intsize_{ char x[ sizeof(int)>=4 ? 1 : 0 ]; };
190
191#if __powerc
192 #if __option(toc_data)
193 #error turn off "store static data in TOC" when using GC
194 // ... or find a way to add TOC to the root set...(?)
195 #endif
196#endif
197---- ( cut here ) ---- end of gc_prefix_common.h -----------------
198
199Files to build the GC libraries:
200--------------------------------
201 allchblk.c
202 alloc.c
203 blacklst.c
204 checksums.c
205 dbg_mlc.c
206 finalize.c
207 headers.c
208 mach_dep.c
209 MacOS.c -- contains MacOS code
210 malloc.c
211 mallocx.c
212 mark.c
213 mark_rts.c
214 misc.c
215 new_hblk.c
216 obj_map.c
217 os_dep.c -- contains MacOS code
218 ptr_chck.c
219 reclaim.c
220 stubborn.c
221 typd_mlc.c
222 gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and
223 -- throw std::bad_alloc when out of memory
224 -- gc_cpp.cc works just fine too
225
226== 2. Test that the library works with 'test.c' ==
227
228The test app is just an ordinary ANSI-C console app. Make sure settings
229match the library you're testing.
230
231Files
232-----
233 test.c
234 the GC library to test -- link order before ANSI libs
235 suitable Mac+ANSI libraries
236
237prefix:
238------
239---- ( cut here ) ---- gc_prefix_testlib.h -- all libs -----
240#define MSL_USE_PRECOMPILED_HEADERS 0
241#include <ansi_prefix.mac.h>
242#undef NDEBUG
243
244#define ALL_INTERIOR_POINTERS /* for GC_priv.h */
245---- ( cut here ) ----
246
247== 3. Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc' ==
248
249The test app is just an ordinary ANSI-C console app. Make sure settings match
250the library you're testing.
251
252Files
253-----
254 test_cpp.cc
255 the GC library to test -- link order before ANSI libs
256 suitable Mac+ANSI libraries
257
258prefix:
259------
260same as for test.c
261
262For convenience I used one test-project with several targets so that all
263test apps are build at once. Two for each library to test: test.c and
264gc_app.cc. When I was satisfied that the libraries were OK. I put the
265libraries + gc.h + the c++ interface-file in a folder that I then put into
266the MSL hierarchy so that I don't have to alter access-paths in projects
267that use the GC.
268
269After that, just add the proper GC library to your project and the GC is in
270action! malloc will call GC_malloc and free GC_free, new/delete too. You
271don't have to call free or delete. You may have to be a bit cautious about
272delete if you're freeing other resources than RAM. See gc_cpp.h. You can
273also keep coding as always with delete/free. That works too. If you want,
274"include <gc.h> and tweak it's use a bit.
275
276== Symantec SPM ==
277
278It has been a while since I tried the GC in SPM, but I think that the above
279instructions should be sufficient to guide you through in SPM too. SPM
280needs to know where the global data is. Use the files 'datastart.c' and
281'dataend.c'. Put 'datastart.c' at the top of your project and 'dataend.c'
282at the bottom of your project so that all data is surrounded. This is not
283needed in Codewarrior because it provides intrinsic variables
284__datastart__, __data_end__ that wraps all globals.
285
286== Source Changes (GC 4.12a2) ==
287
288Very few. Just one tiny in the GC, not strictly needed.
289- test_cpp.cc
290 made the first lines of main() look like this:
291 ------------
292 int main( int argc, char* argv[] ) {
293 #endif
294 #if macintosh // MacOS
295 char* argv_[] = {"test_cpp","10"}; // doesn't
296 argv=argv_; // have a
297 argc = sizeof(argv_)/sizeof(argv_[0]); // commandline
298 #endif //
299
300 int i, iters, n;
301 # ifndef __GNUC__
302 alloc dummy_to_fool_the_compiler_into_doing_things_it_currently_cant_handle;
303 ------------
304
305- config.h [now gcconfig.h]
306 __MWERKS__ does not have to mean MACOS. You can use Codewarrior to
307 build a Win32 or BeOS library and soon a Rhapsody library. You may
308 have to change that #if...
309
310
311
312 It worked for me, hope it works for you.
313
314 Lars Farm
315----------------------------------------------------------------------------
316
317
318Patrick Beard's instructions (may be dated):
319
320v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and
321Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided
322to build and test the collector under both development systems.
323
324Configuration
325-------------
326
327To configure the collector, under both development systems, a prefix file
328is used to set preprocessor directives. This file is called "MacOS_config.h".
329
330Testing
331-------
332
333To test the collector (always a good idea), build one of the gctest projects,
334gctest. (Symantec C++/THINK C), mw/gctest.68K, or mw/gctest.PPC. The
335test will ask you how many times to run; 1 should be sufficient.
336
337Building
338--------
339
340For your convenience project files for the major Macintosh development
341systems are provided.
342
343For Symantec C++/THINK C, you must build the two projects gclib-1 and
344gclib-2. It has to be split up because the collector has more than 32k
345of static data and no library can have more than this in the Symantec
346environment. (Future versions will probably fix this.)
347
348For Metrowerks C/C++ 4.5 you build gc.68K/PPC and the result will
349be a library called gc.68K.lib/gc.PPC.lib.
350
351Using
352-----
353
354Under Symantec C++/THINK C, you can just add the gclib-1 and gclib-2
355projects to your own project. Under Metrowerks, you add gc.68K.lib or
356gc.PPC.lib and two additional files. You add the files called datastart.c
357and dataend.c to your project, bracketing all files that use the collector.
358See mw/gctest for an example.
359
360Include the projects/libraries you built above into your own project,
361#include "gc.h", and call GC_malloc. You don't have to call GC_free.
362
363Patrick C. Beard
364
README.OS2
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.
7
README.amiga
1 Kjetil S. Matheussen's notes (28-11-2000)
2
3Compiles under SAS/C again. Should also still compile under other
4Amiga compilers without big changes. I haven't checked if it still
5works under gcc, because I don't have gcc for Amiga. But I have
6updated 'Makefile', and hope it compiles fine.
7
8
9WHATS NEW:
10
111.
12 Made a pretty big effort in preventing GCs allocating-functions from returning
13 chip-mem.
14
15 The lower part of the new file AmigaOS.c does this in various ways, mainly by
16 wrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable,
17 GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_page
18 and GC_malloc_atomic_ignore_off_page. GC_realloc is also wrapped, but
19 doesn't do the same effort in preventing to return chip-mem.
20 Other allocating-functions (f.ex. GC_*_typed_) can probably be
21 used without any problems, but beware that the warn hook will not be called.
22 In case of problems, don't define GC_AMIGA_FASTALLOC.
23
24 Programs using more time actually using the memory allocated
25 (instead of just allocate and free rapidly) have
26 the most to earn on this, but even gctest now normally runs twice
27 as fast and uses less memory, on my poor 8MB machine.
28
29 The changes have only effect when there is no more
30 fast-mem left. But with the way GC works, it
31 could happen quite often. Beware that an atexit handler had to be added,
32 so using the abort() function will make a big memory-loss.
33 If you absolutely must call abort() instead of exit(), try calling
34 the GC_amiga_free_all_mem function before abort().
35
36 New Amiga-specific compilation flags:
37
38 GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before,
39 it will not try to force fast-mem out of the OS, and
40 it will use normal calloc for allocation, and the rest
41 of the following flags will have no effect.
42
43 GC_AMIGA_ONLYFAST - Makes GC never to return chip-mem. GC_AMIGA_RETRY have
44 no effect if this flag is set.
45
46 GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. This
47 usually is a success with the standard GC configuration.
48 It is also the most important flag to set to prevent
49 GC from returning chip-mem. Beware that it slows down a lot
50 when a program is rapidly allocating/deallocating when
51 theres either very little fast-memory left or verly little
52 chip-memory left. Its not a very common situation, but gctest
53 sometimes (very rare) use many minutes because of this.
54
55 GC_AMIGA_RETRY - If gc succeed allocating memory, but it is chip-mem,
56 try again and see if it is fast-mem. Most of the time,
57 it will actually return fast-mem for the second try.
58 I have set max number of retries to 9 or size/5000. You
59 can change this if you like. (see GC_amiga_rec_alloc())
60
61 GC_AMIGA_PRINTSTATS - Gather some statistics during the execution of a
62 program, and prints out the info when the atexit-handler
63 is called.
64
65 My reccomendation is to set all this flags, except GC_AMIGA_PRINTSTATS and
66 GC_AMIGA_ONLYFAST.
67
68 If your program demands high response-time, you should
69 not define GC_AMIGA_GC, and possible also define GC_AMIGA_ONLYFAST.
70 GC_AMIGA_RETRY does not seem to slow down much.
71
72 Also, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when
73 compilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation-
74 functions wrapped. (see gc.h)
75
76 Note that GC_realloc must not be called before any of
77 the other above mentioned allocating-functions have been called. (shouldn't be
78 any programs doing so either, I hope).
79
80 Another note. The allocation-function is wrapped when defining
81 GC_AMIGA_FASTALLOC by letting the function go thru the new
82 GC_amiga_allocwrapper_do function-pointer (see gc.h). Means that
83 sending function-pointers, such as GC_malloc, GC_malloc_atomic, etc.,
84 for later to be called like f.ex this, (*GC_malloc_function_pointer)(size),
85 will not wrap the function. This is normally not a big problem, unless
86 all allocation function is called like this, which will cause the
87 atexit un-allocating function never to be called. Then you either
88 have to manually add the atexit handler, or call the allocation-
89 functions function-pointer functions like this;
90 (*GC_amiga_allocwrapper_do)(size,GC_malloc_function_pointer).
91 There are probably better ways this problem could be handled, unfortunately,
92 I didn't find any without rewriting or replacing a lot of the GC-code, which
93 I really didn't want to. (Making new GC_malloc_* functions, and just
94 define f.ex GC_malloc as GC_amiga_malloc should work too).
95
96
97 New Amiga-specific function:
98
99 void GC_amiga_set_toany(void (*func)(void));
100
101 'func' is a function that will be called right before gc has to change
102 allocation-method from MEMF_FAST to MEMF_ANY. Ie. when it is likely
103 it will return chip-mem.
104
105
1062. A few small compiler-specific additions to make it compile with SAS/C again.
107
1083. Updated and rewritten the smakefile, so that it works again and that
109 the "unnecessary" 'SCOPTIONS' files could be removed. Also included
110 the cord-smakefile stuff in the main smakefile, so that the cord smakefile
111 could be removed too. By writing smake -f Smakefile.smk, both gc.lib and
112 cord.lib will be made.
113
114
115
116STILL MISSING:
117
118Programs can not be started from workbench, at least not for SAS/C. (Martin
119Tauchmanns note about that it now works with workbench is definitely wrong
120when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code,
121but I haven't tested it. I think the reason for MT to replace the
122"#if 0'ed"-code was only because it was a bit to SAS/C-specific. But I
123don't know. An iconx-script solves this problem anyway.
124
125
126BEWARE!
127
128-To run gctest, set the stack to around 200000 bytes first.
129-SAS/C-specific: cord will crash if you compile gc.lib with
130 either parm=reg or parm=both. (missing legal prototypes for
131 function-pointers someplace is the reason I guess.).
132
133
134tested with software: Radium, http://www.stud.ifi.uio.no/~ksvalast/radium/
135tested with hardware: MC68060
136
137
138 Martin Tauchmann's notes (1-Apr-99)
139
140Works now, also with the GNU-C compiler V2.7.2.1. <ftp://ftp.unina.it/pub/amiga/geekgadgets/amiga/m68k/snapshots/971125/amiga-bin/>
141Modify the `Makefile`
142CC=cc $(ABI_FLAG)
143to
144CC=gcc $(ABI_FLAG)
145
146TECHNICAL NOTES
147
148- `GC_get_stack_base()`, `GC_register_data_segments()` works now with every
149 C compiler; also Workbench.
150
151- Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC.
152
153
154PROBLEMS
155- When the Linker, does`t merge all Code-Segments to an single one. LD of GCC
156 do it always.
157
158- With ixemul.library V47.3, when an GC program launched from another program
159 (example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()`
160 found the Segment-List of the caller program.
161 Can be fixed, if the run-time initialization code (for C programs, usually *crt0*)
162 support `__data` and `__bss`.
163
164- PowerPC Amiga currently not supported.
165
166- Dynamic libraries (dyn_load.c) not supported.
167
168
169TESTED WITH SOFTWARE
170
171`Optimized Oberon 2 C` (oo2c) <http://cognac.informatik.uni-kl.de/download/index.html>
172
173
174TESTED WITH HARDWARE
175
176MC68030
177
178
179 Michel Schinz's notes
180
181WHO DID WHAT
182
183The original Amiga port was made by Jesper Peterson. I (Michel Schinz)
184modified it slightly to reflect the changes made in the new official
185distributions, and to take advantage of the new SAS/C 6.x features. I also
186created a makefile to compile the "cord" package (see the cord
187subdirectory).
188
189TECHNICAL NOTES
190
191In addition to Jesper's notes, I have the following to say:
192
193- Starting with version 4.3, gctest checks to see if the code segment is
194 added to the root set or not, and complains if it is. Previous versions
195 of this Amiga port added the code segment to the root set, so I tried to
196 fix that. The only problem is that, as far as I know, it is impossible to
197 know which segments are code segments and which are data segments (there
198 are indeed solutions to this problem, like scanning the program on disk
199 or patch the LoadSeg functions, but they are rather complicated). The
200 solution I have chosen (see os_dep.c) is to test whether the program
201 counter is in the segment we are about to add to the root set, and if it
202 is, to skip the segment. The problems are that this solution is rather
203 awkward and that it works only for one code segment. This means that if
204 your program has more than one code segment, all of them but one will be
205 added to the root set. This isn't a big problem in fact, since the
206 collector will continue to work correctly, but it may be slower.
207
208 Anyway, the code which decides whether to skip a segment or not can be
209 removed simply by not defining AMIGA_SKIP_SEG. But notice that if you do
210 so, gctest will complain (it will say that "GC_is_visible produced wrong
211 failure indication"). However, it may be useful if you happen to have
212 pointers stored in a code segment (you really shouldn't).
213
214 If anyone has a good solution to the problem of finding, when a program
215 is loaded in memory, whether a segment is a code or a data segment,
216 please let me know.
217
218
219 Jesper Peterson's notes
220
221ADDITIONAL NOTES FOR AMIGA PORT
222
223These notes assume some familiarity with Amiga internals.
224
225WHY I PORTED TO THE AMIGA
226
227The sole reason why I made this port was as a first step in getting
228the Sather(*) language on the Amiga. A port of this language will
229be done as soon as the Sather 1.0 sources are made available to me.
230Given this motivation, the garbage collection (GC) port is rather
231minimal.
232
233(*) For information on Sather read the comp.lang.sather newsgroup.
234
235LIMITATIONS
236
237This port assumes that the startup code linked with target programs
238is that supplied with SAS/C versions 6.0 or later. This allows
239assumptions to be made about where to find the stack base pointer
240and data segments when programs are run from WorkBench, as opposed
241to running from the CLI. The compiler dependent code is all in the
242GC_get_stack_base() and GC_register_data_segments() functions, but
243may spread as I add Amiga specific features.
244
245Given that SAS/C was assumed, the port is set up to be built with
246"smake" using the "SMakefile". Compiler options in "SCoptions" can
247be set with "scopts" program. Both "smake" and "scopts" are part of
248the SAS/C commercial development system.
249
250In keeping with the porting philosophy outlined above, this port
251will not behave well with Amiga specific code. Especially not inter-
252process comms via messages, and setting up public structures like
253Intuition objects or anything else in the system lists. For the
254time being the use of this library is limited to single threaded
255ANSI/POSIX compliant or near-complient code. (ie. Stick to stdio
256for now). Given this limitation there is currently no mechanism for
257allocating "CHIP" or "PUBLIC" memory under the garbage collector.
258I'll add this after giving it considerable thought. The major
259problem is the entire physical address space may have to me scanned,
260since there is no telling who we may have passed memory to.
261
262If you allocate your own stack in client code, you will have to
263assign the pointer plus stack size to GC_stackbottom.
264
265The initial stack size of the target program can be compiled in by
266setting the __stack symbol (see SAS documentaion). It can be over-
267ridden from the CLI by running the AmigaDOS "stack" program, or from
268the WorkBench by setting the stack size in the tool types window.
269
270SAS/C COMPILER OPTIONS (SCoptions)
271
272You may wish to check the "CPU" code option is appropriate for your
273intended target system.
274
275Under no circumstances set the "StackExtend" code option in either
276compiling the library or *ANY* client code.
277
278All benign compiler warnings have been suppressed. These mainly
279involve lack of prototypes in the code, and dead assignments
280detected by the optimizer.
281
282THE GOOD NEWS
283
284The library as it stands is compatible with the GigaMem commercial
285virtual memory software, and probably similar PD software.
286
287The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz)
288compares favourably with an HP9000 with similar architecture (a 325
289with a 68030 I think).
290
291-----------------------------------------------------------------------
292
README.arm.cross
README.autoconf
1Starting from GC v6.0, we 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 without "Makefile" which is generated by
39"configure". The distribution also contains "Makefile.direct" which is not
40always equivalent to the generated one.
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-gc-debug (--enable-full-debug before about 7.0)
51 include full support for pointer back-tracing etc.
52
53
54Unless --prefix is set (or --exec-prefix or one of the more obscure options),
55make install will install libgc.a and libgc.so in /usr/local/bin, which
56would typically require the "make install" to be run as root.
57
58Most commonly --enable-threads=posix or will be needed. --enable-parallel-mark
59is recommended for multiprocessors if it is supported on the platform.
60
README.cmake
1
2CMAKE
3-----
4
5Win32 binaries (both 32- and 64-bit) can be built using CMake. CMake is an
6open-source tool like automake - it generates makefiles.
7
8Some preliminary work has been done to make this work on other platforms, but
9the support is not yet complete.
10
11CMake will generate:
12
13 Borland Makefiles
14 MSYS Makefiles
15 MinGW Makefiles
16 NMake Makefiles
17 Unix Makefiles
18 . Visual Studio project files
19 Visual Studio 6
20 Visual Studio 7
21 Visual Studio 7 .NET 2003
22 Visual Studio 8 2005
23 Visual Studio 8 2005 Win64
24 Visual Studio 9 2008
25 Visual Studio 9 2008 Win64
26 Watcom WMake
27
28
29BUILD PROCESS
30-------------
31
32 . install cmake (cmake.org)
33 . add directory containing cmake.exe to %PATH%
34 . run cmake from the gc root directory, passing the target with -G:
35 e.g.,
36 > cmake -G "Visual Studio 8 2005"
37 use the gc.sln file generated by cmake to build gc
38 . you can also run cmake from a build directory to build outside of
39 the source tree. Just specify the path to the source tree:
40 e.g.,
41 > mkdir build
42 > cd build
43 > cmake .. -G "Visual Studio 8 2005"
44
45
46INPUT
47-----
48
49The main input to cmake are the CMakeLists.txt files in each directory. For
50help, goto cmake.org.
51
README.cords
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.
13
14This is a string packages that uses a tree-based representation.
15See cord.h for a description of the functions provided. Ec.h describes
16"extensible cords", which are essentially output streams that write
17to a cord. These allow for efficient construction of cords without
18requiring a bound on the size of a cord.
19
20More details on the data structure can be found in
21
22Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings",
23Software Practice and Experience 25, 12, December 1995, pp. 1315-1330.
24
25A fundamentally similar "rope" data structure is also part of SGI's standard
26template library implementation, and its descendants, which include the
27GNU C++ library. That uses reference counting by default.
28There is a short description of that data structure at
29http://www.sgi.com/tech/stl/ropeimpl.html .
30
31All of these are descendants of the "ropes" in Xerox Cedar.
32
33cord/tests/de.c is a very dumb text editor that illustrates the use of cords.
34It maintains a list of file versions. Each version is simply a
35cord representing the file contents. Nonetheless, standard
36editing operations are efficient, even on very large files.
37(Its 3 line "user manual" can be obtained by invoking it without
38arguments. Note that ^R^N and ^R^P move the cursor by
39almost a screen. It does not understand tabs, which will show
40up as highlighted "I"s. Use the UNIX "expand" program first.)
41To build the editor, type "make cord/de" in the gc directory.
42
43This package assumes an ANSI C compiler such as gcc. It will
44not compile with an old-style K&R compiler.
45
46Note that CORD_printf iand friends use C functions with variable numbers
47of arguments in non-standard-conforming ways. This code is known to
48break on some platforms, notably PowerPC. It should be possible to
49build the remainder of the library (everything but cordprnt.c) on
50any platform that supports the collector.
51
README.darwin
1Darwin/MacOSX Support - December 16, 2003
2
3== Build Notes ==
4
5Building can be done with autoconf as normal. If you want to build
6a Universal library using autoconf, you need to disable dependency
7tracking and specify your desired architectures in CFLAGS:
8
9CFLAGS="-arch ppc -arch i386 -arch x86_64" ./configure --disable-dependency-tracking
10
11
12== Important Usage Notes ==
13
14GC_init() MUST be called before calling any other GC functions. This
15is necessary to properly register segments in dynamic libraries. This
16call is required even if you code does not use dynamic libraries as the
17dyld code handles registering all data segments.
18
19When your use of the garbage collector is confined to dylibs and you
20cannot call GC_init() before your libraries' static initializers have
21run and perhaps called GC_malloc(), create an initialization routine
22for each library to call GC_init():
23
24#include <gc/gc.h>
25extern "C" void my_library_init() { GC_init(); }
26
27Compile this code into a my_library_init.o, and link it into your
28dylib. When you link the dylib, pass the -init argument with
29_my_library_init (e.g. gcc -dynamiclib -o my_library.dylib a.o b.o c.o
30my_library_init.o -init _my_library_init). This causes
31my_library_init() to be called before any static initializers, and
32will initialize the garbage collector properly.
33
34Note: It doesn't hurt to call GC_init() more than once, so it's best,
35if you have an application or set of libraries that all use the
36garbage collector, to create an initialization routine for each of
37them that calls GC_init(). Better safe than sorry.
38
39The incremental collector is still a bit flaky on darwin. It seems to
40work reliably with workarounds for a few possible bugs in place however
41these workaround may not work correctly in all cases. There may also
42be additional problems that I have not found.
43
44Thread-local GC allocation will not work with threads that are not
45created using the GC-provided override of pthread_create(). Threads
46created without the GC-provided pthread_create() do not have the
47necessary data structures in the GC to store this data.
48
49
50== Implementation Information ==
51
52Darwin/MacOSX support is nearly complete. Thread support is reliable on
53Darwin 6.x (MacOSX 10.2) and there have been reports of success on older
54Darwin versions (MacOSX 10.1). Shared library support had also been
55added and the gc can be run from a shared library.
56
57Thread support is implemented in terms of mach thread_suspend and
58thread_resume calls. These provide a very clean interface to thread
59suspension. This implementation doesn't rely on pthread_kill so the
60code works on Darwin < 6.0 (MacOSX 10.1). All the code to stop and
61start the world is located in darwin_stop_world.c.
62
63Since not all uses of the GC enable clients to override pthread_create()
64before threads have been created, the code for stopping the world has
65been rewritten to look for threads using Mach kernel calls. Each
66thread identified in this way is suspended and resumed as above. In
67addition, since Mach kernel threads do not contain pointers to their
68stacks, a stack-walking function has been written to find the stack
69limits. Given an initial stack pointer (for the current thread, a
70pointer to a stack-allocated local variable will do; for a non-active
71thread, we grab the value of register 1 (on PowerPC)), it
72will walk the PPC Mach-O-ABI compliant stack chain until it reaches the
73top of the stack. This appears to work correctly for GCC-compiled C,
74C++, Objective-C, and Objective-C++ code, as well as for Java
75programs that use JNI. If you run code that does not follow the stack
76layout or stack pointer conventions laid out in the PPC Mach-O ABI,
77then this will likely crash the garbage collector.
78
79The original incremental collector support unfortunately no longer works
80on recent Darwin versions. It also relied on some undocumented kernel
81structures. Mach, however, does have a very clean interface to exception
82handing. The current implementation uses Mach's exception handling.
83
84Much thanks goes to Andrew Stone, Dietmar Planitzer, Andrew Begel,
85Jeff Sturm, and Jesse Rosenstock for all their work on the
86Darwin/OS X port.
87
88-Brian Alliet
89
90== gc_cpp.h usage ==
91
92Replacement of operator new and delete is apparently not supported with
93dynamic libraries. This means that applications using gc_cpp.h
94(including the built-in test) will probably not work correctly with
95the collector in a dynamic library, unless special care is taken.
96
97See
98http://article.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/1421
99for some details.
100
101- Hans Boehm (based on information from Andrew Begel)
102
103
104== Older Information (Most of this no longer applies to the current code) ==
105
106While the GC should work on MacOS X Server, MacOS X and Darwin, I only tested
107it on MacOS X Server.
108I've added a PPC assembly version of GC_push_regs(), thus the setjmp() hack is
109no longer necessary. Incremental collection is supported via mprotect/signal.
110The current solution isn't really optimal because the signal handler must decode
111the faulting PPC machine instruction in order to find the correct heap address.
112Further, it must poke around in the register state which the kernel saved away
113in some obscure register state structure before it calls the signal handler -
114needless to say the layout of this structure is no where documented.
115Threads and dynamic libraries are not yet supported (adding dynamic library
116support via the low-level dyld API shouldn't be that hard).
117
118The original MacOS X port was brought to you by Andrew Stone.
119
120
121June, 1 2000
122
123Dietmar Planitzer
124
125Note from Andrew Begel:
126
127One more fix to enable gc.a to link successfully into a shared library for
128MacOS X. You have to add -fno-common to the CFLAGS in the Makefile. MacOSX
129disallows common symbols in anything that eventually finds its way into a
130shared library. (I don't completely understand why, but -fno-common seems to
131work and doesn't mess up the garbage collector's functionality).
132
133Feb 26, 2003
134
135Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support.
136GC_MACOSX_THREADS should be defined in the build and in clients. Real
137dynamic library support is still missing, i.e. dynamic library data segments
138are still not scanned. Code that stores pointers to the garbage collected
139heap in statically allocated variables should not reside in a dynamic
140library. This still doesn't appear to be 100% reliable.
141
142Mar 10, 2003
143Brian Alliet contributed dynamic library support for MacOSX. It could also
144use more testing.
145
README.dj
1
2Look first at Makefile.dj, and possibly change the definitions of
3RM and MV if you don't have rm and mv installed.
4Then use Makefile.dj to compile the garbage collector.
5For example, you can do:
6
7 make -f Makefile.dj test
8
9All the tests should work fine.
10
README.environment
1The garbage collector looks at a number of environment variables which are,
2then, used to affect its operation.
3
4GC_INITIAL_HEAP_SIZE=<bytes> - Initial heap size in bytes. May speed up
5 process start-up. Optionally, may be
6 specified with a multiplier ('k', 'M' or 'G')
7 suffix.
8
9GC_MAXIMUM_HEAP_SIZE=<bytes> - Maximum collected heap size. Allows
10 a multiplier suffix.
11
12GC_LOOP_ON_ABORT - Causes the collector abort routine to enter a tight loop.
13 This may make it easier to debug, such a process, especially
14 for multi-threaded platforms that don't produce usable core
15 files, or if a core file would be too large. On some
16 platforms, this also causes SIGSEGV to be caught and
17 result in an infinite loop in a handler, allowing
18 similar debugging techniques.
19
20GC_PRINT_STATS - Turn on GC logging. Not functional with SMALL_CONFIG.
21
22GC_LOG_FILE - The name of the log file. Stderr by default. Not functional
23 with SMALL_CONFIG.
24
25GC_ONLY_LOG_TO_FILE - Turns off redirection of GC stdout and stderr to the log
26 file specified by GC_LOG_FILE. Has no effect unless
27 GC_LOG_FILE is set. Not functional with SMALL_CONFIG.
28
29GC_PRINT_VERBOSE_STATS - Turn on even more logging. Not functional with
30 SMALL_CONFIG.
31
32GC_DUMP_REGULARLY - Generate a GC debugging dump GC_dump() on startup
33 and during every collection. Very verbose. Useful
34 if you have a bug to report, but please include only the
35 last complete dump.
36
37GC_COLLECT_AT_MALLOC=<n> - Override the default value specified by
38 GC_COLLECT_AT_MALLOC macro. Has no effect unless
39 GC is built with GC_COLLECT_AT_MALLOC defined.
40
41GC_BACKTRACES=<n> - Generate n random back-traces (for heap profiling) after
42 each GC. Collector must have been built with
43 KEEP_BACK_PTRS. This won't generate useful output unless
44 most objects in the heap were allocated through debug
45 allocators. This is intended to be only a statistical
46 sample; individual traces may be erroneous due to
47 concurrent heap mutation.
48
49GC_PRINT_ADDRESS_MAP - Linux only. Dump /proc/self/maps, i.e. various address
50 maps for the process, to stderr on every GC. Useful for
51 mapping root addresses to source for deciphering leak
52 reports.
53
54GC_NPROCS=<n> - Linux w/threads only. Explicitly sets the number of processors
55 that the GC should expect to use. Note that setting this to 1
56 when multiple processors are available will preserve
57 correctness, but may lead to really horrible performance,
58 since the lock implementation will immediately yield without
59 first spinning.
60
61GC_MARKERS=<n> - Only if compiled with PARALLEL_MARK. Set the number
62 of marker threads. This is normally set to the number of
63 processors. It is safer to adjust GC_MARKERS than GC_NPROCS,
64 since GC_MARKERS has no impact on the lock implementation.
65
66GC_NO_BLACKLIST_WARNING - Prevents the collector from issuing
67 warnings about allocations of very large blocks.
68 Deprecated. Use GC_LARGE_ALLOC_WARN_INTERVAL instead.
69
70GC_LARGE_ALLOC_WARN_INTERVAL=<n> - Print every nth warning about very large
71 block allocations, starting with the nth one. Small values
72 of n are generally benign, in that a bounded number of
73 such warnings generally indicate at most a bounded leak.
74 For best results it should be set at 1 during testing.
75 Default is 5. Very large numbers effectively disable the
76 warning.
77
78GC_IGNORE_GCJ_INFO - Ignore the type descriptors implicitly supplied by
79 GC_gcj_malloc and friends. This is useful for debugging
80 descriptor generation problems, and possibly for
81 temporarily working around such problems. It forces a
82 fully conservative scan of all heap objects except
83 those known to be pointer-free, and may thus have other
84 adverse effects.
85
86GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects
87 ending in a reachable one. If this number remains
88 bounded, then the program is "GC robust". This ensures
89 that a fixed number of misidentified pointers can only
90 result in a bounded space leak. This currently only
91 works if debugging allocation is used throughout.
92 It increases GC space and time requirements appreciably.
93 This feature is still somewhat experimental, and requires
94 that the collector have been built with MAKE_BACK_GRAPH
95 defined. For details, see Boehm, "Bounding Space Usage
96 of Conservative Garbage Collectors", POPL 2001
97 (http://www.hpl.hp.com/techreports/2001/HPL-2001-251.html).
98
99GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost
100 thread suspend signals (Pthreads only). On by
101 default for GC_OSF1_THREADS, off otherwise. Note
102 that this does not work around a possible loss of
103 thread restart signals. This seems to be necessary for
104 some versions of Tru64. Since we've previously seen
105 similar issues on some other operating systems, it
106 was turned into a runtime flag to enable last-minute
107 work-arounds.
108
109GC_USE_GETWRITEWATCH=<n> - Only if MPROTECT_VDB and GWW_VDB are both defined
110 (Win32 only). Explicitly specify which strategy of
111 keeping track of dirtied pages should be used.
112 If n=0 then GetWriteWatch() is not used (falling back to
113 protecting pages and catching memory faults strategy)
114 else the collector tries to use GetWriteWatch-based
115 strategy (GWW_VDB) first if available.
116
117GC_DISABLE_INCREMENTAL - Ignore runtime requests to enable incremental GC.
118 Useful for debugging.
119
120The following turn on runtime flags that are also program settable. Checked
121only during initialization. We expect that they will usually be set through
122other means, but this may help with debugging and testing:
123
124GC_ENABLE_INCREMENTAL - Turn on incremental collection at startup. Note that,
125 depending on platform and collector configuration, this
126 may involve write protecting pieces of the heap to
127 track modifications. These pieces may include
128 pointer-free objects or not. Although this is intended
129 to be transparent, it may cause unintended system call
130 failures. Use with caution.
131
132GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs.
133 This only has an effect if incremental collection is
134 enabled. If a collection requires appreciably more time
135 than this, the client will be restarted, and the collector
136 will need to do additional work to compensate. The
137 special value "999999" indicates that pause time is
138 unlimited, and the incremental collector will behave
139 completely like a simple generational collector. If
140 the collector is configured for parallel marking, and
141 run on a multiprocessor, incremental collection should
142 only be used with unlimited pause time.
143
144GC_FULL_FREQUENCY - Set the desired number of partial collections between full
145 collections. Matters only if GC_incremental is set.
146 Not functional with SMALL_CONFIG.
147
148GC_FREE_SPACE_DIVISOR - Set GC_free_space_divisor to the indicated value.
149 Setting it to larger values decreases space consumption
150 and increases GC frequency.
151
152GC_UNMAP_THRESHOLD - Set the desired memory blocks unmapping threshold (the
153 number of sequential garbage collections for which
154 a candidate block for unmapping should remain free). The
155 special value "0" completely disables unmapping.
156
157GC_FORCE_UNMAP_ON_GCOLLECT - Turn "unmap as much as possible on explicit GC"
158 mode on (overrides the default value). Has no effect on
159 implicitly-initiated garbage collections. Has no effect if
160 memory unmapping is disabled (or not compiled in) or if the
161 unmapping threshold is 1.
162
163GC_FIND_LEAK - Turns on GC_find_leak and thus leak detection. Forces a
164 collection at program termination to detect leaks that would
165 otherwise occur after the last GC.
166
167GC_FINDLEAK_DELAY_FREE - Turns on deferred freeing of objects in the
168 leak-finding mode (see the corresponding macro
169 description for more information).
170
171GC_ABORT_ON_LEAK - Causes the application to be terminated once leaked or
172 smashed objects are found.
173
174GC_ALL_INTERIOR_POINTERS - Turns on GC_all_interior_pointers and thus interior
175 pointer recognition.
176
177GC_DONT_GC - Turns off garbage collection. Use cautiously.
178
179GC_USE_ENTIRE_HEAP - Set desired GC_use_entire_heap value at start-up. See
180 the similar macro description in README.macros.
181
182GC_TRACE=addr - Intended for collector debugging. Requires that the collector
183 have been built with ENABLE_TRACE defined. Causes the debugger
184 to log information about the tracing of address ranges
185 containing addr. Typically addr is the address that contains
186 a pointer to an object that mysteriously failed to get marked.
187 Addr must be specified as a hexadecimal integer.
188
README.ews4800
1GC on EWS4800
2-------------
3
41. About EWS4800
5 EWS4800 is 32bit/64bit workstation.
6
7 Vendor: 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 information 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
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. The reasons for that are not yet
80understood. (HB, paraphrasing message from Hironori SAKAMOTO.)
81
README.hp
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 collectible 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.
19
README.linux
1See README.alpha for Linux on DEC AXP info.
2
3This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K,
4IA64, SPARC, MIPS, Alpha and PowerPC are integrated too. 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 or NPTL (which are included in libc6).
23
24 The collector relies on some implementation details of the LinuxThreads
25 package. This code may not 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 (or
30 just -DGC_THREADS) and -D_REENTRANT 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 dlopen --wrap pthread_create \
41 --wrap pthread_join --wrap pthread_detach \
42 --wrap pthread_sigmask --wrap pthread_exit --wrap pthread_cancel
43
44 (for gcc) -Wl,--wrap -Wl,dlopen -Wl,--wrap -Wl,pthread_create \
45 -Wl,--wrap -Wl,pthread_join -Wl,--wrap -Wl,pthread_detach \
46 -Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,pthread_exit \
47 -Wl,--wrap -Wl,pthread_cancel
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 is probably not fully reliable, though it now seems to work
59 in simple cases.
60
616) Thread local storage may not be viewed as part of the root set by the
62 collector. This probably depends on the linuxthreads version. For the
63 time being, any collectible memory referenced by thread local storage
64 should also be referenced from elsewhere, or be allocated as uncollectible.
65 (This is really a bug that should be fixed somehow. The current GC
66 version probably gets things right if there are not too many tls locations
67 and if dlopen is not used.)
68
69
70M68K LINUX:
71(From Richard Zidlicky)
72The bad news is that it can crash every linux-m68k kernel on a 68040,
73so an additional test is needed somewhere on startup. I have meanwhile
74patches to correct the problem in 68040 buserror handler but it is not
75yet in any standard kernel.
76
77Here is a simple test program to detect whether the kernel has the
78problem. It could be run as a separate check in configure or tested
79upon startup. If it fails (return !0) than mprotect can't be used
80on that system.
81
82/*
83 * test for bug that may crash 68040 based Linux
84 */
85
86#include <sys/mman.h>
87#include <signal.h>
88#include <unistd.h>
89#include <stdio.h>
90#include <stdlib.h>
91
92
93char *membase;
94int pagesize=4096;
95int pageshift=12;
96int x_taken=0;
97
98int sighandler(int sig)
99{
100 mprotect(membase,pagesize,PROT_READ|PROT_WRITE);
101 x_taken=1;
102}
103
104main()
105{
106 long l;
107
108 signal(SIGSEGV,sighandler);
109 l=(long)mmap(NULL,pagesize,PROT_READ,MAP_PRIVATE | MAP_ANON,-1,0);
110 if (l==-1)
111 {
112 perror("mmap/malloc");
113 abort();
114 }
115 membase=(char*)l;
116 *(long*)(membase+sizeof(long))=123456789;
117 if (*(long*)(membase+sizeof(long)) != 123456789 )
118 {
119 fprintf(stderr,"writeback failed !\n");
120 exit(1);
121 }
122 if (!x_taken)
123 {
124 fprintf(stderr,"exception not taken !\n");
125 exit(1);
126 }
127 fprintf(stderr,"vmtest Ok\n");
128 exit(0);
129}
130
README.macros
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 platform-specific predefined macros. This makes
18it relatively easy to adapt to new compilers with a different set of
19predefined macros. Currently these macros generally identify platforms
20instead of features. In many cases, this is a mistake.
21
22Many of the tested configuration macros are at least somewhat defined in
23either include/private/gcconfig.h or in Makefile.direct. Here is an attempt
24at documenting these macros: (Thanks to Walter Bright for suggesting
25this. This is a work in progress)
26
27MACRO EXPLANATION
28----- -----------
29
30GC_DEBUG Tested by gc.h. Causes all-upper-case macros to
31 expand to calls to debug versions of collector routines.
32
33GC_NAMESPACE Tested by gc_cpp.h. Causes gc_cpp symbols to be defined
34 in "boehmgc" namespace.
35
36GC_DEBUG_REPLACEMENT Tested by gc.h. Causes GC_MALLOC/REALLOC() to be
37 defined as GC_debug_malloc/realloc_replacement().
38
39GC_NO_THREAD_REDIRECTS Tested by gc.h. Prevents redirection of thread
40 creation routines etc. to GC_ versions. Requires the
41 programmer to explicitly handle thread registration.
42
43GC_NO_THREAD_DECLS Tested by gc.h. MS Windows only. Do not declare
44 Windows thread creation routines and do not include windows.h.
45
46GC_UNDERSCORE_STDCALL Tested by gc.h. Explicitly prefix exported/imported
47 WINAPI (__stdcall) symbols with '_' (underscore). Could be
48 used with MinGW (for x86) compiler (in conjunction with
49 GC_DLL) to follow MS conventions for __stdcall symbols naming.
50
51_ENABLE_ARRAYNEW
52 #define'd by the Digital Mars C++ compiler when
53 operator new[] and delete[] are separately
54 overloadable. Used in gc_cpp.h.
55
56_DLL Tested by gc_config_macros.h. Defined by Visual C++ if runtime
57 dynamic libraries are in use. Used (only if none of GC_DLL,
58 GC_NOT_DLL, __GNUC__ are defined) to test whether
59 __declspec(dllimport) needs to be added to declarations
60 to support the case in which the collector is in a DLL.
61
62GC_DLL Defined by user if dynamic libraries are being built
63 or used. Also set by gc.h if _DLL is defined (except for
64 mingw) while GC_NOT_DLL and __GNUC__ are both undefined.
65 This is the macro that is tested internally to determine
66 whether the GC is in its own dynamic library. May need
67 to be set by clients before including gc.h. Note that
68 inside the GC implementation it indicates that the
69 collector is in its own dynamic library, should export
70 its symbols, etc. But in clients it indicates that the
71 GC resides in a different DLL, its entry points should
72 be referenced accordingly, and precautions may need to
73 be taken to properly deal with statically allocated
74 variables in the main program. Used for MS Windows.
75 Also used by GCC v4+ (only when the dynamic shared library
76 is being built) to hide internally used symbols.
77
78GC_NOT_DLL User-settable macro that overrides _DLL, e.g. if runtime
79 dynamic libraries are used, but the collector is in a static
80 library. Tested by gc_config_macros.h.
81
82GC_REQUIRE_WCSDUP Force GC to export GC_wcsdup() (the Unicode version
83 of GC_strdup); could be useful in the leak-finding mode.
84
85
86These define arguments influence the collector configuration:
87
88FIND_LEAK Causes GC_find_leak to be initially set. This causes the
89 collector to assume that all inaccessible objects should have been
90 explicitly deallocated, and reports exceptions. Finalization and the test
91 program are not usable in this mode.
92
93GC_FINDLEAK_DELAY_FREE Turns on deferred freeing of objects in the
94 leak-finding mode letting the collector to detect alter-object-after-free
95 errors as well as detect leaked objects sooner (instead of only when program
96 terminates). Has no effect if SHORT_DBG_HDRS.
97
98GC_ABORT_ON_LEAK Causes the application to be terminated once leaked or
99 smashed (corrupted on use-after-free) objects are found (after printing the
100 information about that objects).
101
102SUNOS5SIGS Solaris-like signal handling. This is probably misnamed,
103 since it really doesn't guarantee much more than POSIX. Currently set only
104 for Solaris2.X, HPUX, and DRSNX. Should probably be set for some other
105 platforms.
106
107PCR Set if the collector is being built as part of the Xerox Portable
108 Common Runtime.
109
110IMPORTANT: Any of the _THREADS options must normally also be defined in
111 the client before including gc.h. This redefines thread primitives to
112 invoke the GC_ versions instead. Alternatively, linker-based symbol
113 interception can be used on a few platforms.
114
115GC_THREADS Should set the appropriate one of the below macros,
116 except GC_WIN32_PTHREADS, which must be set explicitly. Tested by gc.h.
117
118GC_SOLARIS_THREADS Enables support for Solaris pthreads.
119 Must also define _REENTRANT.
120
121GC_IRIX_THREADS Enables support for Irix pthreads. See README.sgi.
122
123GC_HPUX_THREADS Enables support for HP/UX 11 pthreads.
124 Also requires _REENTRANT or _POSIX_C_SOURCE=199506L. See README.hp.
125
126GC_LINUX_THREADS Enables support for Xavier Leroy's Linux threads
127 or NPTL threads. See README.linux. _REENTRANT may also be required.
128
129GC_OSF1_THREADS Enables support for Tru64 pthreads.
130
131GC_FREEBSD_THREADS Enables support for FreeBSD pthreads.
132 Appeared to run into some underlying thread problems.
133
134GC_NETBSD_THREADS Enables support for NetBSD pthreads.
135
136GC_OPENBSD_THREADS Enables support for OpenBSD pthreads.
137
138GC_DARWIN_THREADS Enables support for Mac OS X pthreads.
139
140GC_AIX_THREADS Enables support for IBM AIX threads.
141
142GC_DGUX386_THREADS Enables support for DB/UX on I386 threads.
143 See README.DGUX386. (Probably has not been tested recently.)
144
145GC_WIN32_THREADS Enables support for Win32 threads. That makes sense
146 for this Makefile only under Cygwin.
147
148GC_WIN32_PTHREADS Enables support for pthreads-win32. This cannot be
149 enabled automatically by GC_THREADS, which would assume Win32 native
150 threads.
151
152PTW32_STATIC_LIB Causes the static version of the Mingw pthreads
153 library to be used. Requires GC_WIN32_PTHREADS.
154
155GC_PTHREADS_PARAMARK Causes pthread-based parallel mark implementation
156 to be used even if GC_WIN32_PTHREADS is undefined. (Useful for WinCE.)
157
158ALL_INTERIOR_POINTERS Allows all pointers to the interior of objects to be
159 recognized. (See gc_priv.h for consequences.) Alternatively,
160 GC_all_interior_pointers can be set at process initialization time.
161
162SMALL_CONFIG Tries to tune the collector for small heap sizes,
163 usually causing it to use less space in such situations. Incremental
164 collection no longer works in this case. Also, removes some
165 statistic-printing code. Turns off some optimization algorithms (like data
166 prefetching in the mark routine).
167
168GC_DISABLE_INCREMENTAL Turn off the incremental collection support.
169
170NO_INCREMENTAL Causes the gctest program to not invoke the incremental
171 collector. This has no impact on the generated library, only on the test
172 program. (This is often useful for debugging failures unrelated to
173 incremental GC.)
174
175LARGE_CONFIG Tunes the collector for unusually large heaps.
176 Necessary for heaps larger than about 4 GiB on most (64-bit) machines.
177 Recommended for heaps larger than about 500 MiB. Not recommended for
178 embedded systems. Could be used in conjunction with SMALL_CONFIG to
179 generate smaller code (by disabling incremental collection support,
180 statistic printing and some optimization algorithms).
181
182DONT_ADD_BYTE_AT_END Meaningful only with ALL_INTERIOR_POINTERS or
183 GC_all_interior_pointers = 1. Normally ALL_INTERIOR_POINTERS
184 causes all objects to be padded so that pointers just past the end of
185 an object can be recognized. This can be expensive. (The padding
186 is normally more than one byte due to alignment constraints.)
187 DONT_ADD_BYTE_AT_END disables the padding.
188
189NO_EXECUTE_PERMISSION May cause some or all of the heap to not
190 have execute permission, i.e. it may be impossible to execute
191 code from the heap. Currently this only affects the incremental
192 collector on UNIX machines. It may greatly improve its performance,
193 since this may avoid some expensive cache synchronization. Alternatively,
194 GC_set_pages_executable can be called at the process initialization time.
195
196GC_NO_OPERATOR_NEW_ARRAY Declares that the C++ compiler does not
197 support the new syntax "operator new[]" for allocating and deleting arrays.
198 See gc_cpp.h for details. No effect on the C part of the collector.
199 This is defined implicitly in a few environments. Must also be defined
200 by clients that use gc_cpp.h.
201
202REDIRECT_MALLOC=<X> Causes malloc to be defined as alias for X.
203 Unless the following macros are defined, realloc is also redirected
204 to GC_realloc, and free is redirected to GC_free.
205 Calloc and str[n]dup are redefined in terms of the new malloc. X should
206 be either GC_malloc or GC_malloc_uncollectable, or
207 GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
208 with dummy source location information, but still results in
209 properly remembered call stacks on Linux/X86 and Solaris/SPARC.
210 It requires that the following two macros also be used.)
211 The former is occasionally useful for working around leaks in code
212 you don't want to (or can't) look at. It may not work for
213 existing code, but it often does. Neither works on all platforms,
214 since some ports use malloc or calloc to obtain system memory.
215 (Probably works for UNIX, and Win32.) If you build with DBG_HDRS_ALL,
216 you should only use GC_debug_malloc_replacement as a malloc
217 replacement.
218
219REDIRECT_REALLOC=<X> Causes GC_realloc to be redirected to X.
220 The canonical use is REDIRECT_REALLOC=GC_debug_realloc_replacement,
221 together with REDIRECT_MALLOC=GC_debug_malloc_replacement to
222 generate leak reports with call stacks for both malloc and realloc.
223 This also requires REDIRECT_FREE.
224
225REDIRECT_FREE=<X> Causes free to be redirected to X. The canonical use
226 is REDIRECT_FREE=GC_debug_free.
227
228IGNORE_FREE Turns calls to free into a no-op. Only useful with
229 REDIRECT_MALLOC.
230
231NO_DEBUGGING Removes GC_dump and the debugging routines it calls.
232 Reduces code size slightly at the expense of debuggability.
233
234DEBUG_THREADS Turn on printing additional thread-support debugging
235 information.
236
237GC_COLLECT_AT_MALLOC=<n> Force garbage collection at every
238 GC_malloc_* call with the size greater than the specified value.
239 (Might be useful for application debugging or in find-leak mode.)
240
241JAVA_FINALIZATION Makes it somewhat safer to finalize objects out of
242 order by specifying a nonstandard finalization mark procedure (see
243 finalize.c). Objects reachable from finalizable objects will be marked
244 in a separate post-pass, and hence their memory won't be reclaimed.
245 Not recommended unless you are implementing a language that specifies
246 these semantics. Since 5.0, determines only the initial value
247 of GC_java_finalization variable.
248
249FINALIZE_ON_DEMAND Causes finalizers to be run only in response
250 to explicit GC_invoke_finalizers() calls.
251 In 5.0 this became runtime adjustable, and this only determines the
252 initial value of GC_finalize_on_demand.
253
254GC_NO_FINALIZATION Exclude finalization support (for smaller code size)
255
256ATOMIC_UNCOLLECTABLE Includes code for GC_malloc_atomic_uncollectable.
257 This is useful if either the vendor malloc implementation is poor,
258 or if REDIRECT_MALLOC is used.
259
260MARK_BIT_PER_GRANULE Requests that a mark bit (or often byte)
261 be allocated for each allocation granule, as opposed to each object.
262 This often improves speed, possibly at some cost in space and/or
263 cache footprint. Normally it is best to let this decision be
264 made automatically depending on platform.
265
266MARK_BIT_PER_OBJ Requests that a mark bit be allocated for each
267 object instead of allocation granule. The opposite of
268 MARK_BIT_PER_GRANULE.
269
270HBLKSIZE=<ddd> Explicitly sets the heap block size (where ddd is a power of
271 2 between 512 and 16384). Each heap block is devoted to a single size and
272 kind of object. For the incremental collector it makes sense to match
273 the most likely page size. Otherwise large values result in more
274 fragmentation, but generally better performance for large heaps.
275
276USE_MMAP Use MMAP instead of sbrk to get new memory.
277 Works for Linux, FreeBSD, Cygwin, Solaris and Irix.
278
279USE_MUNMAP Causes memory to be returned to the OS under the right
280 circumstances. This currently disables VM-based incremental collection
281 (except for Win32 with GetWriteWatch() available).
282 Works under some Unix, Linux and Windows versions.
283 Requires USE_MMAP except for Windows.
284
285USE_WINALLOC (Cygwin only) Use Win32 VirtualAlloc (instead of sbrk or mmap)
286 to get new memory. Useful if memory unmapping (USE_MUNMAP) is enabled.
287
288MUNMAP_THRESHOLD=<value> Set the desired memory blocks unmapping
289 threshold (the number of sequential garbage collections for which
290 a candidate block for unmapping should remain free).
291
292GC_FORCE_UNMAP_ON_GCOLLECT Set "unmap as much as possible on explicit GC"
293 mode on by default. The mode could be changed at run-time. Has no effect
294 unless unmapping is turned on. Has no effect on implicitly-initiated
295 garbage collections.
296
297PRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
298 the garbage collector detects a value that looks almost, but not quite,
299 like a pointer, print both the address containing the value, and the
300 value of the near-bogus-pointer. Can be used to identify regions of
301 memory that are likely to contribute misidentified pointers.
302
303KEEP_BACK_PTRS Add code to save back pointers in debugging headers
304 for objects allocated with the debugging allocator. If all objects
305 through GC_MALLOC with GC_DEBUG defined, this allows the client
306 to determine how particular or randomly chosen objects are reachable
307 for debugging/profiling purposes. The gc_backptr.h interface is
308 implemented only if this is defined.
309
310GC_ASSERTIONS Enable some internal GC assertion checking. Currently
311 this facility is only used in a few places. It is intended primarily
312 for debugging of the garbage collector itself, but could also...
313
314DBG_HDRS_ALL Make sure that all objects have debug headers. Increases
315 the reliability (from 99.9999% to 100% mod. bugs) of some of the debugging
316 code (especially KEEP_BACK_PTRS). Makes SHORT_DBG_HDRS possible.
317 Assumes that all client allocation is done through debugging allocators.
318
319SHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
320 the headers to minimize object size, at the expense of checking for
321 writes past the end of an object. This is intended for environments
322 in which most client code is written in a "safe" language, such as
323 Scheme or Java. Assumes that all client allocation is done using
324 the GC_debug_ functions, or through the macros that expand to these,
325 or by redirecting malloc to GC_debug_malloc_replacement.
326 (Also eliminates the field for the requested object size.)
327 Occasionally could be useful for debugging of client code. Slows down the
328 collector somewhat, but not drastically.
329
330SAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
331 allocated through the debugging interface. Affects the amount of
332 information generated in leak reports. Only matters on platforms
333 on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
334 and Solaris/SPARC and platforms that provide execinfo.h.
335 Default is zero. On X86, client
336 code should NOT be compiled with -fomit-frame-pointer.
337
338SAVE_CALL_NARGS=<n> Set the number of functions arguments to be saved
339 with each call frame. Default is zero. Ignored if we don't know how to
340 retrieve arguments on the platform.
341
342CHECKSUMS Reports on erroneously clear dirty bits, and unexpectedly
343 altered stubborn objects, at substantial performance cost. Use only for
344 debugging of the incremental collector. Not compatible with USE_MUNMAP
345 or threads.
346
347GC_GCJ_SUPPORT Includes support for gcj (and possibly other systems
348 that include a pointer to a type descriptor in each allocated object).
349 Building this way requires an ANSI C compiler.
350
351USE_I686_PREFETCH Causes the collector to issue Pentium III style
352 prefetch instructions. No effect except on X86 Linux platforms.
353 Assumes a very recent gcc-compatible compiler and assembler.
354 (Gas prefetcht0 support was added around May 1999.)
355 Empirically the code appears to still run correctly on Pentium II
356 processors, though with no performance benefit. May not run on other
357 X86 processors? In some cases this improves performance by
358 15% or so.
359
360USE_3DNOW_PREFETCH Causes the collector to issue AMD 3DNow style
361 prefetch instructions. Same restrictions as USE_I686_PREFETCH.
362 Minimally tested. Didn't appear to be an obvious win on a K6-2/500.
363
364USE_PPC_PREFETCH Causes the collector to issue PowerPC style
365 prefetch instructions. No effect except on PowerPC OS X platforms.
366 Performance impact untested.
367
368GC_USE_LD_WRAP In combination with the old flags listed in README.linux
369 causes the collector some system and pthread calls in a more transparent
370 fashion than the usual macro-based approach. Requires GNU ld, and
371 currently probably works only with Linux.
372
373GC_USE_DLOPEN_WRAP Causes the collector to redefine malloc and
374 intercepted pthread routines with their real names, and causes it to use
375 dlopen and dlsym to refer to the original versions. This makes it possible
376 to build an LD_PRELOADable malloc replacement library.
377
378THREAD_LOCAL_ALLOC Defines GC_malloc(), GC_malloc_atomic() and
379 GC_gcj_malloc() to use a per-thread set of free-lists. These then allocate
380 in a way that usually does not involve acquisition of a global lock.
381 Recommended for multiprocessors. Requires explicit GC_INIT() call, unless
382 REDIRECT_MALLOC is defined and GC_malloc is used first.
383
384USE_COMPILER_TLS Causes thread local allocation to use
385 the compiler-supported "__thread" thread-local variables. This is the
386 default in HP/UX. It may help performance on recent Linux installations.
387 (It failed for me on RedHat 8, but appears to work on RedHat 9.)
388
389PARALLEL_MARK Allows the marker to run in multiple threads. Recommended
390 for multiprocessors.
391
392GC_WINMAIN_REDIRECT (Win32 only) Redirect (rename) an application
393 WinMain to GC_WinMain; implement the "real" WinMain which starts a new
394 thread to call GC_WinMain after initializing the GC. Useful for WinCE.
395 Incompatible with GC_DLL.
396
397GC_REGISTER_MEM_PRIVATE (Win32 only) Force to register MEM_PRIVATE R/W
398 sections as data roots. Might be needed for some WinCE 6.0+ custom builds.
399 (May result in numerous "Data Abort" messages logged to WinCE debugging
400 console.) Incompatible with GCC toolchains for WinCE.
401
402NO_GETENV Prevents the collector from looking at environment variables.
403 These may otherwise alter its configuration, or turn off GC altogether.
404 I don't know of a reason to disable this, except possibly if the resulting
405 process runs as a privileged user. (This is on by default for WinCE.)
406
407EMPTY_GETENV_RESULTS Define to workaround a reputed Wine bug in getenv
408 (getenv() may return an empty string instead of NULL for a missing entry).
409
410GC_READ_ENV_FILE (Win32 only) Read environment variables from the GC "env"
411 file (named as the program name plus ".gc.env" extension). Useful for WinCE
412 targets (which have no getenv()). In the file, every variable is specified
413 in a separate line and the format is as "<name>=<value>" (without spaces).
414 A comment line may start with any character except for the Latin letters,
415 the digits and the underscore ('_'). The file encoding is Latin-1.
416
417USE_GLOBAL_ALLOC (Win32 only) Use GlobalAlloc() instead of VirtualAlloc()
418 to allocate the heap. May be needed to work around a Windows NT/2000 issue.
419 Incompatible with USE_MUNMAP. See README.win32 for details.
420
421MAKE_BACK_GRAPH Enable GC_PRINT_BACK_HEIGHT environment variable.
422 See README.environment for details. Experimental. Limited platform
423 support. Implies DBG_HDRS_ALL. All allocation should be done using
424 the debug interface.
425
426GC_PRINT_BACK_HEIGHT Permanently turn on back-height printing mode
427 (useful when NO_GETENV). See the similar environment variable description
428 in README.environment. Requires MAKE_BACK_GRAPH defined.
429
430STUBBORN_ALLOC Allows allocation of "hard to change" objects, and thus
431 makes incremental collection easier. Was enabled by default until 6.0.
432 Rarely used, to my knowledge.
433
434HANDLE_FORK (Unix and Cygwin only) Attempt by default to make GC_malloc()
435 work in a child process fork()'ed from a multi-threaded parent. Not fully
436 POSIX-compliant and could be disabled at runtime (before GC_INIT).
437
438TEST_WITH_SYSTEM_MALLOC Causes gctest to allocate (and leak) large
439 chunks of memory with the standard system malloc. This will cause the root
440 set and collected heap to grow significantly if malloc'ed memory is somehow
441 getting traced by the collector. This has no impact on the generated
442 library; it only affects the test.
443
444POINTER_MASK=<0x...> Causes candidate pointers to be AND'ed with the given
445 mask before being considered. If either this or the following macro is
446 defined, it will be assumed that all pointers stored in the heap need to be
447 processed this way. Stack and register pointers will be considered both
448 with and without processing. These macros are normally needed only to
449 support systems that use high-order pointer tags. EXPERIMENTAL.
450
451POINTER_SHIFT=<n> Causes the collector to left shift candidate pointers
452 by the indicated amount before trying to interpret them. Applied after
453 POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
454
455ENABLE_TRACE Enables the GC_TRACE=addr environment setting to do its job.
456 By default this is not supported in order to keep the marker as fast as
457 possible.
458
459DARWIN_DONT_PARSE_STACK Causes the Darwin port to discover thread
460 stack bounds in the same way as other pthread ports, without trying to
461 walk the frames on the stack. This is recommended only as a fall-back for
462 applications that don't support proper stack unwinding.
463
464GC_NO_THREADS_DISCOVERY (Darwin and Win32+DLL only) Exclude DllMain-based
465 (on Windows) and task-threads-based (on Darwin) thread registration support.
466
467GC_INSIDE_DLL (Win32 only) Enable DllMain-based approach of threads
468 registering even in case GC_DLL is not defined.
469
470GC_DISCOVER_TASK_THREADS (Darwin and Win32+DLL only) Compile the collector
471 with the implicitly turned on task-threads-based (on Darwin) or
472 DllMain-based (on Windows) approach of threads registering. Only for
473 compatibility and for the case when it is not possible to call
474 GC_use_threads_discovery() early (before other GC calls).
475
476USE_PROC_FOR_LIBRARIES Causes the Linux collector to treat writable
477 memory mappings (as reported by /proc) as roots, if it doesn't have
478 other information about them. It no longer traverses dynamic loader
479 data structures to find dynamic library static data. This may be
480 required for applications that store pointers in mmapped segments without
481 informing the collector. But it typically performs poorly, especially
482 since it will scan inactive but cached NPTL thread stacks completely.
483
484IGNORE_DYNAMIC_LOADING Don't define DYNAMIC_LOADING even if supported by the
485 platform (that is, build the collector with disabled tracing of dynamic
486 library data roots).
487
488NO_PROC_STAT Causes the collector to avoid relying on Linux
489 "/proc/self/stat".
490
491NO_GETCONTEXT Causes the collector to not assume the existence of the
492 getcontext() function on linux-like platforms. This currently happens
493 implicitly on Darwin, Hurd, or ARM or MIPS hardware. It is explicitly
494 needed for some old versions of FreeBSD.
495
496STATIC=static Causes various GC_ symbols that could logically be declared
497 static to be declared (this is the default if NO_DEBUGGING is specified).
498 Reduces the number of visible symbols (letting the optimizer do its work
499 better), which is probably cleaner, but may make some kinds of debugging
500 and profiling harder.
501
502GC_DLL Build dynamic-link library (or dynamic shared object). For Unix this
503 causes the exported symbols to have 'default' visibility (ignored unless
504 GCC v4+) and the internal ones to have 'hidden' visibility.
505
506DONT_USE_USER32_DLL (Win32 only) Don't use "user32" DLL import library
507 (containing MessageBox() entry); useful for a static GC library.
508
509GC_PREFER_MPROTECT_VDB Choose MPROTECT_VDB manually in case of multiple
510 virtual dirty bit strategies are implemented (at present useful on Win32 and
511 Solaris to force MPROTECT_VDB strategy instead of the default GWW_VDB or
512 PROC_VDB ones).
513
514GC_IGNORE_GCJ_INFO Disable GCJ-style type information (useful for
515 debugging on WinCE).
516
517GC_PRINT_VERBOSE_STATS Permanently turn on verbose logging (useful for
518 debugging and profiling on WinCE).
519
520GC_ONLY_LOG_TO_FILE Don't redirect GC stdout and stderr to the log file
521 specified by GC_LOG_FILE environment variable. Has effect only when the
522 variable is set (to anything other than "0").
523
524GC_ANDROID_LOG (Android only) Output error/debug information to Android log.
525
526GC_DONT_EXPAND Don't expand the heap unless explicitly requested or forced to.
527
528GC_USE_ENTIRE_HEAP Causes the non-incremental collector to use the
529 entire heap before collecting. This sometimes results in more large block
530 fragmentation, since very large blocks will tend to get broken up during
531 each GC cycle. It is likely to result in a larger working set, but lower
532 collection frequencies, and hence fewer instructions executed in the
533 collector. This macro controls only the default GC_use_entire_heap value.
534
535GC_INITIAL_HEAP_SIZE=<value> Set the desired default initial heap size
536 in bytes.
537
538GC_FREE_SPACE_DIVISOR=<value> Set alternate default GC_free_space_divisor
539 value.
540
541GC_TIME_LIMIT=<milliseconds> Set alternate default GC_time_limit value
542 (setting this to GC_TIME_UNLIMITED will essentially disable incremental
543 collection while leaving generational collection enabled).
544
545GC_FULL_FREQ=<value> Set alternate default number of partial collections
546 between full collections (matters only if incremental collection is on).
547
548NO_CANCEL_SAFE (Posix platforms with threads only) Don't bother trying
549 to make the collector safe for thread cancellation; cancellation is not
550 used. (Note that if cancellation is used anyway, threads may end up
551 getting cancelled in unexpected places.) Even without this option,
552 PTHREAD_CANCEL_ASYNCHRONOUS is never safe with the collector. (We could
553 argue about its safety without the collector.)
554
555UNICODE (Win32 only) Use the Unicode variant ('W') of the Win32 API instead
556 of ANSI/ASCII one ('A'). Useful for WinCE.
557
558PLATFORM_ANDROID (or __ANDROID__) Compile for Android NDK platform.
559
560SN_TARGET_PS3 Compile for Sony PS/3.
561
562USE_GET_STACKBASE_FOR_MAIN (Linux only) Use pthread_attr_getstack() instead
563 of __libc_stack_end (or instead of any hard-coded value) for getting the
564 primordial thread stack base (useful if the client modifies the program's
565 address space).
566
README.rs6000
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 ...)
10
README.sgi
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
README.solaris2
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 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
20Note:
21Before you run "make check", you need to set your LD_LIBRARY_PATH correctly
22(e.g., to "/usr/local/lib") so that tests can find the shared library
23libgcc_s.so.1. Alternatively, you can configure with --disable-shared.
24
25SOLARIS THREADS:
26
27Threads support is enabled by configure "--enable-threads=posix" option.
28(In case of GCC compiler, multi-threading support is on by default.)
29This causes the collector to be compiled with -D GC_THREADS (or
30-D GC_SOLARIS_THREADS) ensuring thread safety.
31This assumes use of the pthread_ interface. Old style Solaris threads
32are no longer supported.
33Thread-local allocation is now on by default. Parallel marking is on by
34default starting from GC v7.3 but it could be enabled or disabled manually
35by the corresponding "--enable/disable-parallel-mark" options.
36
37It is also essential that gc.h be included in files that call pthread_create,
38pthread_join, pthread_detach, or dlopen. gc.h macro defines these to also do
39GC bookkeeping, etc. gc.h must be included with one or both of these macros
40defined, otherwise these replacements are not visible. A collector built in
41this way way only be used by programs that are linked with the threads library.
42
43Since 5.0 alpha5, dlopen disables collection temporarily,
44unless USE_PROC_FOR_LIBRARIES is defined. In some unlikely cases, this
45can result in unpleasant heap growth. But it seems better than the
46race/deadlock issues we had before.
47
48If threads are used on an X86 processor with malloc redirected to
49GC_malloc, it is necessary to call GC_INIT explicitly before forking the
50first thread. (This avoids a deadlock arising from calling GC_thr_init
51with the allocation lock held.)
52
53It appears that there is a problem in using gc_cpp.h in conjunction with
54Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator
55is invoked by some iostream initialization code before threads are correctly
56initialized. As a result, call to thr_self() in garbage collector
57initialization SEGV faults. Currently the only known workaround is to not
58invoke the garbage collector from a user defined global operator new, or to
59have it invoke the garbage-collector's allocators only after main has started.
60(Note that the latter requires a moderately expensive test in operator
61delete.)
62
63I encountered "symbol <unknown>: offet .... is non-aligned" errors. These
64appear to be traceable to the use of the GNU assembler with the Sun linker.
65The former appears to generate a relocation not understood by the latter.
66The fix appears to be to use a consistent tool chain. (As a non-Solaris-expert
67my solution involved hacking the libtool script, but I'm sure you can
68do something less ugly.)
69
70Hans-J. Boehm
71(The above contains my personal opinions, which are probably not shared
72by anyone else.)
73
README.symbian
1Instructions for Symbian:
21. base version: libgc 7.1
32. Build: use libgc.mmp
43. Limitations
53.1.No multi-threaded support
6
73.2. Be careful with limitation that emulator introduces: Static roots are not
8dynamically accessible (there are Symbian APIs for this purpose but are just
9stubs, returning irrelevant values).
10Consequently, on emulator, you can only use dlls or exe, and retrieve static
11roots by calling global_init_static_root per dll (or exe).
12On target, only libs are supported, because static roots are retrieved by
13linker flags, by calling global_init_static_root in main exe.
14
README.uts
1Alistair Crooks supplied the port. He used Lexa C version 2.1.3 with
2-Xa to compile.
3
README.win32
1The collector has at various times been compiled under Windows 95 & later, NT,
2and XP, with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with
3the GNU win32 tools, 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
7For historical reasons,
8the collector test program "gctest" is linked as a GUI application,
9but does not open any windows. Its output normally appears in the file
10"gctest.gc.log". It may be started from the file manager. The hour glass
11cursor may appear as long as it's running. If it is started from the
12command line, it will usually run in the background. Wait a few
13minutes (a few seconds on a modern machine) before you check the output.
14You should see either a failure indication or a "Collector appears to
15work" message.
16
17The cord test program has not been ported (but should port
18easily). A toy editor (cord/de.exe) based on cords (heavyweight
19strings represented as trees) has been ported and is included.
20It runs fine under either win32 or win32S. It serves as an example
21of a true Windows application, except that it was written by a
22nonexpert Windows programmer. (There are some peculiarities
23in the way files are displayed. The <cr> is displayed explicitly
24for standard DOS text files. As in the UNIX version, control
25characters are displayed explicitly, but in this case as red text.
26This may be suboptimal for some tastes and/or sets of default
27window colors.)
28
29In general -DREDIRECT_MALLOC is unlikely to work unless the
30application is completely statically linked.
31
32The collector normally allocates memory from the OS with VirtualAlloc.
33This appears to cause problems under Windows NT and Windows 2000 (but
34not Windows 95/98) if the memory is later passed to CreateDIBitmap.
35To work around this problem, build the collector with -DUSE_GLOBAL_ALLOC.
36This is currently incompatible with -DUSE_MUNMAP. (Thanks to Jonathan
37Clark for tracking this down. There's some chance this may be fixed
38in 6.1alpha4, since we now separate heap sections with an unused page.)
39
40[Threads and incremental collection are discussed near the end, below.]
41
42Microsoft Tools
43---------------
44For Microsoft development tools, rename NT_MAKEFILE as
45MAKEFILE. (Make sure that the CPU environment variable is defined
46to be i386.) In order to use the gc_cpp.h C++ interface, all
47client code should include gc_cpp.h.
48
49For historical reasons,
50the collector test program "gctest" is linked as a GUI application,
51but does not open any windows. Its output appears in the file
52"gctest.gc.log". It may be started from the file manager. The hour glass
53cursor may appear as long as it's running. If it is started from the
54command line, it will usually run in the background. Wait a few
55minutes (a few seconds on a modern machine) before you check the output.
56You should see either a failure indication or a "Collector appears to
57work" message.
58
59If you would prefer a VC++ .NET project file, ask Hans Boehm. One has
60been contributed, but it seems to contain some absolute paths etc., so
61it can presumably only be a starting point, and is not in the standard
62distribution. It is unclear (to me, Hans Boehm) whether it is feasible to
63change that.
64
65Clients may need to define GC_NOT_DLL before including gc.h, if the
66collector was built as a static library (as it normally is in the
67absence of thread support).
68
69GNU Tools
70---------
71The collector should be buildable under Cygwin with the
72"./configure; make check" machinery.
73
74MinGW builds (including for x86_64) are available via cross-compilation, e.g.
75"./configure --host=i686-pc-mingw32; make check"
76
77To build the collector as a DLL, pass "--enable-shared --disable-static" to
78configure (this will instruct make compile with -D GC_DLL).
79
80Parallel marker could be enabled via "--enable-parallel-mark".
81Memory unmapping could be enabled via "--enable-munmap".
82
83Borland Tools
84-------------
85[Rarely tested.]
86For Borland tools, use BCC_MAKEFILE. Note that
87Borland's compiler defaults to 1 byte alignment in structures (-a1),
88whereas Visual C++ appears to default to 8 byte alignment (/Zp8).
89The garbage collector in its default configuration EXPECTS AT
90LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST
91BE OVERRIDDEN. (In my opinion, it should usually be anyway.
92I expect that -a1 introduces major performance penalties on a
93486 or Pentium.) Note that this changes structure layouts. (As a last
94resort, gcconfig.h can be changed to allow 1 byte alignment. But
95this has significant negative performance implications.)
96The Makefile is set up to assume Borland 4.5. If you have another
97version, change the line near the top. By default, it does not
98require the assembler. If you do have the assembler, I recommend
99removing the -DUSE_GENERIC.
100
101Digital Mars compiler
102---------------------
103
104Same as MS Visual C++ but might require
105-DAO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE option to compile with the
106parallel marker enabled.
107
108Watcom compiler
109---------------
110
111Ivan V. Demakov's README for the Watcom port:
112
113The collector has been compiled with Watcom C 10.6 and 11.0.
114It runs under win32, win32s, and even under msdos with dos4gw
115dos-extender. It should also run under OS/2, though this isn't
116tested. Under win32 the collector can be built either as dll
117or as static library.
118
119Note that all compilations were done under Windows 95 or NT.
120For unknown reason compiling under Windows 3.11 for NT (one
121attempt has been made) leads to broken executables.
122
123Incremental collection is not supported.
124
125cord is not ported.
126
127Before compiling you may need to edit WCC_MAKEFILE to set target
128platform, library type (dynamic or static), calling conventions, and
129optimization options.
130
131To compile the collector and testing programs use the command:
132 wmake -f WCC_MAKEFILE
133
134All programs using gc should be compiled with 4-byte alignment.
135For further explanations on this see comments about Borland.
136
137If the gc is compiled as dll, the macro "GC_DLL" should be defined before
138including "gc.h" (for example, with -DGC_DLL compiler option). It's
139important, otherwise resulting programs will not run.
140
141
142Special note for OpenWatcom users: the C (unlike the C++) compiler (of the
143latest stable release, not sure for older ones) doesn't force pointer global
144variables (i.e. not struct fields, not sure for locals) to be aligned unless
145optimizing for speed (e.g., "-ot" option is set); the "-zp" option (or align
146pragma) only controls alignment for structs; I don't know whether it's a bug or
147a feature (see an old report of same kind -
148http://bugzilla.openwatcom.org/show_bug.cgi?id=664), so You are warned.
149
150
151Incremental Collection
152----------------------
153There is some support for incremental collection. By default, the
154collector chooses between explicit page protection, and GetWriteWatch-based
155write tracking automatically, depending on the platform.
156
157The former is slow and interacts poorly with a debugger.
158Pages are protected. Protection faults are caught by a handler
159installed at the bottom of the handler
160stack. Whenever possible, I recommend adding a call to
161GC_enable_incremental at the last possible moment, after most
162debugging is complete. No system
163calls are wrapped by the collector itself. It may be necessary
164to wrap ReadFile calls that use a buffer in the heap, so that the
165call does not encounter a protection fault while it's running.
166(As usual, none of this is an issue unless GC_enable_incremental
167is called.)
168
169Note that incremental collection is disabled with -DSMALL_CONFIG.
170
171Threads
172-------
173
174This version of the collector by default handles threads similarly
175to other platforms. James Clark's code which tracks threads attached
176to the collector DLL still exists, but requires that both
177- the collector is built in a DLL with GC_DLL defined, and
178- GC_use_threads_discovery() is called before GC initialization, which
179 in turn must happen before creating additional threads.
180We generally recommend avoiding this if possible, since it seems to
181be less than 100% reliable.
182
183Use gc.mak (a.k.a NT_THREADS_MAKEFILE) instead of NT_MAKEFILE
184to build a version that supports both kinds of thread tracking.
185To build the garbage collector
186test with VC++ from the command line, use
187
188nmake /F ".\gc.mak" CFG="gctest - Win32 Release"
189
190This requires that the subdirectory gctest\Release exist.
191The test program and DLL will reside in the Release directory.
192
193This version currently supports incremental collection only if it is
194enabled before any additional threads are created.
195
196Since 6.3alpha2, threads are also better supported in static library builds
197with Microsoft tools (use NT_STATIC_THREADS_MAKEFILE) and with the GNU
198tools. The collector must be built with GC_THREADS defined.
199(NT_STATIC_THREADS_MAKEFILE does this implicitly. Under Cygwin,
200./configure --enable-threads=posix should be used.)
201
202For the normal, non-dll-based thread tracking to work properly,
203threads should be created with GC_CreateThread or GC_beginthreadex,
204and exit normally or call GC_endthreadex or GC_ExitThread. (For
205Cygwin, use standard pthread calls instead.) As in the pthread
206case, including gc.h will redefine CreateThread, _beginthreadex,
207_endthreadex, and ExitThread to call the GC_ versions instead.
208
209Note that, as usual, GC_CreateThread tends to introduce resource leaks
210that are avoided by GC_beginthreadex. There is currently no equivalent of
211_beginthread, and it should not be used.
212
213GC_INIT should be called from the main executable before other GC calls.
214
215We strongly advise against using the TerminateThread() win32 API call,
216especially with the garbage collector. Any use is likely to provoke a
217crash in the GC, since it makes it impossible for the collector to
218correctly track threads.
219
220To build the collector for MinGW pthreads-win32,
221use Makefile.direct and explicitly set
222GC_WIN32_PTHREADS (or pass --enable-threads=pthreads to configure).
223Use -DPTW32_STATIC_LIB for the static threads library.
224
README.win64
164-bit Windows on AMD64/Intel EM64T is somewhat supported in the 7.0
2and later release. A collector can be built with Microsoft Visual C++ 2005
3or with mingw-w64 gcc.
4More testing would clearly be helpful.
5
6NT_X64_STATIC_THREADS_MAKEFILE has been used in
7this environment. Copy this file to MAKEFILE, and then type "nmake"
8in a Visual C++ command line window to build the static library
9and the usual test programs. To verify that the collector is
10at least somewhat functional, run gctest.exe. This should create
11gctest.gc.log after a few seconds.
12
13This process is completely analogous to NT_STATIC_THREADS_MAKEFILE
14for the 32-bit version.
15
16A similar procedure using NT_X64_THREADS_MAKEFILE should be usable to
17build the dynamic library. Test_cpp.exe did not seem to run correctly this
18way. It seems that we're getting the wrong instances of operator new/delete
19in some cases. The C tests seemed OK.
20
21Note that currently a few warnings are still generated by default,
22and a number of others have been explicitly turned off in the makefile.
23
24VC++ note: to suppress warnings use -D_CRT_SECURE_NO_DEPRECATE.
25
26gcc note: -fno-strict-aliasing should be used if optimizing.
27