Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/bdwgc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Boehm <boehm@acm.org>2001-12-20 03:00:00 +0300
committerIvan Maidanski <ivmai@mail.ru>2014-05-17 18:35:28 +0400
commit7de81079b9de32ff34690b188e19f01a9406392d (patch)
tree1b1c3b257dccc3a61581408fafd88f42d22decd8
parentfeb609e10d4725bcf577c9d7f4bdc901465a6aaa (diff)
gc6.1alpha2 tarball importgc6_1alpha2
-rw-r--r--.cvsignore4
-rw-r--r--[-rwxr-xr-x]AmigaOS.c0
-rw-r--r--Makefile24
-rw-r--r--Makefile.am3
-rw-r--r--Makefile.direct24
-rw-r--r--Makefile.in4
-rw-r--r--alloc.c33
-rw-r--r--alpha_mach_dep.s2
-rw-r--r--backgraph.c447
-rw-r--r--base_lib1
-rw-r--r--[-rwxr-xr-x]config.guess0
-rw-r--r--[-rwxr-xr-x]config.sub0
-rw-r--r--[-rwxr-xr-x]configure166
-rw-r--r--configure.in9
-rw-r--r--dbg_mlc.c6
-rw-r--r--[-rwxr-xr-x]digimars.mak0
-rw-r--r--doc/README2
-rw-r--r--doc/README.changes24
-rw-r--r--doc/README.environment23
-rw-r--r--doc/README.ews480075
-rw-r--r--doc/README.win3213
-rw-r--r--doc/debugging.html2
-rw-r--r--finalize.c1
-rw-r--r--gcj_mlc.c32
-rw-r--r--include/gc_pthread_redirects.h4
-rw-r--r--include/leak_detector.h4
-rw-r--r--include/private/dbg_mlc.h53
-rw-r--r--include/private/gc_pmark.h3
-rw-r--r--include/private/gc_priv.h3
-rw-r--r--include/private/gcconfig.h78
-rw-r--r--include/private/solaris_threads.h4
-rw-r--r--[-rwxr-xr-x]install-sh0
-rw-r--r--linux_threads.c11
-rw-r--r--[-rwxr-xr-x]ltconfig0
-rw-r--r--mach_dep.c8
-rw-r--r--mark.c14
-rw-r--r--mark_rts.c33
-rw-r--r--misc.c6
-rw-r--r--[-rwxr-xr-x]mkinstalldirs0
-rw-r--r--os_dep.c27
-rw-r--r--[-rwxr-xr-x]powerpc_macosx_mach_dep.s0
-rw-r--r--solaris_pthreads.c2
-rw-r--r--solaris_threads.c11
-rw-r--r--tests/test.c12
-rw-r--r--version.h2
45 files changed, 997 insertions, 173 deletions
diff --git a/.cvsignore b/.cvsignore
new file mode 100644
index 00000000..290af1dd
--- /dev/null
+++ b/.cvsignore
@@ -0,0 +1,4 @@
+gctest
+if_mach
+if_not_there
+threadlibs
diff --git a/AmigaOS.c b/AmigaOS.c
index f4024a79..f4024a79 100755..100644
--- a/AmigaOS.c
+++ b/AmigaOS.c
diff --git a/Makefile b/Makefile
index 72dd4133..8e8ed254 100644
--- a/Makefile
+++ b/Makefile
@@ -146,8 +146,8 @@ HOSTCFLAGS=$(CFLAGS)
# Works for Solaris and Irix.
# -DUSE_MUNMAP causes memory to be returned to the OS under the right
# circumstances. This currently disables VM-based incremental collection.
-# This is currently experimental, and works only under some Unix and
-# Linux versions.
+# This is currently experimental, and works only under some Unix,
+# Linux and Windows versions.
# -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
# GC_scratch_alloc() to get stack memory.
# -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
@@ -219,6 +219,14 @@ HOSTCFLAGS=$(CFLAGS)
# These may otherwise alter its configuration, or turn off GC altogether.
# I don't know of a reason to disable this, except possibly if the
# resulting process runs as a privileged user?
+# -DUSE_GLOBAL_ALLOC. Win32 only. Use GlobalAlloc instead of
+# VirtualAlloc to allocate the heap. May be needed to work around
+# a Windows NT/2000 issue. Incompatible with USE_MUNMAP.
+# See README.win32 for details.
+# -DMAKE_BACK_GRAPH. Enable GC_PRINT_BACK_HEIGHT environment variable.
+# See README.environment for details. Experimental. Limited platform
+# support. Implies DBG_HDRS_ALL. All allocation should be done using
+# the debug interface.
# -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
# makes incremental collection easier. Was enabled by default until 6.0.
# Rarely used, to my knowledge.
@@ -229,9 +237,9 @@ AR= ar
RANLIB= ranlib
-OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o
-CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c
+CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
@@ -262,7 +270,7 @@ DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
doc/README.win32 doc/barrett_diagram doc/README \
doc/README.contributors doc/README.changes doc/gc.man \
doc/README.environment doc/tree.html doc/gcdescr.html \
- doc/README.autoconf doc/README.macros
+ doc/README.autoconf doc/README.macros doc/README.ews4800
TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
tests/leak_test.c tests/thread_leak_test.c
@@ -446,9 +454,9 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ul
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
- ./if_mach IA64 HPUX as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
- ./if_mach IA64 HPUX $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
- ./if_mach IA64 HPUX ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
+ ./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+ ./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
+ ./if_mach IA64 "" ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
diff --git a/Makefile.am b/Makefile.am
index c0883ade..2cefd822 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,7 +42,8 @@ libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c irix_threads.c \
linux_threads.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c \
obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
-solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c
+solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
+backgraph.c
# Include THREADLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
diff --git a/Makefile.direct b/Makefile.direct
index 72dd4133..8e8ed254 100644
--- a/Makefile.direct
+++ b/Makefile.direct
@@ -146,8 +146,8 @@ HOSTCFLAGS=$(CFLAGS)
# Works for Solaris and Irix.
# -DUSE_MUNMAP causes memory to be returned to the OS under the right
# circumstances. This currently disables VM-based incremental collection.
-# This is currently experimental, and works only under some Unix and
-# Linux versions.
+# This is currently experimental, and works only under some Unix,
+# Linux and Windows versions.
# -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
# GC_scratch_alloc() to get stack memory.
# -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
@@ -219,6 +219,14 @@ HOSTCFLAGS=$(CFLAGS)
# These may otherwise alter its configuration, or turn off GC altogether.
# I don't know of a reason to disable this, except possibly if the
# resulting process runs as a privileged user?
+# -DUSE_GLOBAL_ALLOC. Win32 only. Use GlobalAlloc instead of
+# VirtualAlloc to allocate the heap. May be needed to work around
+# a Windows NT/2000 issue. Incompatible with USE_MUNMAP.
+# See README.win32 for details.
+# -DMAKE_BACK_GRAPH. Enable GC_PRINT_BACK_HEIGHT environment variable.
+# See README.environment for details. Experimental. Limited platform
+# support. Implies DBG_HDRS_ALL. All allocation should be done using
+# the debug interface.
# -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
# makes incremental collection easier. Was enabled by default until 6.0.
# Rarely used, to my knowledge.
@@ -229,9 +237,9 @@ AR= ar
RANLIB= ranlib
-OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o
+OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o
-CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c
+CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
@@ -262,7 +270,7 @@ DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
doc/README.win32 doc/barrett_diagram doc/README \
doc/README.contributors doc/README.changes doc/gc.man \
doc/README.environment doc/tree.html doc/gcdescr.html \
- doc/README.autoconf doc/README.macros
+ doc/README.autoconf doc/README.macros doc/README.ews4800
TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
tests/leak_test.c tests/thread_leak_test.c
@@ -446,9 +454,9 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ul
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
- ./if_mach IA64 HPUX as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
- ./if_mach IA64 HPUX $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
- ./if_mach IA64 HPUX ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
+ ./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+ ./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
+ ./if_mach IA64 "" ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
mark_rts.o: $(srcdir)/mark_rts.c $(UTILS)
diff --git a/Makefile.in b/Makefile.in
index da1a642d..4215138d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -117,7 +117,7 @@ MULTICLEAN = true
toolexeclib_LTLIBRARIES = $(target_all)
EXTRA_LTLIBRARIES = libgc.la
-libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c irix_threads.c linux_threads.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c
+libgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.c irix_threads.c linux_threads.c malloc.c mallocx.c mark.c mark_rts.c misc.c new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c backgraph.c
# Include THREADLIBS here to ensure that the correct versions of
@@ -171,7 +171,7 @@ dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo gcj_mlc.lo headers.lo \
irix_threads.lo linux_threads.lo malloc.lo mallocx.lo mark.lo \
mark_rts.lo misc.lo new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo \
ptr_chck.lo real_malloc.lo reclaim.lo solaris_pthreads.lo \
-solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo
+solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo backgraph.lo
check_PROGRAMS = gctest$(EXEEXT)
gctest_DEPENDENCIES = ./libgc.la
gctest_LDFLAGS =
diff --git a/alloc.c b/alloc.c
index 7786b130..c187a035 100644
--- a/alloc.c
+++ b/alloc.c
@@ -78,7 +78,7 @@ char * GC_copyright[] =
{"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ",
"Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ",
"Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ",
-"Copyright (c) 1999-2000 by Hewlett-Packard Company. All rights reserved. ",
+"Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved. ",
"THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY",
" EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.",
"See source code for details." };
@@ -97,6 +97,8 @@ word GC_free_space_divisor = 3;
extern GC_bool GC_collection_in_progress();
/* Collection is in progress, or was abandoned. */
+extern GC_bool GC_print_back_height;
+
int GC_never_stop_func GC_PROTO((void)) { return(0); }
CLOCK_TYPE GC_start_time; /* Time at which we stopped world. */
@@ -434,7 +436,7 @@ GC_stop_func stop_func;
{
register int i;
int dummy;
-# ifdef PRINTTIMES
+# if defined(PRINTTIMES) || defined(CONDPRINT)
CLOCK_TYPE start_time, current_time;
# endif
@@ -442,6 +444,9 @@ GC_stop_func stop_func;
# ifdef PRINTTIMES
GET_TIME(start_time);
# endif
+# if defined(CONDPRINT) && !defined(PRINTTIMES)
+ if (GC_print_stats) GET_TIME(start_time);
+# endif
# ifdef CONDPRINT
if (GC_print_stats) {
GC_printf1("--> Marking for collection %lu ",
@@ -451,6 +456,11 @@ GC_stop_func stop_func;
(unsigned long) WORDS_TO_BYTES(GC_words_wasted));
}
# endif
+# ifdef MAKE_BACK_GRAPH
+ if (GC_print_back_height) {
+ GC_build_back_graph();
+ }
+# endif
/* Mark from all roots. */
/* Minimize junk left in my registers and on the stack */
@@ -504,6 +514,14 @@ GC_stop_func stop_func;
GET_TIME(current_time);
GC_printf1("World-stopped marking took %lu msecs\n",
MS_TIME_DIFF(current_time,start_time));
+# else
+# ifdef CONDPRINT
+ if (GC_print_stats) {
+ GET_TIME(current_time);
+ GC_printf1("World-stopped marking took %lu msecs\n",
+ MS_TIME_DIFF(current_time,start_time));
+ }
+# endif
# endif
START_WORLD();
return(TRUE);
@@ -610,6 +628,17 @@ void GC_finish_collection()
GET_TIME(finalize_time);
# endif
+ if (GC_print_back_height) {
+# ifdef MAKE_BACK_GRAPH
+ GC_traverse_back_graph();
+# else
+# ifndef SMALL_CONFIG
+ GC_err_printf0("Back height not available: "
+ "Rebuild collector with -DMAKE_BACK_GRAPH\n");
+# endif
+# endif
+ }
+
/* Clear free list mark bits, in case they got accidentally marked */
/* (or GC_find_leak is set and they were intentionally marked). */
/* Also subtract memory remaining from GC_mem_found count. */
diff --git a/alpha_mach_dep.s b/alpha_mach_dep.s
index 53547307..0421f744 100644
--- a/alpha_mach_dep.s
+++ b/alpha_mach_dep.s
@@ -1,4 +1,4 @@
- # $Id: alpha_mach_dep.s,v 1.2 1993/01/18 22:54:51 dosser Exp $
+ # $Id: alpha_mach_dep.s,v 1.4 2001/12/20 00:37:29 ukai Exp $
.arch ev6
.text
diff --git a/backgraph.c b/backgraph.c
new file mode 100644
index 00000000..01ab738f
--- /dev/null
+++ b/backgraph.c
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 2001 by Hewlett-Packard Company. All rights reserved.
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * 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 implements a full, though not well-tuned, representation of the
+ * backwards points-to graph. This is used to test for non-GC-robust
+ * data structures; the code is not used during normal garbage collection.
+ *
+ * One restriction is that we drop all back-edges from nodes with very
+ * high in-degree, and simply add them add them to a list of such
+ * nodes. They are then treated as permanent roots. Id this by itself
+ * doesn't introduce a space leak, then such nodes can't contribute to
+ * a growing space leak.
+ */
+
+#ifdef MAKE_BACK_GRAPH
+
+#define MAX_IN 10 /* Maximum in-degree we handle directly */
+
+#include "private/dbg_mlc.h"
+#include <unistd.h>
+
+#if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) || !defined(UNIX_LIKE)
+# error Configuration doesnt support MAKE_BACK_GRAPH
+#endif
+
+/* We store single back pointers directly in the object's oh_bg_ptr field. */
+/* If there is more than one ptr to an object, we store q | FLAG_MANY, */
+/* where q is a pointer to a back_edges object. */
+/* Every once in a while we use a back_edges object even for a single */
+/* pointer, since we need the other fields in the back_edges structure to */
+/* be present in some fraction of the objects. Otherwise we get serious */
+/* performance issues. */
+#define FLAG_MANY 2
+
+typedef struct back_edges_struct {
+ word n_edges; /* Number of edges, including those in continuation */
+ /* structures. */
+ unsigned short flags;
+# define RETAIN 1 /* Directly points to a reachable object; */
+ /* retain for next GC. */
+ unsigned short height_gc_no;
+ /* If height > 0, then the GC_gc_no value when it */
+ /* was computed. If it was computed this cycle, then */
+ /* it is current. If it was computed during the */
+ /* last cycle, then it represents the old height, */
+ /* which is only saved for live objects referenced by */
+ /* dead ones. This may grow due to refs from newly */
+ /* dead objects. */
+ signed_word height;
+ /* Longest path through unreachable nodes to this node */
+ /* that we found using depth first search. */
+
+# define HEIGHT_UNKNOWN ((signed_word)(-2))
+# define HEIGHT_IN_PROGRESS ((signed_word)(-1))
+ ptr_t edges[MAX_IN];
+ struct back_edges_struct *cont;
+ /* Pointer to continuation structure; we use only the */
+ /* edges field in the continuation. */
+ /* also used as free list link. */
+} back_edges;
+
+/* Allocate a new back edge structure. Should be more sophisticated */
+/* if this were production code. */
+#define MAX_BACK_EDGE_STRUCTS 100000
+static back_edges *back_edge_space = 0;
+int GC_n_back_edge_structs = 0; /* Serves as pointer to never used */
+ /* back_edges space. */
+static back_edges *avail_back_edges = 0;
+ /* Pointer to free list of deallocated */
+ /* back_edges structures. */
+
+static back_edges * new_back_edges(void)
+{
+ if (0 == back_edge_space) {
+ back_edge_space = (back_edges *)
+ sbrk(MAX_BACK_EDGE_STRUCTS*sizeof(back_edges));
+ }
+ if (0 != avail_back_edges) {
+ back_edges * result = avail_back_edges;
+ avail_back_edges = result -> cont;
+ result -> cont = 0;
+ return result;
+ }
+ if (GC_n_back_edge_structs >= MAX_BACK_EDGE_STRUCTS - 1) {
+ ABORT("needed too much space for back edges: adjust "
+ "MAX_BACK_EDGE_STRUCTS");
+ }
+ return back_edge_space + (GC_n_back_edge_structs++);
+}
+
+/* Deallocate p and its associated continuation structures. */
+static void deallocate_back_edges(back_edges *p)
+{
+ back_edges *last = p;
+
+ while (0 != last -> cont) last = last -> cont;
+ last -> cont = avail_back_edges;
+ avail_back_edges = p;
+}
+
+/* Table of objects that are currently on the depth-first search */
+/* stack. Only objects with in-degree one are in this table. */
+/* Other objects are identified using HEIGHT_IN_PROGRESS. */
+/* This data structure NEEDS IMPROVEMENT. */
+#define MAX_IN_PROGRESS 10000
+static ptr_t * in_progress_space = 0;
+static int n_in_progress = 0;
+
+static void push_in_progress(ptr_t p)
+{
+ if (in_progress_space == 0)
+ in_progress_space = sbrk(MAX_IN_PROGRESS * sizeof(ptr_t));
+ if (n_in_progress == MAX_IN_PROGRESS)
+ ABORT("Exceeded MAX_IN_PROGRESS");
+ in_progress_space[n_in_progress++] = p;
+}
+
+static GC_bool is_in_progress(ptr_t p)
+{
+ int i;
+ for (i = 0; i < n_in_progress; ++i) {
+ if (in_progress_space[i] == p) return TRUE;
+ }
+ return FALSE;
+}
+
+static void pop_in_progress(ptr_t p)
+{
+ --n_in_progress;
+ GC_ASSERT(in_progress_space[n_in_progress] == p);
+}
+
+#define GET_OH_BG_PTR(p) \
+ (ptr_t)REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr)
+#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr) = HIDE_POINTER(q)
+
+/* Execute s once for each predecessor q of p in the points-to graph. */
+/* s should be a bracketed statement. We declare q. */
+#define FOR_EACH_PRED(q, p, s) \
+ { \
+ ptr_t q = GET_OH_BG_PTR(p); \
+ if (!((word)q & FLAG_MANY)) { \
+ if (q && !((word)q & 1)) s \
+ /* !((word)q & 1) checks for a misnterpreted freelist link */ \
+ } else { \
+ back_edges *orig_be_ = (back_edges *)((word)q & ~FLAG_MANY); \
+ back_edges *be_ = orig_be_; \
+ int total_, local_; \
+ int n_edges_ = be_ -> n_edges; \
+ for (total_ = 0, local_ = 0; total_ < n_edges_; ++local_, ++total_) { \
+ if (local_ == MAX_IN) { \
+ be_ = be_ -> cont; \
+ local_ = 0; \
+ } \
+ q = be_ -> edges[local_]; s \
+ } \
+ } \
+ }
+
+/* Ensure that p has a back_edges structure associated with it. */
+static void ensure_struct(ptr_t p)
+{
+ ptr_t old_back_ptr = GET_OH_BG_PTR(p);
+
+ if (!((word)old_back_ptr & FLAG_MANY)) {
+ back_edges *be = new_back_edges();
+ be -> flags = 0;
+ if (0 == old_back_ptr) {
+ be -> n_edges = 0;
+ } else {
+ be -> n_edges = 1;
+ be -> edges[0] = old_back_ptr;
+ }
+ be -> height = HEIGHT_UNKNOWN;
+ be -> height_gc_no = GC_gc_no - 1;
+ GC_ASSERT(be >= back_edge_space);
+ SET_OH_BG_PTR(p, (word)be | FLAG_MANY);
+ }
+}
+
+/* Add the (forward) edge from p to q to the backward graph. Both p */
+/* q are pointers to the object base, i.e. pointers to an oh. */
+static void add_edge(ptr_t p, ptr_t q)
+{
+ ptr_t old_back_ptr = GET_OH_BG_PTR(q);
+ back_edges * be, *be_cont;
+ word i;
+ static unsigned random_number = 13;
+# define GOT_LUCKY_NUMBER (((++random_number) & 0x7f) == 0)
+ /* A not very random number we use to occasionally allocate a */
+ /* back_edges structure even for a single backward edge. This */
+ /* prevents us from repeatedly tracing back through very long */
+ /* chains, since we will have some place to store height and */
+ /* in_progress flags along the way. */
+
+ GC_ASSERT(p == GC_base(p) && q == GC_base(q));
+ if (!GC_HAS_DEBUG_INFO(q) || !GC_HAS_DEBUG_INFO(p)) {
+ /* This is really a misinterpreted free list link, since we saw */
+ /* a pointer to a free list. Dont overwrite it! */
+ return;
+ }
+ if (0 == old_back_ptr) {
+ SET_OH_BG_PTR(q, p);
+ if (GOT_LUCKY_NUMBER) ensure_struct(q);
+ return;
+ }
+ /* Check whether it was already in the list of predecessors. */
+ FOR_EACH_PRED(pred, q, { if (p == pred) return; });
+ ensure_struct(q);
+ old_back_ptr = GET_OH_BG_PTR(q);
+ be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY);
+ for (i = be -> n_edges, be_cont = be; i > MAX_IN;
+ be_cont = be_cont -> cont, i -= MAX_IN) {}
+ if (i == MAX_IN) {
+ be_cont -> cont = new_back_edges();
+ be_cont = be_cont -> cont;
+ i = 0;
+ }
+ be_cont -> edges[i] = p;
+ be -> n_edges++;
+ if (be -> n_edges == 100) {
+# if 0
+ if (GC_print_stats) {
+ GC_err_printf0("The following object has in-degree >= 100:\n");
+ GC_print_heap_obj(q);
+ }
+# endif
+ }
+}
+
+typedef void (*per_object_func)(ptr_t p, word n_words, word gc_descr);
+
+static void per_object_helper(struct hblk *h, word fn)
+{
+ hdr * hhdr = HDR(h);
+ word sz = hhdr -> hb_sz;
+ word descr = hhdr -> hb_descr;
+ per_object_func f = (per_object_func)fn;
+ int i = 0;
+
+ do {
+ f((ptr_t)(h -> hb_body + i), sz, descr);
+ i += sz;
+ } while (i + sz <= BYTES_TO_WORDS(HBLKSIZE));
+}
+
+void GC_apply_to_each_object(per_object_func f)
+{
+ GC_apply_to_all_blocks(per_object_helper, (word)f);
+}
+
+static void reset_back_edge(ptr_t p, word n_words, word gc_descr)
+{
+ /* Skip any free list links, or dropped blocks */
+ if (GC_HAS_DEBUG_INFO(p)) {
+ ptr_t old_back_ptr = GET_OH_BG_PTR(p);
+ if ((word)old_back_ptr & FLAG_MANY) {
+ back_edges *be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY);
+ if (!(be -> flags & RETAIN)) {
+ deallocate_back_edges(be);
+ SET_OH_BG_PTR(p, 0);
+ } else {
+ word *currentp;
+
+ GC_ASSERT(GC_is_marked(p));
+
+ /* Back edges may point to objects that will not be retained. */
+ /* Delete them for now, but remember the height. */
+ /* Some will be added back at next GC. */
+ be -> n_edges = 0;
+ if (0 != be -> cont) {
+ deallocate_back_edges(be -> cont);
+ be -> cont = 0;
+ }
+
+ GC_ASSERT(GC_is_marked(p));
+
+ /* We only retain things for one GC cycle at a time. */
+ be -> flags &= ~RETAIN;
+ }
+ } else /* Simple back pointer */ {
+ /* Clear to avoid dangling pointer. */
+ SET_OH_BG_PTR(p, 0);
+ }
+ }
+}
+
+static void add_back_edges(ptr_t p, word n_words, word gc_descr)
+{
+ word *currentp = (word *)(p + sizeof(oh));
+
+ /* For now, fix up non-length descriptors conservatively. */
+ if((gc_descr & GC_DS_TAGS) != GC_DS_LENGTH) {
+ gc_descr = WORDS_TO_BYTES(n_words);
+ }
+ while (currentp < (word *)(p + gc_descr)) {
+ word current = *currentp++;
+ if (current >= (word)GC_least_plausible_heap_addr &&
+ current <= (word)GC_greatest_plausible_heap_addr) {
+ ptr_t target = GC_base((GC_PTR)current);
+ if (0 != target) {
+ add_edge(p, target);
+ }
+ }
+ }
+}
+
+/* Rebuild the reprentation of the backward reachability graph. */
+/* Does not examine mark bits. Can be called before GC. */
+void GC_build_back_graph(void)
+{
+ GC_apply_to_each_object(add_back_edges);
+}
+
+/* Return an approximation to the length of the longest simple path */
+/* through unreachable objects to p. We refer to this as the height */
+/* of p. */
+static word backwards_height(ptr_t p)
+{
+ word result;
+ ptr_t back_ptr = GET_OH_BG_PTR(p);
+ back_edges *be;
+
+ if (0 == back_ptr) return 1;
+ if (!((word)back_ptr & FLAG_MANY)) {
+ if (is_in_progress(p)) return 0; /* DFS back edge, i.e. we followed */
+ /* an edge to an object already */
+ /* on our stack: ignore */
+ push_in_progress(p);
+ result = backwards_height(back_ptr)+1;
+ pop_in_progress(p);
+ return result;
+ }
+ be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
+ if (be -> height >= 0 && be -> height_gc_no == GC_gc_no)
+ return be -> height;
+ /* Ignore back edges in DFS */
+ if (be -> height == HEIGHT_IN_PROGRESS) return 0;
+ result = (be -> height > 0? be -> height : 1);
+ be -> height = HEIGHT_IN_PROGRESS;
+ FOR_EACH_PRED(q, p, {
+ word this_height;
+ if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) {
+ if (GC_print_stats)
+ GC_printf2("Found bogus pointer from 0x%lx to 0x%lx\n", q, p);
+ /* Reachable object "points to" unreachable one. */
+ /* Could be caused by our lax treatment of GC descriptors. */
+ this_height = 1;
+ } else {
+ this_height = backwards_height(q);
+ }
+ if (this_height >= result) result = this_height + 1;
+ });
+ be -> height = result;
+ be -> height_gc_no = GC_gc_no;
+ return result;
+}
+
+word GC_max_height;
+ptr_t GC_deepest_obj;
+
+/* Compute the maximum height of every unreachable predecessor p of a */
+/* reachable object. Arrange to save the heights of all such objects p */
+/* so that they can be used in calculating the height of objects in the */
+/* next GC. */
+/* Set GC_max_height to be the maximum height we encounter, and */
+/* GC_deepest_obj to be the corresponding object. */
+static void update_max_height(ptr_t p, word n_words, word gc_descr)
+{
+ if (GC_is_marked(p) && GC_HAS_DEBUG_INFO(p)) {
+ int i;
+ word p_height = 0;
+ ptr_t p_deepest_obj = 0;
+ ptr_t back_ptr;
+ back_edges *be = 0;
+
+ /* If we remembered a height last time, use it as a minimum. */
+ /* It may have increased due to newly unreachable chains pointing */
+ /* to p, but it can't have decreased. */
+ back_ptr = GET_OH_BG_PTR(p);
+ if (0 != back_ptr && ((word)back_ptr & FLAG_MANY)) {
+ be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
+ if (be -> height != HEIGHT_UNKNOWN) p_height = be -> height;
+ }
+ FOR_EACH_PRED(q, p, {
+ if (!GC_is_marked(q) && GC_HAS_DEBUG_INFO(q)) {
+ word q_height;
+
+ q_height = backwards_height(q);
+ if (q_height > p_height) {
+ p_height = q_height;
+ p_deepest_obj = q;
+ }
+ }
+ });
+ if (p_height > 0) {
+ /* Remember the height for next time. */
+ if (be == 0) {
+ ensure_struct(p);
+ back_ptr = GET_OH_BG_PTR(p);
+ be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
+ }
+ be -> flags |= RETAIN;
+ be -> height = p_height;
+ be -> height_gc_no = GC_gc_no;
+ }
+ if (p_height > GC_max_height) {
+ GC_max_height = p_height;
+ GC_deepest_obj = p_deepest_obj;
+ }
+ }
+}
+
+void GC_traverse_back_graph(void)
+{
+ static word max_max_height = 0;
+ GC_max_height = 0;
+ GC_apply_to_each_object(update_max_height);
+ GC_printf2("Maximum backwards height of reachable objects at GC %lu is %ld\n",
+ (unsigned long) GC_gc_no, GC_max_height);
+ if (GC_max_height > max_max_height) {
+ max_max_height = GC_max_height;
+ GC_printf0("The following unreachable object is last in a longest chain "
+ "of unreachable objects:\n");
+ GC_print_heap_obj(GC_deepest_obj);
+ }
+ if (GC_print_stats) {
+ GC_printf1("Needed max total of %ld back-edge structs\n",
+ GC_n_back_edge_structs);
+ }
+ GC_apply_to_each_object(reset_back_edge);
+ GC_deepest_obj = 0;
+}
+
+#endif /* MAKE_BACK_GRAPH */
diff --git a/base_lib b/base_lib
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/base_lib
@@ -0,0 +1 @@
+
diff --git a/config.guess b/config.guess
index e1b58717..e1b58717 100755..100644
--- a/config.guess
+++ b/config.guess
diff --git a/config.sub b/config.sub
index 28426bb8..28426bb8 100755..100644
--- a/config.sub
+++ b/config.sub
diff --git a/configure b/configure
index 602a5351..e90a8584 100755..100644
--- a/configure
+++ b/configure
@@ -41,6 +41,8 @@ ac_help="$ac_help
ac_help="$ac_help
--with-ecos enable runtime eCos target support"
ac_help="$ac_help
+ --enable-shared[=PKGS] build shared libraries [default=no]"
+ac_help="$ac_help
--enable-full-debug include full support for pointer backtracing etc."
# Initialize some variables set by options.
@@ -601,7 +603,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:605: checking host system type" >&5
+echo "configure:607: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -622,7 +624,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:626: checking target system type" >&5
+echo "configure:628: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -640,7 +642,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:644: checking build system type" >&5
+echo "configure:646: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -675,7 +677,7 @@ test "$host_alias" != "$target_alias" &&
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:679: checking for a BSD compatible install" >&5
+echo "configure:681: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -728,7 +730,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:732: checking whether build environment is sane" >&5
+echo "configure:734: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -785,7 +787,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:789: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:791: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -818,12 +820,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:822: checking for Cygwin environment" >&5
+echo "configure:824: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 827 "configure"
+#line 829 "configure"
#include "confdefs.h"
int main() {
@@ -834,7 +836,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
-if { (eval echo configure:838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:840: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@@ -851,19 +853,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:855: checking for mingw32 environment" >&5
+echo "configure:857: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 860 "configure"
+#line 862 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:869: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -951,7 +953,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:955: checking host system type" >&5
+echo "configure:957: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -972,7 +974,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:976: checking target system type" >&5
+echo "configure:978: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -990,7 +992,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:994: checking build system type" >&5
+echo "configure:996: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1026,7 +1028,7 @@ fi
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1030: checking for working aclocal" >&5
+echo "configure:1032: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1039,7 +1041,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1043: checking for working autoconf" >&5
+echo "configure:1045: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1052,7 +1054,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1056: checking for working automake" >&5
+echo "configure:1058: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1065,7 +1067,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1069: checking for working autoheader" >&5
+echo "configure:1071: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1078,7 +1080,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1082: checking for working makeinfo" >&5
+echo "configure:1084: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -1104,7 +1106,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1108: checking for $ac_word" >&5
+echo "configure:1110: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1134,7 +1136,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1138: checking for $ac_word" >&5
+echo "configure:1140: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1183,7 +1185,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1187: checking whether we are using GNU C" >&5
+echo "configure:1189: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1192,7 +1194,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1207,7 +1209,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1211: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1213: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1244,7 +1246,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1248: checking for $ac_word" >&5
+echo "configure:1250: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1277,7 +1279,7 @@ test -n "$CXX" || CXX="gcc"
test -z "$CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1281: checking whether we are using GNU C++" >&5
+echo "configure:1283: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1286,7 +1288,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1290: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1292: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1301,7 +1303,7 @@ if test $ac_cv_prog_gxx = yes; then
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1305: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1307: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1334,7 +1336,7 @@ fi
# NEWLIB_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1338: checking build system type" >&5
+echo "configure:1340: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -1355,7 +1357,7 @@ echo "$ac_t""$build" 1>&6
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1359: checking for $ac_word" >&5
+echo "configure:1361: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1387,7 +1389,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1391: checking for $ac_word" >&5
+echo "configure:1393: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1419,7 +1421,7 @@ fi
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1423: checking for $ac_word" >&5
+echo "configure:1425: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1451,7 +1453,7 @@ if test -n "$ac_tool_prefix"; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1455: checking for $ac_word" >&5
+echo "configure:1457: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1496,7 +1498,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1500: checking for a BSD compatible install" >&5
+echo "configure:1502: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1550,7 +1552,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1554: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1556: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -1588,7 +1590,7 @@ if false; then
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1592: checking for executable suffix" >&5
+echo "configure:1594: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1598,7 +1600,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1711,7 +1713,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1715: checking for $ac_word" >&5
+echo "configure:1717: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1750,7 +1752,7 @@ ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1754: checking for ld used by GCC" >&5
+echo "configure:1756: checking for ld used by GCC" >&5
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
@@ -1774,10 +1776,10 @@ echo "configure:1754: checking for ld used by GCC" >&5
esac
elif test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1778: checking for GNU ld" >&5
+echo "configure:1780: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1781: checking for non-GNU ld" >&5
+echo "configure:1783: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1812,7 +1814,7 @@ else
fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1816: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1818: checking if the linker ($LD) is GNU ld" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1828,7 +1830,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1832: checking for BSD-compatible nm" >&5
+echo "configure:1834: checking for BSD-compatible nm" >&5
if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1864,7 +1866,7 @@ NM="$ac_cv_path_NM"
echo "$ac_t""$NM" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1868: checking whether ln -s works" >&5
+echo "configure:1870: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1918,8 +1920,8 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 1922 "configure"' > conftest.$ac_ext
- if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ echo '#line 1924 "configure"' > conftest.$ac_ext
+ if { (eval echo configure:1925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
@@ -1940,19 +1942,19 @@ case "$lt_target" in
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:1944: checking whether the C compiler needs -belf" >&5
+echo "configure:1946: checking whether the C compiler needs -belf" >&5
if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1949 "configure"
+#line 1951 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
lt_cv_cc_needs_belf=yes
else
@@ -2068,7 +2070,7 @@ fi
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:2072: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:2074: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -2101,7 +2103,7 @@ if false; then
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:2105: checking for executable suffix" >&5
+echo "configure:2107: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2111,7 +2113,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:2115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -2134,14 +2136,14 @@ ac_exeext=$EXEEXT
fi
echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
-echo "configure:2138: checking for threads package to use" >&5
+echo "configure:2140: checking for threads package to use" >&5
# Check whether --enable-threads or --disable-threads was given.
if test "${enable_threads+set}" = set; then
enableval="$enable_threads"
THREADS=$enableval
else
echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:2145: checking for thread model used by GCC" >&5
+echo "configure:2147: checking for thread model used by GCC" >&5
THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
if test -z "$THREADS"; then
THREADS=no
@@ -2227,7 +2229,7 @@ EOF
*-*-freebsd*)
echo "configure: warning: "FreeBSD does not yet fully support threads with Boehm GC."" 1>&2
cat >> confdefs.h <<\EOF
-#define FREEBSD_THREADS 1
+#define GC_FREEBSD_THREADS 1
EOF
INCLUDES="$INCLUDES -pthread"
@@ -2261,7 +2263,7 @@ esac
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2265: checking for dlopen in -ldl" >&5
+echo "configure:2267: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2269,7 +2271,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2273 "configure"
+#line 2275 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2280,7 +2282,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:2284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2340,6 +2342,40 @@ case "$host" in
# alpha*-*-*)
# machdep="alpha_mach_dep.lo"
# ;;
+ i?86-*-solaris2.[89]*)
+ cat >> confdefs.h <<\EOF
+#define SOLARIS25_PROC_VDB_BUG_FIXED 1
+EOF
+
+ ;;
+ alpha-*-openbsd*)
+ if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
+ echo "configure: warning: OpenBSD/Alpha without dlopen(). Shared library support is disabled" 1>&2
+ # Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case "$enableval" in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=no
+fi
+
+ fi
+ ;;
mipstx39-*-elf*)
machdep="mips_ultrix_mach_dep.lo"
cat >> confdefs.h <<\EOF
@@ -2367,7 +2403,7 @@ EOF
EOF
;;
- ia64-*-hpux*)
+ ia64-*-*)
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
;;
esac
@@ -2461,7 +2497,17 @@ EOF
EOF
case $host in
+ ia64-*-linux* )
+ cat >> confdefs.h <<\EOF
+#define MAKE_BACK_GRAPH 1
+EOF
+
+ ;;
x86-*-linux* | i586-*-linux* | i686-*-linux* )
+ cat >> confdefs.h <<\EOF
+#define MAKE_BACK_GRAPH 1
+EOF
+
echo "configure: warning: "Client must not use -fomit-frame-pointer."" 1>&2
cat >> confdefs.h <<\EOF
#define SAVE_CALL_COUNT 8
diff --git a/configure.in b/configure.in
index fcc0c710..aef5ebe8 100644
--- a/configure.in
+++ b/configure.in
@@ -157,6 +157,9 @@ case "$host" in
# alpha*-*-*)
# machdep="alpha_mach_dep.lo"
# ;;
+ i?86-*-solaris2.[[89]]*)
+ AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
+ ;;
alpha-*-openbsd*)
if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
@@ -178,7 +181,7 @@ case "$host" in
sparc-sun-solaris2.3*)
AC_DEFINE(SUNOS53_SHARED_LIB)
;;
- ia64-*-hpux*)
+ ia64-*-*)
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
;;
esac
@@ -241,7 +244,11 @@ AC_ARG_ENABLE(full-debug,
AC_DEFINE(KEEP_BACK_PTRS)
AC_DEFINE(DBG_HDRS_ALL)
case $host in
+ ia64-*-linux* )
+ AC_DEFINE(MAKE_BACK_GRAPH)
+ ;;
x86-*-linux* | i586-*-linux* | i686-*-linux* )
+ AC_DEFINE(MAKE_BACK_GRAPH)
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
AC_DEFINE(SAVE_CALL_COUNT, 8)
;;
diff --git a/dbg_mlc.c b/dbg_mlc.c
index af55032f..57de3dab 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -246,6 +246,9 @@ word integer;
# ifdef KEEP_BACK_PTRS
((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
# endif
+# ifdef MAKE_BACK_GRAPH
+ ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0);
+# endif
((oh *)p) -> oh_string = string;
((oh *)p) -> oh_int = integer;
# ifndef SHORT_DBG_HDRS
@@ -275,6 +278,9 @@ word integer;
# ifdef KEEP_BACK_PTRS
((oh *)p) -> oh_back_ptr = HIDE_BACK_PTR(NOT_MARKED);
# endif
+# ifdef MAKE_BACK_GRAPH
+ ((oh *)p) -> oh_bg_ptr = HIDE_BACK_PTR((ptr_t)0);
+# endif
((oh *)p) -> oh_string = string;
((oh *)p) -> oh_int = integer;
# ifndef SHORT_DBG_HDRS
diff --git a/digimars.mak b/digimars.mak
index 9778feee..9778feee 100755..100644
--- a/digimars.mak
+++ b/digimars.mak
diff --git a/doc/README b/doc/README
index b161ccf4..702bdd04 100644
--- a/doc/README
+++ b/doc/README
@@ -27,7 +27,7 @@ are GPL'ed, but with an exception that should cover all uses in the
collector. (If you are concerned about such things, I recommend you look
at the notice in config.guess or ltmain.sh.)
-This is version 6.1alpha1 of a conservative garbage collector for C and C++.
+This is version 6.1alpha2 of a conservative garbage collector for C and C++.
You might find a more recent version of this at
diff --git a/doc/README.changes b/doc/README.changes
index 8c00e938..4478da7b 100644
--- a/doc/README.changes
+++ b/doc/README.changes
@@ -1413,6 +1413,30 @@ Since 6.0:
less common thread implementations, since some of the original code
didn't stand up to close scrutiny. Support for the next pthreads
implementation should be easier to add.
+Since 6.0alpha1:
+ - No longer wrap read by default in multithreaded applications. It was
+ pointed out on the libgcj list that this holds the allocation lock for
+ way too long if the read blocks. For now, reads into the heap are
+ broken with incremental collection. It's possible to turn this back on
+ if you make sure that read calls don't block (e.g. by calling select
+ first).
+ - Fix ifdef in Solaris_threads.h to refer to GC_SOLARIS_THREADS.
+ - Added check for environment variable GC_IGNORE_GCJ_INFO.
+ - Added printing of stop-the-world GC times if GC_PRINT_STATS environment
+ variable is set.
+ - The calloc definition in leak_detector.h was missing parentheses, and
+ realloc was missing a second argument to GC_REALLOC. (Thanks to Elrond.)
+ - Added GC_PRINT_BACK_HEIGHT environment variable and associated
+ code, mostly in the new file backgraph.c. See doc/README.environment.
+ - Added -DUSE_GLOBAL_ALLOC to work around a Windows NT issue. (Thanks to
+ Jonathan Clark.)
+ - Integrated port to NEC EWS4800 (MIPS-based workstation, with somewhat
+ different address-space layout). This may help for other machines with
+ holes in the data segment. (Thanks to Hironori Sakamoto.)
+ - Changed the order in which GC_push_roots and friends push things onto
+ the mark stack. GC_push_all calls need to come first, since we can't
+ necessarily recovere if thos overflow the mark stack. (Thanks to
+ Matthew Flatt for tracking down the problem.)
To do:
diff --git a/doc/README.environment b/doc/README.environment
index 5760342a..f540692a 100644
--- a/doc/README.environment
+++ b/doc/README.environment
@@ -1,5 +1,5 @@
The garbage collector looks at a number of environment variables which are
-the used to affect its operation. These are examined only on Un*x-like
+then used to affect its operation. These are examined only on Un*x-like
platforms.
GC_INITIAL_HEAP_SIZE=<bytes> - Initial heap size in bytes. May speed up
@@ -32,6 +32,27 @@ GC_NPROCS=<n> - Linux w/threads only. Explicitly sets the number of processors
GC_NO_BLACKLIST_WARNING - Prevents the collector from issuing
"Needed to allocate blacklisted block at ..." warnings.
+GC_IGNORE_GCJ_INFO - Ignore the type descriptors implicitly supplied by
+ GC_gcj_malloc and friends. This is useful for debugging
+ descriptor generation problems, and possibly for
+ temporarily working around such problems. It forces a
+ fully conservative scan of all heap objects except
+ those known to be pointerfree, and may thus have other
+ adverse effects.
+
+GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects
+ ending in a reachable one. If this number remains
+ bounded, then the program is "GC robust". This ensures
+ that a fixed number of misidentified pointers can only
+ result in a bounded space leak. This currently only
+ works if debugging allocation is used throughout.
+ It increases GC space and time requirements appreciably.
+ This feature is still somewhat experimental, and requires
+ that the collector have been built with MAKE_BACK_GRAPH
+ defined. For details, see Boehm, "Bounding Space Usage
+ of Conservative Garbage Collectors", POPL 2001, or
+ http://lib.hpl.hp.com/techpubs/2001/HPL-2001-251.html .
+
The following turn on runtime flags that are also program settable. Checked
only during initialization. We expect that they will usually be set through
other means, but this may help with debugging and testing:
diff --git a/doc/README.ews4800 b/doc/README.ews4800
new file mode 100644
index 00000000..bced2438
--- /dev/null
+++ b/doc/README.ews4800
@@ -0,0 +1,75 @@
+GC on EWS4800
+-------------
+
+1. About EWS4800
+ EWS4800 is 32bit/64bit workstation.
+
+ Vender: NEC Corporation
+ OS: UX/4800 R9.* - R13.* (SystemV R4.2)
+ CPU: R4000, R4400, R10000 (MIPS)
+
+2. Compiler
+
+ 32bit:
+ Use ANSI C compiler.
+ CC = /usr/abiccs/bin/cc
+
+ 64bit:
+ Use 64bit ANSI C compiler.
+ CC = /usr/ccs64/bin/cc
+ AR = /usr/ccs64/bin/ar
+
+3. ELF file format
+ *** Caution: The following infomation is empirical. ***
+
+ 32bit:
+ ELF file has an unique format. (See a.out(4) and end(3C).)
+
+ &_start
+ : text segment
+ &etext
+ DATASTART
+ : data segment (initialized)
+ &edata
+ DATASTART2
+ : data segment (uninitialized)
+ &end
+
+ Here, DATASTART and DATASTART2 are macros of GC, and are defined as
+ the following equations. (See include/private/gcconfig.h.)
+ The algorithm for DATASTART is similar with the function
+ GC_SysVGetDataStart() in os_dep.c.
+
+ DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff)
+
+ Dynamically linked:
+ DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff
+
+ Statically linked:
+ DATASTART2 = &edata
+
+ GC has to check addresses both between DATASTART and &edata, and
+ between DATASTART2 and &end. If a program accesses between &etext
+ and DATASTART, or between &edata and DATASTART2, the segmentation
+ error occurs and the program stops.
+
+ If a program is statically linked, there is not a gap between
+ &edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used
+ for the detection.
+
+ 64bit:
+ ELF file has a simple format. (See end(3C).)
+
+ _ftext
+ : text segment
+ _etext
+ _fdata = DATASTART
+ : data segment (initialized)
+ _edata
+ _fbss
+ : data segment (uninitialized)
+ _end = DATAEND
+
+--
+Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
diff --git a/doc/README.win32 b/doc/README.win32
index 417281da..b1a6ec59 100644
--- a/doc/README.win32
+++ b/doc/README.win32
@@ -1,8 +1,8 @@
The collector has at various times been compiled under Windows 95 & NT,
with the original Microsoft SDK, with Visual C++ 2.0, 4.0, and 6, with
-the GNU win32 environment, with Borland 4.5, and recently with
-Watcom C. It is likely that some of these have been broken in the
-meantime. Patches are appreciated.
+the GNU win32 environment, with Borland 4.5, with Watcom C, and recently
+with the Digital Mars compiler. It is likely that some of these have been
+broken in the meantime. Patches are appreciated.
It runs under both win32s and win32, but with different semantics.
Under win32, all writable pages outside of the heaps and stack are
@@ -45,6 +45,13 @@ window colors.)
In general -DREDIRECT_MALLOC is unlikely to work unless the
application is completely statically linked.
+The collector normally allocates memory from the OS with VirtualAlloc.
+This appears to cause problems under Windows NT and Windows 2000 (but
+not Windows 95/98) if the memory is later passed to CreateDIBitmap.
+To work around this problem, build the collector with -DUSE_GLOBAL_ALLOC.
+This is currently incompatible with -DUSE_MUNMAP. (Thanks to Jonathan
+Clark for tracking this down.)
+
For Microsoft development tools, rename NT_MAKEFILE as
MAKEFILE. (Make sure that the CPU environment variable is defined
to be i386.) In order to use the gc_cpp.h C++ interface, all
diff --git a/doc/debugging.html b/doc/debugging.html
index a186ff50..04773fa6 100644
--- a/doc/debugging.html
+++ b/doc/debugging.html
@@ -209,6 +209,8 @@ down the problem:
<OL>
<LI> If you are using the incremental collector try turning it off for
debugging.
+<LI> If you are using shared libraries, try linking statically. If that works,
+ensure that DYNAMIC_LOADING is defined on your platform.
<LI> Try to reproduce the problem with fully debuggable unoptimized code.
This will eliminate the last possibility, as well as making debugging easier.
<LI> Try replacing any suspect typed allocation and <TT>GC_malloc_atomic</tt>
diff --git a/finalize.c b/finalize.c
index d69ba6f1..a316010a 100644
--- a/finalize.c
+++ b/finalize.c
@@ -838,3 +838,4 @@ void GC_notify_or_invoke_finalizers GC_PROTO((void))
# endif
return(result);
}
+
diff --git a/gcj_mlc.c b/gcj_mlc.c
index 7e79521e..89f0d728 100644
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -54,6 +54,7 @@ ptr_t * GC_gcjdebugobjfreelist;
void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
{
register int i;
+ GC_bool ignore_gcj_info;
DCL_LOCK_STATE;
GC_init(); /* In case it's not already done. */
@@ -65,6 +66,12 @@ void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
return;
}
GC_gcj_malloc_initialized = TRUE;
+ ignore_gcj_info = (0 != GETENV("GC_IGNORE_GCJ_INFO"));
+# ifdef CONDPRINT
+ if (GC_print_stats && ignore_gcj_info) {
+ GC_printf0("Gcj-style type information is disabled!\n");
+ }
+# endif
GC_mark_procs[mp_index] = (GC_mark_proc)mp;
if (mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index");
/* Set up object kind gcj-style indirect descriptor. */
@@ -75,9 +82,17 @@ void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
GC_gcj_kind = GC_n_kinds++;
GC_obj_kinds[GC_gcj_kind].ok_freelist = GC_gcjobjfreelist;
GC_obj_kinds[GC_gcj_kind].ok_reclaim_list = 0;
- GC_obj_kinds[GC_gcj_kind].ok_descriptor =
- (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS)) | GC_DS_PER_OBJECT);
- GC_obj_kinds[GC_gcj_kind].ok_relocate_descr = FALSE;
+ if (ignore_gcj_info) {
+ /* Use a simple length-based descriptor, thus forcing a fully */
+ /* conservative scan. */
+ GC_obj_kinds[GC_gcj_kind].ok_descriptor = (0 | GC_DS_LENGTH);
+ GC_obj_kinds[GC_gcj_kind].ok_relocate_descr = TRUE;
+ } else {
+ GC_obj_kinds[GC_gcj_kind].ok_descriptor =
+ (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS))
+ | GC_DS_PER_OBJECT);
+ GC_obj_kinds[GC_gcj_kind].ok_relocate_descr = FALSE;
+ }
GC_obj_kinds[GC_gcj_kind].ok_init = TRUE;
/* Set up object kind for objects that require mark proc call. */
GC_gcjdebugobjfreelist = (ptr_t *)
@@ -88,9 +103,14 @@ void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
GC_gcj_debug_kind = GC_n_kinds++;
GC_obj_kinds[GC_gcj_debug_kind].ok_freelist = GC_gcjdebugobjfreelist;
GC_obj_kinds[GC_gcj_debug_kind].ok_reclaim_list = 0;
- GC_obj_kinds[GC_gcj_debug_kind].ok_descriptor =
- GC_MAKE_PROC(mp_index, 1 /* allocated with debug info */);
- GC_obj_kinds[GC_gcj_debug_kind].ok_relocate_descr = FALSE;
+ if (ignore_gcj_info) {
+ GC_obj_kinds[GC_gcj_kind].ok_descriptor = (0 | GC_DS_LENGTH);
+ GC_obj_kinds[GC_gcj_kind].ok_relocate_descr = TRUE;
+ } else {
+ GC_obj_kinds[GC_gcj_debug_kind].ok_descriptor =
+ GC_MAKE_PROC(mp_index, 1 /* allocated with debug info */);
+ GC_obj_kinds[GC_gcj_debug_kind].ok_relocate_descr = FALSE;
+ }
GC_obj_kinds[GC_gcj_debug_kind].ok_init = TRUE;
UNLOCK();
ENABLE_SIGNALS();
diff --git a/include/gc_pthread_redirects.h b/include/gc_pthread_redirects.h
index ac254a86..47284fbc 100644
--- a/include/gc_pthread_redirects.h
+++ b/include/gc_pthread_redirects.h
@@ -44,9 +44,7 @@
#endif /* SOLARIS_THREADS || SOLARIS_PTHREADS */
-#if !defined(GC_USE_LD_WRAP) && \
- (defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
- || defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS))
+#if !defined(GC_USE_LD_WRAP) && defined(GC_PTHREADS) && !defined(GC_SOLARIS_PTHREADS)
/* We treat these similarly. */
# include <pthread.h>
# include <signal.h>
diff --git a/include/leak_detector.h b/include/leak_detector.h
index 6786825a..0674ab4d 100644
--- a/include/leak_detector.h
+++ b/include/leak_detector.h
@@ -1,7 +1,7 @@
#define GC_DEBUG
#include "gc.h"
#define malloc(n) GC_MALLOC(n)
-#define calloc(m,n) GC_MALLOC(m*n)
+#define calloc(m,n) GC_MALLOC((m)*(n))
#define free(p) GC_FREE(p)
-#define realloc(p,n) GC_REALLOC(n)
+#define realloc(p,n) GC_REALLOC((p),(n))
#define CHECK_LEAKS() GC_gcollect()
diff --git a/include/private/dbg_mlc.h b/include/private/dbg_mlc.h
index 6f5b3c86..53788358 100644
--- a/include/private/dbg_mlc.h
+++ b/include/private/dbg_mlc.h
@@ -46,7 +46,8 @@
/* Stored both one past the end of user object, and one before */
/* the end of the object as seen by the allocator. */
-# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST)
+# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) \
+ || defined(MAKE_BACK_GRAPH)
/* Pointer "source"s that aren't real locations. */
/* Used in oh_back_ptr fields and as "source" */
/* argument to some marking functions. */
@@ -60,28 +61,42 @@
/* Object header */
typedef struct {
-# ifdef KEEP_BACK_PTRS
- GC_hidden_pointer oh_back_ptr;
- /* We make sure that we only store even valued */
- /* pointers here, so that the hidden version has */
- /* the least significant bit set. We never */
- /* overwrite a value with the least significant */
- /* bit clear, thus ensuring that we never overwrite */
- /* a free list link field. */
- /* Note that blocks dropped by black-listing will */
- /* also have the lsb clear once debugging has */
- /* started. */
- /* The following are special back pointer values. */
- /* Note that the "hidden" (i.e. bitwise */
- /* complemented version) of these is actually */
- /* stored. */
+# if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
+ /* We potentially keep two different kinds of back */
+ /* pointers. KEEP_BACK_PTRS stores a single back */
+ /* pointer in each reachable object to allow reporting */
+ /* of why an object was retained. MAKE_BACK_GRAPH */
+ /* builds a graph containing the inverse of all */
+ /* "points-to" edges including those involving */
+ /* objects that have just become unreachable. This */
+ /* allows detection of growing chains of unreachable */
+ /* objects. It may be possible to eventually combine */
+ /* both, but for now we keep them separate. Both */
+ /* kinds of back pointers are hidden using the */
+ /* following macros. In both cases, the plain version */
+ /* is constrained to have an least significant bit of 1,*/
+ /* to allow it to be distinguished from a free list */
+ /* link. This means the plain version must have an */
+ /* lsb of 0. */
+ /* Note that blocks dropped by black-listing will */
+ /* also have the lsb clear once debugging has */
+ /* started. */
+ /* We're careful never to overwrite a value with lsb 0. */
# if ALIGNMENT == 1
/* Fudge back pointer to be even. */
# define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p))
# else
# define HIDE_BACK_PTR(p) HIDE_POINTER(p)
# endif
-# ifdef ALIGN_DOUBLE
+
+# ifdef KEEP_BACK_PTRS
+ GC_hidden_pointer oh_back_ptr;
+# endif
+# ifdef MAKE_BACK_GRAPH
+ GC_hidden_pointer oh_bg_ptr;
+# endif
+# if defined(ALIGN_DOUBLE) && \
+ (defined(KEEP_BACK_PTRS) != defined(MAKE_BACK_GRAPH))
word oh_dummy;
# endif
# endif
@@ -139,9 +154,9 @@ typedef struct {
GC_bool GC_has_other_debug_info(/* p */);
#endif
-#ifdef KEEP_BACK_PTRS
+#if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
# define GC_HAS_DEBUG_INFO(p) \
- ((((oh *)p)->oh_back_ptr & 1) && GC_has_other_debug_info(p))
+ ((*((word *)p) & 1) && GC_has_other_debug_info(p))
#else
# define GC_HAS_DEBUG_INFO(p) GC_has_other_debug_info(p)
#endif
diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h
index cf707069..5936f2e8 100644
--- a/include/private/gc_pmark.h
+++ b/include/private/gc_pmark.h
@@ -136,7 +136,8 @@ extern mse * GC_mark_stack;
/* Set *new_hdr_p to corr. hdr. */
#ifdef __STDC__
# ifdef PRINT_BLACK_LIST
- ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p, word source);
+ ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p,
+ ptr_t source);
# else
ptr_t GC_find_start(ptr_t current, hdr *hhdr, hdr **new_hdr_p);
# endif
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index ad204e99..5ca02a61 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -396,7 +396,8 @@ struct hblk; /* See below. */
+ GC_page_size-1)
# else
# if defined(NEXT) || defined(MACOSX) || defined(DOS4GW) || \
- (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC))
+ (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
+ (defined(SUNOS5) && !defined(USE_MMAP))
# define GET_MEM(bytes) HBLKPTR((size_t) \
calloc(1, (size_t)bytes + GC_page_size) \
+ GC_page_size-1)
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 6f25d305..86020fc7 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -78,9 +78,12 @@
# endif
# define mach_type_known
# endif
-# if defined(mips) || defined(__mips)
+# if defined(mips) || defined(__mips) || defined(_mips)
# define MIPS
-# if !defined(LINUX)
+# if defined(nec_ews) || defined(_nec_ews)
+# define EWS4800
+# endif
+# if !defined(LINUX) && !defined(EWS4800)
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
# define ULTRIX
# else
@@ -726,8 +729,12 @@
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
-# ifndef USE_MMAP
+# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
# define USE_MMAP
+ /* Otherwise we now use calloc. Mmap may result in the */
+ /* heap interleaved with thread stacks, which can result in */
+ /* excessive blacklisting. Sbrk is unusable since it */
+ /* doesn't interact correctly with the system malloc. */
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
@@ -849,21 +856,29 @@
# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
- extern int etext, _start;
+ extern int _etext, _end;
extern char * GC_SysVGetDataStart();
-# define DATASTART GC_SysVGetDataStart(0x1000, &etext)
+# define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
+# define DATAEND (&_end)
/* # define STACKBOTTOM ((ptr_t)(&_start)) worked through 2.7, */
/* but reportedly breaks under 2.8. It appears that the stack */
/* base is a property of the executable, so this should not break */
/* old executables. */
/* HEURISTIC2 probably works, but this appears to be preferable. */
-# include <sys/vmparam.h>
+# include <sys/vm.h>
# define STACKBOTTOM USRSTACK
-/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
-/*# define PROC_VDB*/
+/* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
+/* It appears to be fixed in 2.8 and 2.9. */
+# ifdef SOLARIS25_PROC_VDB_BUG_FIXED
+# define PROC_VDB
+# endif
# define DYNAMIC_LOADING
-# ifndef USE_MMAP
+# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
# define USE_MMAP
+ /* Otherwise we now use calloc. Mmap may result in the */
+ /* heap interleaved with thread stacks, which can result in */
+ /* excessive blacklisting. Sbrk is unusable since it */
+ /* doesn't interact correctly with the system malloc. */
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
@@ -1014,11 +1029,17 @@
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
-# define MPROTECT_VDB
+# ifndef GC_FREEBSD_THREADS
+# define MPROTECT_VDB
+# endif
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
# endif
+ extern char etext;
+# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
@@ -1029,7 +1050,7 @@
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
-# if defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
+# if defined(OPENBSD) || defined(NETBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
@@ -1097,6 +1118,29 @@
/* instead. But some kernel versions seem to give the wrong */
/* value from /proc. */
# endif /* Linux */
+# ifdef EWS4800
+# define HEURISTIC2
+# if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
+ extern int _fdata[], _end[];
+# define DATASTART ((ptr_t)_fdata)
+# define DATAEND ((ptr_t)_end)
+# define CPP_WORDSZ _MIPS_SZPTR
+# define ALIGNMENT (_MIPS_SZPTR/8)
+# else
+ extern int etext, edata, end;
+ extern int _DYNAMIC_LINKING, _gp;
+# define DATASTART ((ptr_t)((((word)&etext + 0x3ffff) & ~0x3ffff) \
+ + ((word)&etext & 0xffff)))
+# define DATAEND (&edata)
+# define DATASTART2 (&_DYNAMIC_LINKING \
+ ? (ptr_t)(((word)&_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
+ : (ptr_t)&edata)
+# define DATAEND2 (&end)
+# define ALIGNMENT 4
+# endif
+# define OS_TYPE "EWS4800"
+# define USE_GENERIC_PUSH_REGS 1
+# endif
# ifdef ULTRIX
# define HEURISTIC2
# define DATASTART (ptr_t)0x10000000
@@ -1374,7 +1418,13 @@
# define BACKING_STORE_BASE ((ptr_t)GC_register_stackbottom)
# define SEARCH_FOR_DATA_START
# define DATASTART GC_data_start
-# define DYNAMIC_LOADING
+# ifdef __GNUC__
+# define DYNAMIC_LOADING
+# else
+ /* In the Intel compiler environment, we seem to end up with */
+ /* statically linked executables and an undefined reference */
+ /* to _DYNAMIC */
+# endif
# define MPROTECT_VDB
/* Requires Linux 2.3.47 or later. */
extern int _end;
@@ -1691,4 +1741,8 @@
/* include assembly code to do it well. */
# endif
+# if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
+# define DBG_HDRS_ALL
+# endif
+
# endif /* GCCONFIG_H */
diff --git a/include/private/solaris_threads.h b/include/private/solaris_threads.h
index b2cdb36e..1464bc14 100644
--- a/include/private/solaris_threads.h
+++ b/include/private/solaris_threads.h
@@ -1,4 +1,4 @@
-#ifdef SOLARIS_THREADS
+#ifdef GC_SOLARIS_THREADS
/* The set of all known threads. We intercept thread creation and */
/* joins. We never actually create detached threads. We allocate all */
@@ -30,5 +30,5 @@
extern size_t GC_page_sz;
extern void GC_thr_init(void);
-# endif /* SOLARIS_THREADS */
+# endif /* GC_SOLARIS_THREADS */
diff --git a/install-sh b/install-sh
index e9de2384..e9de2384 100755..100644
--- a/install-sh
+++ b/install-sh
diff --git a/linux_threads.c b/linux_threads.c
index 7958ed9b..b63dfb7f 100644
--- a/linux_threads.c
+++ b/linux_threads.c
@@ -1271,6 +1271,17 @@ int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
/* cant have been recycled by pthreads. */
UNLOCK();
result = REAL_FUNC(pthread_join)(thread, retval);
+# if defined (GC_FREEBSD_THREADS)
+ /* On FreeBSD, the wrapped pthread_join() sometimes returns (what
+ appears to be) a spurious EINTR which caused the test and real code
+ to gratuitously fail. Having looked at system pthread library source
+ code, I see how this return code may be generated. In one path of
+ code, pthread_join() just returns the errno setting of the thread
+ being joined. This does not match the POSIX specification or the
+ local man pages thus I have taken the liberty to catch this one
+ spurious return value properly conditionalized on GC_FREEBSD_THREADS. */
+ if (result == EINTR) result = 0;
+# endif
if (result == 0) {
LOCK();
/* Here the pthread thread id may have been recycled. */
diff --git a/ltconfig b/ltconfig
index a01334f9..a01334f9 100755..100644
--- a/ltconfig
+++ b/ltconfig
diff --git a/mach_dep.c b/mach_dep.c
index 35e9264b..b582db03 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -429,7 +429,7 @@ ptr_t cold_gc_frame;
*i = 0;
}
# if defined(POWERPC) || defined(MSWIN32) || defined(MSWINCE) \
- || defined(UTS4) || defined(LINUX)
+ || defined(UTS4) || defined(LINUX) || defined(EWS4800)
(void) setjmp(regs);
# else
(void) _setjmp(regs);
@@ -492,8 +492,10 @@ ptr_t cold_gc_frame;
/* On IA64, we also need to flush register windows. But they end */
/* up on the other side of the stack segment. */
/* Returns the backing store pointer for the register stack. */
-/* We implement this as a separate file in HP/UX. */
-# ifdef IA64
+/* We now implement this as a separate assembly file, since inline */
+/* assembly code here doesn't work with either the Intel or HP */
+/* compilers. */
+# if 0
# ifdef LINUX
asm(" .text");
asm(" .psr abi64");
diff --git a/mark.c b/mark.c
index 4d750479..70ba135f 100644
--- a/mark.c
+++ b/mark.c
@@ -838,7 +838,7 @@ long GC_markers = 2; /* Normally changed by thread-library- */
/* -specific code. */
/* Mark using the local mark stack until the global mark stack is empty */
-/* and ther are no active workers. Update GC_first_nonempty to reflect */
+/* and there are no active workers. Update GC_first_nonempty to reflect */
/* progress. */
/* Caller does not hold mark lock. */
/* Caller has already incremented GC_helper_count. We decrement it, */
@@ -918,7 +918,7 @@ void GC_mark_local(mse *local_mark_stack, int id)
return;
}
/* else there's something on the stack again, or */
- /* another help may push something. */
+ /* another helper may push something. */
GC_active_count++;
GC_ASSERT(GC_active_count > 0);
GC_release_mark_lock();
@@ -950,8 +950,10 @@ void GC_do_parallel_mark()
GC_acquire_mark_lock();
GC_ASSERT(I_HOLD_LOCK());
- GC_ASSERT(!GC_help_wanted);
- GC_ASSERT(GC_active_count == 0);
+ /* This could be a GC_ASSERT, but it seems safer to keep it on */
+ /* all the time, especially since it's cheap. */
+ if (GC_help_wanted || GC_active_count != 0 || GC_helper_count != 0)
+ ABORT("Tried to start parallel mark in bad state");
# ifdef PRINTSTATS
GC_printf1("Starting marking for mark phase number %lu\n",
(unsigned long)GC_mark_no);
@@ -1374,11 +1376,11 @@ ptr_t cold_gc_frame;
return;
}
# ifdef STACK_GROWS_DOWN
- GC_push_all_eager(bottom, cold_gc_frame);
GC_push_all(cold_gc_frame - sizeof(ptr_t), top);
+ GC_push_all_eager(bottom, cold_gc_frame);
# else /* STACK_GROWS_UP */
- GC_push_all_eager(cold_gc_frame, top);
GC_push_all(bottom, cold_gc_frame + sizeof(ptr_t));
+ GC_push_all_eager(cold_gc_frame, top);
# endif /* STACK_GROWS_UP */
} else {
GC_push_all_eager(bottom, top);
diff --git a/mark_rts.c b/mark_rts.c
index a082e2b2..628cba28 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -252,7 +252,7 @@ GC_bool tmp;
n_root_sets++;
}
-static roots_were_cleared = FALSE;
+static GC_bool roots_were_cleared = FALSE;
void GC_clear_roots GC_PROTO((void))
{
@@ -522,16 +522,6 @@ ptr_t cold_gc_frame;
register int i;
/*
- * push registers - i.e., call GC_push_one(r) for each
- * register contents r.
- */
-# ifdef USE_GENERIC_PUSH_REGS
- GC_generic_push_regs(cold_gc_frame);
-# else
- GC_push_regs(); /* usually defined in machine_dep.c */
-# endif
-
- /*
* Next push static data. This must happen early on, since it's
* not robust against mark stack overflow.
*/
@@ -564,19 +554,30 @@ ptr_t cold_gc_frame;
# endif
/*
- * Now traverse stacks.
+ * Now traverse stacks, and mark from register contents.
+ * These must be done last, since they can legitimately overflow
+ * the mark stack.
*/
-# if !defined(USE_GENERIC_PUSH_REGS)
+# ifdef USE_GENERIC_PUSH_REGS
+ GC_generic_push_regs(cold_gc_frame);
+ /* Also pushes stack, so that we catch callee-save registers */
+ /* saved inside the GC_push_regs frame. */
+# else
+ /*
+ * push registers - i.e., call GC_push_one(r) for each
+ * register contents r.
+ */
+ GC_push_regs(); /* usually defined in machine_dep.c */
GC_push_current_stack(cold_gc_frame);
/* In the threads case, this only pushes collector frames. */
- /* In the USE_GENERIC_PUSH_REGS case, this is done inside */
- /* GC_push_regs, so that we catch callee-save registers saved */
- /* inside the GC_push_regs frame. */
/* In the case of linux threads on IA64, the hot section of */
/* the main stack is marked here, but the register stack */
/* backing store is handled in the threads-specific code. */
# endif
if (GC_push_other_roots != 0) (*GC_push_other_roots)();
/* In the threads case, this also pushes thread stacks. */
+ /* Note that without interior pointer recognition lots */
+ /* of stuff may have been pushed already, and this */
+ /* should be careful about mark stack overflows. */
}
diff --git a/misc.c b/misc.c
index 2bb93f3d..2d516a71 100644
--- a/misc.c
+++ b/misc.c
@@ -1,6 +1,7 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
+ * Copyright (c) 1999-2001 by Hewlett-Packard Company. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
@@ -97,6 +98,8 @@ GC_bool GC_quiet = 0;
GC_bool GC_print_stats = 0;
+GC_bool GC_print_back_height = 0;
+
#ifdef FIND_LEAK
int GC_find_leak = 1;
#else
@@ -497,6 +500,9 @@ void GC_init_inner()
if (0 != GETENV("GC_DONT_GC")) {
GC_dont_gc = 1;
}
+ if (0 != GETENV("GC_PRINT_BACK_HEIGHT")) {
+ GC_print_back_height = 1;
+ }
# ifdef UNIX_LIKE
if (0 != GETENV("GC_LOOP_ON_ABORT")) {
GC_set_and_save_fault_handler(looping_handler);
diff --git a/mkinstalldirs b/mkinstalldirs
index cc8783ed..cc8783ed 100755..100644
--- a/mkinstalldirs
+++ b/mkinstalldirs
diff --git a/os_dep.c b/os_dep.c
index f8fee923..cfbd8377 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1091,6 +1091,9 @@ void GC_register_data_segments()
GC_add_roots_inner(DATASTART, (char *)sbrk(0), FALSE);
# else
GC_add_roots_inner(DATASTART, (char *)(DATAEND), FALSE);
+# if defined(DATASTART2)
+ GC_add_roots_inner(DATASTART2, (char *)(DATAEND2), FALSE);
+# endif
# endif
# endif
# if !defined(PCR) && (defined(NEXT) || defined(MACOSX))
@@ -1289,8 +1292,14 @@ void * os2_alloc(size_t bytes)
SYSTEM_INFO GC_sysinfo;
# endif
-
# ifdef MSWIN32
+
+# ifdef USE_GLOBAL_ALLOC
+# define GLOBAL_ALLOC_TEST 1
+# else
+# define GLOBAL_ALLOC_TEST GC_win32s
+# endif
+
word GC_n_heap_bases = 0;
ptr_t GC_win32_get_mem(bytes)
@@ -1298,7 +1307,7 @@ word bytes;
{
ptr_t result;
- if (GC_win32s) {
+ if (GLOBAL_ALLOC_TEST) {
/* VirtualAlloc doesn't like PAGE_EXECUTE_READWRITE. */
/* There are also unconfirmed rumors of other */
/* problems, so we dodge the issue. */
@@ -2537,11 +2546,15 @@ word len;
((ptr_t)end_block - (ptr_t)start_block) + HBLKSIZE);
}
-#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(GC_LINUX_THREADS) \
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(THREADS) \
&& !defined(GC_USE_LD_WRAP)
-/* Replacement for UNIX system call. */
-/* Other calls that write to the heap */
-/* should be handled similarly. */
+/* Replacement for UNIX system call. */
+/* Other calls that write to the heap should be handled similarly. */
+/* Note that this doesn't work well for blocking reads: It will hold */
+/* tha allocation lock for the entur duration of the call. Multithreaded */
+/* clients should really ensure that it won't block, either by setting */
+/* the descriptor nonblocking, or by calling select or poll first, to */
+/* make sure that input is available. */
# if defined(__STDC__) && !defined(SUNOS4)
# include <unistd.h>
# include <sys/uio.h>
@@ -2589,7 +2602,7 @@ word len;
}
#endif /* !MSWIN32 && !MSWINCE && !GC_LINUX_THREADS */
-#ifdef GC_USE_LD_WRAP
+#if defined(GC_USE_LD_WRAP) && !defined(THREADS)
/* We use the GNU ld call wrapping facility. */
/* This requires that the linker be invoked with "--wrap read". */
/* This can be done by passing -Wl,"--wrap read" to gcc. */
diff --git a/powerpc_macosx_mach_dep.s b/powerpc_macosx_mach_dep.s
index 92f06286..92f06286 100755..100644
--- a/powerpc_macosx_mach_dep.s
+++ b/powerpc_macosx_mach_dep.s
diff --git a/solaris_pthreads.c b/solaris_pthreads.c
index e00e00b3..a8b33f8d 100644
--- a/solaris_pthreads.c
+++ b/solaris_pthreads.c
@@ -16,7 +16,7 @@
* Modified Peter C. for Solaris Posix Threads.
*/
/* Boehm, September 14, 1994 4:44 pm PDT */
-/* $Id: solaris_pthreads.c,v 1.10 1997/05/13 23:09:09 peterc Exp $ */
+/* $Id: solaris_pthreads.c,v 1.4 2001/12/20 00:37:29 ukai Exp $ */
# if defined(GC_SOLARIS_PTHREADS)
# include "private/gc_priv.h"
diff --git a/solaris_threads.c b/solaris_threads.c
index 365c6b12..11b0e037 100644
--- a/solaris_threads.c
+++ b/solaris_threads.c
@@ -621,7 +621,18 @@ GC_thread GC_lookup_thread(thread_t id)
return(p);
}
+/* Solaris 2/Intel uses an initial stack size limit slightly bigger than the
+ SPARC default of 8 MB. Account for this to warn only if the user has
+ raised the limit beyond the default.
+
+ This is identical to DFLSSIZ defined in <sys/vm_machparam.h>. This file
+ is installed in /usr/platform/`uname -m`/include, which is not in the
+ default include directory list, so copy the definition here. */
+#ifdef I386
+# define MAX_ORIG_STACK_SIZE (8 * 1024 * 1024 + ((USRSTACK) & 0x3FFFFF))
+#else
# define MAX_ORIG_STACK_SIZE (8 * 1024 * 1024)
+#endif
word GC_get_orig_stack_size() {
struct rlimit rl;
diff --git a/tests/test.c b/tests/test.c
index 35cb1357..7cb4d0c7 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -20,7 +20,7 @@
# undef GC_BUILD
-#ifdef DBG_HDRS_ALL
+#if defined(DBG_HDRS_ALL) || defined(MAKE_BACK_GRAPH)
# define GC_DEBUG
#endif
@@ -1340,7 +1340,7 @@ void SetMinimumStack(long minSize)
# endif
GC_INIT(); /* Only needed if gc is dynamic library. */
(void) GC_set_warn_proc(warn_proc);
-# if defined(MPROTECT_VDB) || defined(PROC_VDB)
+# if (defined(MPROTECT_VDB) || defined(PROC_VDB)) && !defined(MAKE_BACK_GRAPH)
GC_enable_incremental();
(void) GC_printf0("Switched to incremental mode\n");
# if defined(MPROTECT_VDB)
@@ -1571,7 +1571,9 @@ main()
n_tests = 0;
GC_INIT(); /* Only needed if gc is dynamic library. */
- GC_enable_incremental();
+# ifndef MAKE_BACK_GRAPH
+ GC_enable_incremental();
+# endif
(void) GC_set_warn_proc(warn_proc);
if (thr_keycreate(&fl_key, GC_free) != 0) {
(void)GC_printf1("Key creation failed %lu\n", (unsigned long)code);
@@ -1624,11 +1626,11 @@ main()
}
# endif /* GC_HPUX_THREADS */
pthread_attr_init(&attr);
-# if defined(GC_IRIX_THREADS)
+# if defined(GC_IRIX_THREADS) || defined(GC_FREEBSD_THREADS)
pthread_attr_setstacksize(&attr, 1000000);
# endif
n_tests = 0;
-# if defined(MPROTECT_VDB) && !defined(PARALLEL_MARK) &&!defined(REDIRECT_MALLOC)
+# if defined(MPROTECT_VDB) && !defined(PARALLEL_MARK) &&!defined(REDIRECT_MALLOC) && !defined(MAKE_BACK_GRAPH)
GC_enable_incremental();
(void) GC_printf0("Switched to incremental mode\n");
(void) GC_printf0("Emulating dirty bits with mprotect/signals\n");
diff --git a/version.h b/version.h
index d4e69234..e4993797 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define GC_VERSION_MAJOR 6
#define GC_VERSION_MINOR 1
-#define GC_ALPHA_VERSION 1
+#define GC_ALPHA_VERSION 2
# define GC_NOT_ALPHA 0xff