summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 12:53:58 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 12:53:58 +0200
commit126a335d1a4b898a0ce69eadfe8ff02c26562f7b (patch)
tree6d7497e91c549106100481bf6bf143e4042be1de
parentacf2e57f2091522924a0064b318642253e2b2bac (diff)
gc4.10 tarball importgc4_10
-rw-r--r--EMX_MAKEFILE10
-rw-r--r--Makefile18
-rw-r--r--README39
-rw-r--r--README.debugging3
-rw-r--r--README.rs60006
-rw-r--r--alloc.c19
-rw-r--r--blacklst.c2
-rw-r--r--config.h18
-rw-r--r--cord/cordxtra.c9
-rw-r--r--cord/gc.h1
-rw-r--r--finalize.c15
-rw-r--r--gc.h1
-rw-r--r--gc.man25
-rw-r--r--gc_priv.h6
-rw-r--r--include/gc.h1
-rw-r--r--malloc.c6
-rw-r--r--misc.c2
-rw-r--r--os_dep.c8
-rw-r--r--pcr_interface.c6
19 files changed, 139 insertions, 56 deletions
diff --git a/EMX_MAKEFILE b/EMX_MAKEFILE
index 7eed701..c46a4ce 100644
--- a/EMX_MAKEFILE
+++ b/EMX_MAKEFILE
@@ -90,13 +90,13 @@ cords: $(CORD_OBJS) cord/cordtest.exe
cp $(srcdir)/cord/ec.h include/ec.h
cp $(srcdir)/cord/cord_pos.h include/cord_pos.h
-gc_c++.o: $(srcdir)/gc_c++.cc $(srcdir)/gc_c++.h
- $(CXX) -c -O $(srcdir)/gc_c++.cc
+gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h
+ $(CXX) -c -O $(srcdir)/gc_cpp.cc
-c++: gc_c++.o $(srcdir)/gc_c++.h
- $(AR) ru gc.a gc_c++.o
+c++: gc_cpp.o $(srcdir)/gc_cpp.h
+ $(AR) ru gc.a gc_cpp.o
$(RANLIB) gc.a
- cp $(srcdir)/gc_c++.h include/gc_c++.h
+ cp $(srcdir)/gc_cpp.h include/gc_cpp.h
mach_dep.o: $(srcdir)/mach_dep.c
$(CC) -o mach_dep.o -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
diff --git a/Makefile b/Makefile
index 5ba9978..4e9eff3 100644
--- a/Makefile
+++ b/Makefile
@@ -13,12 +13,7 @@ AS=as
# The above doesn't work with gas, which doesn't run cpp.
# Define AS as `gcc -c -x assembler-with-cpp' instead.
-CFLAGS= -O -DNO_SIGNALS -DSILENT -DALL_INTERIOR_POINTERS
-
-LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
- -DREDIRECT_MALLOC=GC_malloc_uncollectable \
- -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
-# Flags for building libgc.a -- the last two are required.
+CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
@@ -68,6 +63,11 @@ LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
# -DNO_DEBUG removes GC_dump and the debugging routines it calls.
# Reduces code size slightly at the expense of debuggability.
+LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
+ -DREDIRECT_MALLOC=GC_malloc_uncollectable \
+ -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
+# Flags for building libgc.a -- the last two are required.
+
CXXFLAGS= $(CFLAGS)
AR= ar
RANLIB= ranlib
@@ -98,7 +98,8 @@ OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
SCoptions.amiga README.amiga README.win32 cord/README \
cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
include/ec.h include/private/cord_pos.h include/private/config.h \
- include/private/gc_hdrs.h include/private/gc_priv.h include/gc_cpp.h \
+ include/private/gc_hdrs.h include/private/gc_priv.h \
+ include/gc_cpp.h README.rs6000 \
include/weakpointer.h README.QUICK callprocs pc_excludes \
barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
@@ -204,7 +205,8 @@ mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there
rm -f mark_rts.o
-./if_mach ALPHA "" $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
-# work-around for DEC optimizer tail recursion elimination bug
+# Work-around for DEC optimizer tail recursion elimination bug.
+# The ALPHA-specific line should be removed if gcc is used.
cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c
diff --git a/README b/README
index 663e899..eafbf46 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
-This is version 4.8 of a conservative garbage collector for C and C++.
+This is version 4.10 of a conservative garbage collector for C and C++.
HISTORY -
@@ -448,7 +448,7 @@ result in arrays allocated using the default new operator.
This is likely to result in disaster without linker warnings.
3. If your compiler supports an overloaded new[] operator,
-then gc_c++.cc and gc_c++.h should be suitably modified.
+then gc_cpp.cc and gc_cpp.h should be suitably modified.
4. Many current C++ compilers have deficiencies that
break some of the functionality. See the comments in gc_cpp.h
@@ -900,7 +900,7 @@ Since version 4.2:
- Fixed SPARC alignment problem with GC_DEBUG.
- Fixed Solaris threads /proc workaround. The real
problem was an interaction with mprotect.
-- Incorporated fix from Patrick Beard for gc_c++.h.
+- Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h).
- Slightly improved allocator space utilization by
fixing the GC_size_map mechanism.
- Integrated some Sony News and MIPS RISCos 4.51
@@ -955,8 +955,9 @@ Since version 4.2:
<chime@proinf.dk>.)
- John Ellis' additions to the C++ support: From John:
-* I completely rewrote the documentation in the interface gc_c++.h.
-I've tried to make it both clearer and more precise.
+* I completely rewrote the documentation in the interface gc_c++.h
+(later renamed gc_cpp.h). I've tried to make it both clearer and more
+precise.
* The definition of accessibility now ignores pointers from an
finalizable object (an object with a clean-up function) to itself.
@@ -974,8 +975,9 @@ don't yet support operator new[], it is conditionalized on
-DOPERATOR_NEW_ARRAY. The code is untested, but its trivial and looks
correct.
-* The test program test_gc_c++ tries to test for the C++-specific
-functionality not tested by the other programs.
+* The test program test_gc_c++ (later renamed test_cpp.cc)
+tries to test for the C++-specific functionality not tested by the
+other programs.
- Added <unistd.h> include to misc.c. (Needed for ppcr.)
- Added PowerMac port. (Thanks to Patrick Beard again.)
- Fixed "srcdir"-related Makefile problems. Changed things so
@@ -1133,3 +1135,26 @@ Since version 4.6:
Since version 4.7:
- Changed a "comment" in a MacOS specific part of mach-dep.c that caused
gcc to fail on other platforms.
+
+Since version 4.8
+ - More README.debugging fixes.
+ - Objects ready for finalization, but not finalized in the same GC
+ cycle, could be prematurely collected. This occasionally happened
+ in test_cpp.
+ - Too little memory was obtained from the system for very large
+ objects. That could cause a heap explosion if these objects were
+ not contiguous (e.g. under PCR), and too much of them was blacklisted.
+ - Due to an improper initialization, the collector was too hesitant to
+ allocate blacklisted objects immediately after system startup.
+ - Moved GC_arrays from the data into the bss segment by not explicitly
+ initializing it to zero. This significantly
+ reduces the size of executables, and probably avoids some disk accesses
+ on program startup. It's conceivable that it might break a port that I
+ didn't test.
+ - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which
+ occurred a while ago.
+
+Since 4.9:
+ - Fixed a typo around a call to GC_collect_or_expand in alloc.c. It broke
+ handling of out of memory. (Thanks to Patrick Beard for noticing.)
+
diff --git a/README.debugging b/README.debugging
index bd8dc45..80635c2 100644
--- a/README.debugging
+++ b/README.debugging
@@ -1,5 +1,8 @@
Debugging suggestions:
+****If you get a segmentation fault or bus error while debugging with a debugger:
+If the fault occurred in GC_find_limit, or with incremental collection enabled, this is probably normal. The collector installs handlers to take care of these. You will not see these unless you are using a debugger. Your debugger should allow you to continue. It's preferable to tell the debugger to ignore SIGBUS and SIGSEGV ("handle" in gdb, "ignore" in most versions of dbx) and set a breakpoint in abort. The collector will call abort if the signal had another cause, and there was not other handler previously installed. I recommend debugging without incremental collection if possible. (This applies directly to UNIX systems. Debugging with incremental collection under win32 is worse. See README.win32.)
+
****If you get warning messages informing you that the collector needed to allocate blacklisted blocks:
0) Ignore these warnings while you are using GC_DEBUG. Some of the routines mentioned below don't have debugging equivalents. (Alternatively, write the missing routines and send them to me.)
diff --git a/README.rs6000 b/README.rs6000
new file mode 100644
index 0000000..0444ac4
--- /dev/null
+++ b/README.rs6000
@@ -0,0 +1,6 @@
+We have so far failed to find a good way to determine the stack base.
+It is highly recommended that GC_stackbottom be set explicitly on program
+startup. The supplied value sometimes causes failure under AIX 4.1, though
+it appears to work under 3.X. HEURISTIC2 seems to work under 4.1, but
+involves a substantial performance penalty, and will fail if there is
+no limit on stack size.
diff --git a/alloc.c b/alloc.c
index 7da237d..546dd3b 100644
--- a/alloc.c
+++ b/alloc.c
@@ -12,7 +12,7 @@
* modified is included with the above copyright notice.
*
*/
-/* Boehm, October 9, 1995 1:03 pm PDT */
+/* Boehm, February 7, 1996 4:37 pm PST */
# include "gc_priv.h"
@@ -702,8 +702,9 @@ word n;
return(result);
}
-bool GC_collect_or_expand(needed_blocks)
+bool GC_collect_or_expand(needed_blocks, ignore_off_page)
word needed_blocks;
+bool ignore_off_page;
{
static int count = 0; /* How many failures? */
@@ -714,8 +715,16 @@ word needed_blocks;
+ needed_blocks;
if (blocks_to_get > MAXHINCR) {
- if (needed_blocks > MAXHINCR) {
- blocks_to_get = needed_blocks;
+ word slop;
+
+ if (ignore_off_page) {
+ slop = 4;
+ } else {
+ slop = 2*divHBLKSZ(BL_LIMIT);
+ if (slop > needed_blocks) slop = needed_blocks;
+ }
+ if (needed_blocks + slop > MAXHINCR) {
+ blocks_to_get = needed_blocks + slop;
} else {
blocks_to_get = MAXHINCR;
}
@@ -763,7 +772,7 @@ int kind;
GC_new_hblk(sz, kind);
}
if (*flh == 0) {
- if (!GC_collect_or_expand((word)1)) return(0);
+ if (!GC_collect_or_expand((word)1,FALSE)) return(0);
}
}
diff --git a/blacklst.c b/blacklst.c
index f4f7069..7b27993 100644
--- a/blacklst.c
+++ b/blacklst.c
@@ -48,7 +48,7 @@ word * GC_incomplete_stack_bl;
word GC_total_black_listed;
-word GC_black_list_spacing = 10000000;
+word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* Initial rough guess */
void GC_clear_bl();
diff --git a/config.h b/config.h
index 62492c3..58d625e 100644
--- a/config.h
+++ b/config.h
@@ -11,7 +11,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, October 3, 1995 6:39 pm PDT */
+/* Boehm, December 7, 1995 10:03 am PST */
#ifndef CONFIG_H
@@ -581,6 +581,9 @@
# define ALIGNMENT 4
# define DATASTART ((ptr_t)0x20000000)
# define STACKBOTTOM ((ptr_t)0x2ff80000)
+ /* This is known to break under 4.X, under some circumstances. */
+ /* But there doesn't seem to be a good alternative. Set */
+ /* GC_stackbottom manually. */
# endif
# ifdef HP_PA
@@ -588,7 +591,18 @@
# define ALIGNMENT 4
extern int __data_start;
# define DATASTART ((ptr_t)(&__data_start))
-# define HEURISTIC2
+# if 0
+ /* The following appears to work for 7xx systems running HP/UX */
+ /* 9.xx Furthermore, it might result in much faster */
+ /* collections than HEURISTIC2, which may involve scanning */
+ /* segments that directly precede the stack. It is not the */
+ /* default, since it may not work on older machine/OS */
+ /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
+ /* this.) */
+# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
+# else
+# define HEURISTIC2
+# endif
# define STACK_GROWS_UP
# endif
diff --git a/cord/cordxtra.c b/cord/cordxtra.c
index 0e4a478..a1c522f 100644
--- a/cord/cordxtra.c
+++ b/cord/cordxtra.c
@@ -17,7 +17,7 @@
* implementation. They serve also serve as example client code for
* cord_basics.
*/
-/* Boehm, October 3, 1994 5:10 pm PDT */
+/* Boehm, December 8, 1995 1:53 pm PST */
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
@@ -223,12 +223,9 @@ int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len)
char * CORD_to_char_star(CORD x)
{
- register size_t len;
- char * result;
+ register size_t len = CORD_len(x);
+ char * result = (char *)GC_MALLOC_ATOMIC(len + 1);
- if (x == 0) return("");
- len = CORD_len(x);
- result = (char *)GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
CORD_fill_buf(x, 0, len, result);
result[len] = '\0';
diff --git a/cord/gc.h b/cord/gc.h
index ab7944e..0c7a282 100644
--- a/cord/gc.h
+++ b/cord/gc.h
@@ -429,6 +429,7 @@ extern GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
extern void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
+/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
extern GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
diff --git a/finalize.c b/finalize.c
index 5340e0f..7b416ff 100644
--- a/finalize.c
+++ b/finalize.c
@@ -1,6 +1,6 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
- * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -11,7 +11,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, September 22, 1995 5:49 pm PDT */
+/* Boehm, February 1, 1996 1:19 pm PST */
# define I_HIDE_POINTERS
# include "gc_priv.h"
# include "gc_mark.h"
@@ -56,6 +56,8 @@ static struct finalizable_object {
struct hash_chain_entry prolog;
# define fo_hidden_base prolog.hidden_key
/* Pointer to object base. */
+ /* No longer hidden once object */
+ /* is on finalize_now queue. */
# define fo_next(x) (struct finalizable_object *)((x) -> prolog.next)
# define fo_set_next(x,y) (x) -> prolog.next = (struct hash_chain_entry *)(y)
GC_finalization_proc fo_fn; /* Finalizer. */
@@ -545,6 +547,10 @@ void GC_finalize()
/* Add to list of objects awaiting finalization. */
fo_set_next(curr_fo, GC_finalize_now);
GC_finalize_now = curr_fo;
+ /* unhide object pointer so any future collections will */
+ /* see it. */
+ curr_fo -> fo_hidden_base =
+ (word) REVEAL_POINTER(curr_fo -> fo_hidden_base);
GC_words_finalized +=
ALIGNED_WORDS(curr_fo -> fo_object_size)
+ ALIGNED_WORDS(sizeof(struct finalizable_object));
@@ -588,7 +594,6 @@ void GC_finalize()
/* Should be called without allocation lock. */
void GC_invoke_finalizers()
{
- ptr_t real_ptr;
register struct finalizable_object * curr_fo;
DCL_LOCK_STATE;
@@ -607,8 +612,8 @@ void GC_invoke_finalizers()
GC_finalize_now = fo_next(curr_fo);
# endif
fo_set_next(curr_fo, 0);
- real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
- (*(curr_fo -> fo_fn))(real_ptr, curr_fo -> fo_client_data);
+ (*(curr_fo -> fo_fn))((ptr_t)(curr_fo -> fo_hidden_base),
+ curr_fo -> fo_client_data);
curr_fo -> fo_client_data = 0;
# ifdef UNDEFINED
/* This is probably a bad idea. It throws off accounting if */
diff --git a/gc.h b/gc.h
index ab7944e..0c7a282 100644
--- a/gc.h
+++ b/gc.h
@@ -429,6 +429,7 @@ extern GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
extern void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
+/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
extern GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
diff --git a/gc.man b/gc.man
index 73f8318..e90c6f1 100644
--- a/gc.man
+++ b/gc.man
@@ -1,6 +1,6 @@
.TH GC_MALLOC 1L "20 April 1994"
.SH NAME
-GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer \- Garbage collecting malloc replacement
+GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement
.SH SYNOPSIS
#include "gc.h"
.br
@@ -18,11 +18,13 @@ and
are plug-in replacements for standard malloc and free. However,
.I
GC_malloc
-will attempt to reclaim inaccessible space automaticaly by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by
+will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by
.I
GC_malloc
or friends.
.LP
+See the documentation in the include file gc_cpp.h for an alternate, C++ specific interface to the garbage collector.
+.LP
Unlike the standard implementations of malloc,
.I
GC_malloc
@@ -30,9 +32,10 @@ clears the newly allocated storage.
.I
GC_malloc_atomic
does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector.
+.LP
.I
GC_free
-can be used to deallocate objects, but its use is optional, and discouraged.
+can be used to deallocate objects, but its use is optional, and generally discouraged.
.I
GC_realloc
has the standard realloc semantics. It preserves pointer-free-ness.
@@ -40,8 +43,22 @@ has the standard realloc semantics. It preserves pointer-free-ness.
GC_register_finalizer
allows for registration of functions that are invoked when an object becomes inaccessible.
.LP
+The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning.
+.LP
+.I
+GC_malloc_ignore_off_page
+and
+.I
+GC_malloc_atomic_ignore_off_page
+inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.)
+.LP
It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed.
.LP
+The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with
+.I
+GC_set_warn_proc.
+This is recommended for production code. See gc.h for details.
+.LP
Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions.
.LP
On some machines, collection will be performed incrementally after a call to
@@ -49,7 +66,7 @@ On some machines, collection will be performed incrementally after a call to
GC_enable_incremental.
This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap.
.LP
-Other facilities not discussed here include a C++ interface, limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, etc.
+Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
.LP
.SH "SEE ALSO"
The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.)
diff --git a/gc_priv.h b/gc_priv.h
index 357a390..102e8ee 100644
--- a/gc_priv.h
+++ b/gc_priv.h
@@ -11,7 +11,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, August 9, 1995 5:49 pm PDT */
+/* Boehm, February 9, 1996 11:41 am PST */
# ifndef GC_PRIVATE_H
@@ -49,8 +49,10 @@ typedef GC_signed_word signed_word;
# include "gc_hdrs.h"
# endif
-# ifndef bool
+# if !defined(bool)
typedef int bool;
+ /* This is problematic with C++ implementations that define bool. */
+ /* But those usually treat it correctly as an empty declaration. */
# endif
# define TRUE 1
# define FALSE 0
diff --git a/include/gc.h b/include/gc.h
index ab7944e..0c7a282 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -429,6 +429,7 @@ extern GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
extern void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
+/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
extern GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
diff --git a/malloc.c b/malloc.c
index f6a9628..6fe84a7 100644
--- a/malloc.c
+++ b/malloc.c
@@ -11,7 +11,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, July 31, 1995 5:02 pm PDT */
+/* Boehm, February 7, 1996 4:32 pm PST */
#include <stdio.h>
#include "gc_priv.h"
@@ -94,7 +94,7 @@ register ptr_t *opp;
GC_collect_a_little_inner((int)n_blocks);
lw = ROUNDED_UP_WORDS(lb);
while ((h = GC_allochblk(lw, k, 0)) == 0
- && GC_collect_or_expand(n_blocks));
+ && GC_collect_or_expand(n_blocks, FALSE));
if (h == 0) {
op = 0;
} else {
@@ -129,7 +129,7 @@ register int k;
GC_collect_a_little_inner((int)n_blocks);
lw = ROUNDED_UP_WORDS(lb);
while ((h = GC_allochblk(lw, k, IGNORE_OFF_PAGE)) == 0
- && GC_collect_or_expand(n_blocks));
+ && GC_collect_or_expand(n_blocks, TRUE));
if (h == 0) {
op = 0;
} else {
diff --git a/misc.c b/misc.c
index 4dd68fa..03f316a 100644
--- a/misc.c
+++ b/misc.c
@@ -45,7 +45,7 @@
# endif
# endif
-GC_FAR struct _GC_arrays GC_arrays = { 0 };
+GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */;
bool GC_debugging_started = FALSE;
diff --git a/os_dep.c b/os_dep.c
index 5d5d186..183e9a0 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -10,7 +10,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, October 3, 1995 6:39 pm PDT */
+/* Boehm, February 7, 1996 11:09 am PST */
# include "gc_priv.h"
# ifdef LINUX
@@ -35,11 +35,11 @@
# define NEED_FIND_LIMIT
# endif
-# if defined(SUNOS4) & defined(DYNAMIC_LOADING)
+# if (defined(SUNOS4) & defined(DYNAMIC_LOADING)) && !defined(PCR)
# define NEED_FIND_LIMIT
# endif
-# if defined(SVR4) || defined(AUX) || defined(DGUX)
+# if (defined(SVR4) || defined(AUX) || defined(DGUX)) && !defined(PCR)
# define NEED_FIND_LIMIT
# endif
@@ -778,7 +778,7 @@ void GC_register_data_segments()
# else
-# if defined(SVR4) || defined(AUX) || defined(DGUX)
+# if (defined(SVR4) || defined(AUX) || defined(DGUX)) && !defined(PCR)
char * GC_SysVGetDataStart(max_page_size, etext_addr)
int max_page_size;
int * etext_addr;
diff --git a/pcr_interface.c b/pcr_interface.c
index f4a1178..12e3181 100644
--- a/pcr_interface.c
+++ b/pcr_interface.c
@@ -10,7 +10,7 @@
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
-/* Boehm, April 14, 1995 3:10 pm PDT */
+/* Boehm, February 7, 1996 11:09 am PST */
# include "gc_priv.h"
# ifdef PCR
@@ -113,9 +113,9 @@ PCR_ERes GC_EnumerateProc(
}
}
-void GC_DummyFreeProc(void *p) {};
+void GC_DummyFreeProc(void *p) {}
-void GC_DummyShutdownProc(void) {};
+void GC_DummyShutdownProc(void) {}
struct PCR_MM_ProcsRep GC_Rep = {
MY_MAGIC,