aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@gcc.gnu.org>2002-01-31 02:48:54 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2002-01-31 02:48:54 +0000
commit994e17d98544a4ebcf10b11f9d509cfd79b61b05 (patch)
tree7336ce6945c05c9ed84d21609156454d542b810c
parentf579fda4e062396634df291a1d12a45050b13e1f (diff)
Import GC 6.1alpha3
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/boehm@49361 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--boehm-gc/Makefile44
-rw-r--r--boehm-gc/Makefile.am3
-rw-r--r--boehm-gc/Makefile.direct44
-rw-r--r--boehm-gc/Makefile.in4
-rw-r--r--boehm-gc/allchblk.c9
-rw-r--r--boehm-gc/alloc.c47
-rwxr-xr-xboehm-gc/config.guess861
-rwxr-xr-xboehm-gc/configure170
-rw-r--r--boehm-gc/configure.in13
-rw-r--r--boehm-gc/dbg_mlc.c6
-rw-r--r--boehm-gc/doc/README2
-rw-r--r--boehm-gc/doc/README.changes55
-rw-r--r--boehm-gc/doc/README.environment43
-rw-r--r--boehm-gc/doc/README.win3213
-rw-r--r--boehm-gc/doc/debugging.html2
-rw-r--r--boehm-gc/dyn_load.c49
-rw-r--r--boehm-gc/finalize.c1
-rw-r--r--boehm-gc/gcj_mlc.c32
-rw-r--r--boehm-gc/include/gc.h24
-rw-r--r--boehm-gc/include/gc_pthread_redirects.h4
-rw-r--r--boehm-gc/include/leak_detector.h4
-rw-r--r--boehm-gc/include/private/dbg_mlc.h53
-rw-r--r--boehm-gc/include/private/gc_pmark.h3
-rw-r--r--boehm-gc/include/private/gc_priv.h38
-rw-r--r--boehm-gc/include/private/gcconfig.h150
-rw-r--r--boehm-gc/include/private/solaris_threads.h4
-rw-r--r--boehm-gc/irix_threads.c15
-rw-r--r--boehm-gc/linux_threads.c11
-rw-r--r--boehm-gc/mach_dep.c8
-rw-r--r--boehm-gc/malloc.c14
-rw-r--r--boehm-gc/mark.c14
-rw-r--r--boehm-gc/mark_rts.c33
-rw-r--r--boehm-gc/misc.c125
-rw-r--r--boehm-gc/os_dep.c201
-rw-r--r--boehm-gc/reclaim.c10
-rw-r--r--boehm-gc/solaris_pthreads.c4
-rw-r--r--boehm-gc/solaris_threads.c42
-rw-r--r--boehm-gc/tests/test.c12
-rw-r--r--boehm-gc/threadlibs.c4
-rw-r--r--boehm-gc/version.h2
40 files changed, 1506 insertions, 667 deletions
diff --git a/boehm-gc/Makefile b/boehm-gc/Makefile
index 72dd4133222..84a7dd3d63e 100644
--- a/boehm-gc/Makefile
+++ b/boehm-gc/Makefile
@@ -103,9 +103,9 @@ HOSTCFLAGS=$(CFLAGS)
# See gc_cpp.h for details. No effect on the C part of the collector.
# This is defined implicitly in a few environments. Must also be defined
# by clients that use gc_cpp.h.
-# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
-# as aliases for X, GC_realloc, and GC_free, respectively.
-# Calloc is redefined in terms of the new malloc. X should
+# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be
+# defined as aliases for X, GC_realloc, and GC_free, respectively.
+# Calloc and strdup are redefined in terms of the new malloc. X should
# be either GC_malloc or GC_malloc_uncollectable, or
# GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
# with dummy source location information, but still results in
@@ -114,7 +114,9 @@ HOSTCFLAGS=$(CFLAGS)
# you don't want to (or can't) look at. It may not work for
# existing code, but it often does. Neither works on all platforms,
# since some ports use malloc or calloc to obtain system memory.
-# (Probably works for UNIX, and win32.)
+# (Probably works for UNIX, and win32.) If you build with DBG_HDRS_ALL,
+# you should only use GC_debug_malloc_replacement as a malloc
+# replacement.
# -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
# The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
# together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
@@ -146,8 +148,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
@@ -183,8 +185,12 @@ HOSTCFLAGS=$(CFLAGS)
# allocated through the debugging interface. Affects the amount of
# information generated in leak reports. Only matters on platforms
# on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
-# and Solaris/SPARC. Turns on call chain saving on X86. On X86, client
+# and Solaris/SPARC and platforms that provide execinfo.h.
+# Default is zero. On X86, client
# code should NOT be compiled with -fomit-frame-pointer.
+# -DSAVE_CALL_NARGS=<n> Set the number of functions arguments to be
+# saved with each call frame. Default is zero. Ignored if we
+# don't know how to retrieve arguments on the platform.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# Use only for debugging of the incremental collector.
@@ -219,6 +225,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,16 +243,16 @@ 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
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
- sparc_mach_dep.s include/gc.h include/gc_typed.h \
+ sparc_mach_dep.S include/gc.h include/gc_typed.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/private/gcconfig.h include/private/gc_pmark.h \
include/gc_inl.h include/gc_inline.h include/gc_mark.h \
@@ -262,7 +276,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
@@ -442,13 +456,13 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ul
# ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
# Gcc on a 21264 can spill pointers to fp registers. Oops.
- ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
+ ./if_mach SPARC SUNOS5 $(CC) -c -o mach_dep.o $(srcdir)/sparc_mach_dep.S
./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/boehm-gc/Makefile.am b/boehm-gc/Makefile.am
index c0883ade025..2cefd822619 100644
--- a/boehm-gc/Makefile.am
+++ b/boehm-gc/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/boehm-gc/Makefile.direct b/boehm-gc/Makefile.direct
index 72dd4133222..84a7dd3d63e 100644
--- a/boehm-gc/Makefile.direct
+++ b/boehm-gc/Makefile.direct
@@ -103,9 +103,9 @@ HOSTCFLAGS=$(CFLAGS)
# See gc_cpp.h for details. No effect on the C part of the collector.
# This is defined implicitly in a few environments. Must also be defined
# by clients that use gc_cpp.h.
-# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
-# as aliases for X, GC_realloc, and GC_free, respectively.
-# Calloc is redefined in terms of the new malloc. X should
+# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be
+# defined as aliases for X, GC_realloc, and GC_free, respectively.
+# Calloc and strdup are redefined in terms of the new malloc. X should
# be either GC_malloc or GC_malloc_uncollectable, or
# GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
# with dummy source location information, but still results in
@@ -114,7 +114,9 @@ HOSTCFLAGS=$(CFLAGS)
# you don't want to (or can't) look at. It may not work for
# existing code, but it often does. Neither works on all platforms,
# since some ports use malloc or calloc to obtain system memory.
-# (Probably works for UNIX, and win32.)
+# (Probably works for UNIX, and win32.) If you build with DBG_HDRS_ALL,
+# you should only use GC_debug_malloc_replacement as a malloc
+# replacement.
# -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
# The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
# together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
@@ -146,8 +148,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
@@ -183,8 +185,12 @@ HOSTCFLAGS=$(CFLAGS)
# allocated through the debugging interface. Affects the amount of
# information generated in leak reports. Only matters on platforms
# on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
-# and Solaris/SPARC. Turns on call chain saving on X86. On X86, client
+# and Solaris/SPARC and platforms that provide execinfo.h.
+# Default is zero. On X86, client
# code should NOT be compiled with -fomit-frame-pointer.
+# -DSAVE_CALL_NARGS=<n> Set the number of functions arguments to be
+# saved with each call frame. Default is zero. Ignored if we
+# don't know how to retrieve arguments on the platform.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# Use only for debugging of the incremental collector.
@@ -219,6 +225,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,16 +243,16 @@ 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
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
- sparc_mach_dep.s include/gc.h include/gc_typed.h \
+ sparc_mach_dep.S include/gc.h include/gc_typed.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/private/gcconfig.h include/private/gc_pmark.h \
include/gc_inl.h include/gc_inline.h include/gc_mark.h \
@@ -262,7 +276,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
@@ -442,13 +456,13 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ul
# ./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
# alpha_mach_dep.s assumes that pointers are not saved in fp registers.
# Gcc on a 21264 can spill pointers to fp registers. Oops.
- ./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
+ ./if_mach SPARC SUNOS5 $(CC) -c -o mach_dep.o $(srcdir)/sparc_mach_dep.S
./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/boehm-gc/Makefile.in b/boehm-gc/Makefile.in
index da1a642d0eb..4215138dc74 100644
--- a/boehm-gc/Makefile.in
+++ b/boehm-gc/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/boehm-gc/allchblk.c b/boehm-gc/allchblk.c
index 06582ec792e..3da58c4ca0c 100644
--- a/boehm-gc/allchblk.c
+++ b/boehm-gc/allchblk.c
@@ -86,7 +86,6 @@ word blocks_needed;
}
-# define HBLK_IS_FREE(hdr) ((hdr) -> hb_map == GC_invalid_map)
# define PHDR(hhdr) HDR(hhdr -> hb_prev)
# define NHDR(hhdr) HDR(hhdr -> hb_next)
@@ -719,9 +718,6 @@ int n;
if (0 == hbp) return 0;
- /* Notify virtual dirty bit implementation that we are about to write. */
- GC_write_hint(hbp);
-
/* Add it to map of valid blocks */
if (!GC_install_counts(hbp, (word)size_needed)) return(0);
/* This leaks memory under very rare conditions. */
@@ -731,6 +727,11 @@ int n;
GC_remove_counts(hbp, (word)size_needed);
return(0); /* ditto */
}
+
+ /* Notify virtual dirty bit implementation that we are about to write. */
+ /* Ensure that pointerfree objects are not protected if it's avoidable. */
+ GC_remove_protection(hbp, divHBLKSZ(size_needed),
+ (hhdr -> hb_descr == 0) /* pointer-free */);
/* We just successfully allocated a block. Restart count of */
/* consecutive failures. */
diff --git a/boehm-gc/alloc.c b/boehm-gc/alloc.c
index 7786b13057b..6c663f04fb0 100644
--- a/boehm-gc/alloc.c
+++ b/boehm-gc/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,13 +97,17 @@ 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); }
+unsigned long GC_time_limit = TIME_LIMIT;
+
CLOCK_TYPE GC_start_time; /* Time at which we stopped world. */
/* used only in GC_timeout_stop_func. */
int GC_n_attempts = 0; /* Number of attempts at finishing */
- /* collection within TIME_LIMIT */
+ /* collection within GC_time_limit. */
#if defined(SMALL_CONFIG) || defined(NO_CLOCK)
# define GC_timeout_stop_func GC_never_stop_func
@@ -117,7 +121,7 @@ int GC_n_attempts = 0; /* Number of attempts at finishing */
if ((count++ & 3) != 0) return(0);
GET_TIME(current_time);
time_diff = MS_TIME_DIFF(current_time,GC_start_time);
- if (time_diff >= TIME_LIMIT) {
+ if (time_diff >= GC_time_limit) {
# ifdef CONDPRINT
if (GC_print_stats) {
GC_printf0("Abandoning stopped marking after ");
@@ -275,9 +279,10 @@ void GC_maybe_gc()
/* If we run out of time, this turns into */
/* incremental marking. */
# ifndef NO_CLOCK
- GET_TIME(GC_start_time);
+ if (GC_time_limit != GC_TIME_UNLIMITED) { GET_TIME(GC_start_time); }
# endif
- if (GC_stopped_mark(GC_timeout_stop_func)) {
+ if (GC_stopped_mark(GC_time_limit == GC_TIME_UNLIMITED?
+ GC_never_stop_func : GC_timeout_stop_func)) {
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
@@ -389,7 +394,8 @@ int n;
# ifdef PARALLEL_MARK
GC_wait_for_reclaim();
# endif
- if (GC_n_attempts < MAX_PRIOR_ATTEMPTS) {
+ if (GC_n_attempts < MAX_PRIOR_ATTEMPTS
+ && GC_time_limit != GC_TIME_UNLIMITED) {
GET_TIME(GC_start_time);
if (!GC_stopped_mark(GC_timeout_stop_func)) {
GC_n_attempts++;
@@ -434,7 +440,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 +448,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 +460,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 +518,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 +632,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/boehm-gc/config.guess b/boehm-gc/config.guess
index e1b58717080..297e5c30f41 100755
--- a/boehm-gc/config.guess
+++ b/boehm-gc/config.guess
@@ -1,8 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
-#
+
+timestamp='2001-10-05'
+
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -22,52 +24,195 @@
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
-# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-# Please send patches to <autoconf-patches@gnu.org>.
+# Originally written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
-#
-# Only a few systems have been added to this list; please add others
-# (but try to keep the structure clean).
-#
+# don't specify an explicit build system type.
-# Use $HOST_CC if defined. $CC may point to a cross-compiler
-if test x"$CC_FOR_BUILD" = x; then
- if test x"$HOST_CC" != x; then
- CC_FOR_BUILD="$HOST_CC"
- else
- if test x"$CC" != x; then
- CC_FOR_BUILD="$CC"
- else
- CC_FOR_BUILD=cc
- fi
- fi
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
fi
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
+ for c in cc gcc c89 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac'
+
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-unknown ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ ibmrt|romp-ibm) machine=romp-ibm ;;
+ sparc*) machine=`uname -p`-unknown ;;
+ *) machine=${UNAME_MACHINE}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE}" in
+ i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -77,41 +222,55 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
.globl main
+ .align 4
.ent main
main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
.end main
EOF
+ eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
+ case `./$dummy` in
+ 0-0)
UNAME_MACHINE="alpha"
;;
- 15)
+ 1-0)
UNAME_MACHINE="alphaev5"
;;
- 14)
+ 1-1)
UNAME_MACHINE="alphaev56"
;;
- 10)
+ 1-101)
UNAME_MACHINE="alphapca56"
;;
- 16)
+ 2-303)
UNAME_MACHINE="alphaev6"
;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
esac
fi
rm -f $dummy.s $dummy
@@ -127,45 +286,18 @@ EOF
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
+ echo m68k-unknown-sysv4
exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- SR2?01:HI-UX/MPP:*:*)
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
@@ -221,15 +353,9 @@ EOF
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
+ # "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
@@ -253,30 +379,9 @@ EOF
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
- macppc:NetBSD:*:*)
- echo powerpc-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
@@ -290,8 +395,10 @@ EOF
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
@@ -312,10 +419,13 @@ EOF
EOF
$CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
- && rm $dummy.c $dummy && exit 0
+ && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -331,7 +441,7 @@ EOF
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
@@ -363,11 +473,20 @@ EOF
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
+ i*86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
@@ -379,7 +498,7 @@ EOF
exit(0);
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
@@ -388,9 +507,9 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
- *:AIX:*:4)
+ *:AIX:*:[45])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
- if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
@@ -398,7 +517,7 @@ EOF
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV=4.${UNAME_RELEASE}
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
@@ -408,7 +527,7 @@ EOF
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
@@ -424,11 +543,30 @@ EOF
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- sed 's/^ //' << EOF >$dummy.c
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
@@ -459,13 +597,19 @@ EOF
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
- rm -f $dummy.c $dummy
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
3050*:HI-UX:*:*)
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
@@ -491,7 +635,7 @@ EOF
exit (0);
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
@@ -501,7 +645,7 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
- *9??*:MPE/iX:*:*)
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
@@ -510,7 +654,7 @@ EOF
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
- i?86:OSF1:*:*)
+ i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
@@ -520,9 +664,6 @@ EOF
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
- hppa*:OpenBSD:*:*)
- echo hppa-unknown-openbsd
- exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
@@ -545,37 +686,36 @@ EOF
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE}
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
- F300:UNIX_System_V:*:*)
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
- F301:UNIX_System_V:*:*)
- echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
- exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
@@ -585,26 +725,17 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
- if test -x /usr/bin/objformat; then
- if test "elf" = "`/usr/bin/objformat`"; then
- echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
- exit 0
- fi
- fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -623,172 +754,99 @@ EOF
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
- *:Linux:*:*)
-
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+ big) echo mips-unknown-linux-gnu && exit 0 ;;
+ little) echo mipsel-unknown-linux-gnu && exit 0 ;;
+ esac
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
- ld_help_string=`cd /; ld --help 2>&1`
- ld_supported_emulations=`echo $ld_help_string \
- | sed -ne '/supported emulations:/!d
+ ld_supported_targets=`cd /; ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
- s/.*supported emulations: *//
+ s/.*supported targets: *//
s/ .*//
p'`
- case "$ld_supported_emulations" in
- *ia64)
- echo "${UNAME_MACHINE}-unknown-linux"
- exit 0
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
- i?86linux)
+ a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0
- ;;
- i?86coff)
+ exit 0 ;;
+ coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0
- ;;
- sparclinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- armlinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- elf32arm*)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
- exit 0
- ;;
- armelf_linux*)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
- exit 0
- ;;
- m68klinux)
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
- exit 0
- ;;
- elf32ppc)
- # Determine Lib Version
- cat >$dummy.c <<EOF
-#include <features.h>
-#if defined(__GLIBC__)
-extern char __libc_version[];
-extern char __libc_release[];
-#endif
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#if defined(__GLIBC__)
- printf("%s %s\n", __libc_version, __libc_release);
-#else
- printf("unkown\n");
-#endif
- return 0;
-}
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy | grep 1\.99 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.c $dummy
- echo powerpc-unknown-linux-gnu${LIBC}
- exit 0
- ;;
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >$dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
-
- objdump --private-headers $dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >$dummy.c <<EOF
-#ifdef __cplusplus
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- else
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
- test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >$dummy.c <<EOF
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
@@ -796,28 +854,30 @@ EOF
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+ printf ("%s-pc-linux-gnu\n", argv[1]);
# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
- fi ;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i?86:DYNIX/ptx:4*:*)
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
echo i386-sequent-sysv4
exit 0 ;;
- i?86:UNIX_SV:4.2MP:2.*)
+ i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
@@ -825,7 +885,7 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
@@ -833,16 +893,15 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
- i?86:*:5:7*)
- # Fixed at (any) Pentium or better
- UNAME_MACHINE=i586
- if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
- echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit 0 ;;
- i?86:*:3.2:*)
+ i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
@@ -860,7 +919,11 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
pc:*:*:*)
+ # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
@@ -884,7 +947,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -895,21 +958,24 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
@@ -927,8 +993,8 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
@@ -940,10 +1006,14 @@ EOF
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
- news*:NEWS-OS:*:6*)
+ news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
@@ -974,14 +1044,76 @@ EOF
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
*:QNX:*:4*)
- echo i386-qnx-qnx${UNAME_VERSION}
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[KW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
@@ -1068,11 +1200,24 @@ main ()
#endif
#if defined (vax)
-#if !defined (ultrix)
- printf ("vax-dec-bsd\n"); exit (0);
-#else
- printf ("vax-dec-ultrix\n"); exit (0);
-#endif
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
#endif
#if defined (alliant) && defined (i860)
@@ -1083,7 +1228,7 @@ main ()
}
EOF
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy
# Apollos put the system type in the environment.
@@ -1116,6 +1261,48 @@ then
esac
fi
-#echo '(Unable to guess system type)' 1>&2
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 602a535143a..b951bf56e2d 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/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
@@ -2362,12 +2398,16 @@ EOF
;;
sparc-sun-solaris2.3*)
+ machdep="sparc_mach_dep.lo"
cat >> confdefs.h <<\EOF
#define SUNOS53_SHARED_LIB 1
EOF
;;
- ia64-*-hpux*)
+ sparc-sun-solaris2.*)
+ machdep="sparc_mach_dep.lo"
+ ;;
+ ia64-*-*)
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
;;
esac
@@ -2461,7 +2501,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/boehm-gc/configure.in b/boehm-gc/configure.in
index fcc0c710ee2..c65129a5a7d 100644
--- a/boehm-gc/configure.in
+++ b/boehm-gc/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)
@@ -176,9 +179,13 @@ case "$host" in
AC_DEFINE(NO_EXECUTE_PERMISSION)
;;
sparc-sun-solaris2.3*)
+ machdep="sparc_mach_dep.lo"
AC_DEFINE(SUNOS53_SHARED_LIB)
;;
- ia64-*-hpux*)
+ sparc-sun-solaris2.*)
+ machdep="sparc_mach_dep.lo"
+ ;;
+ ia64-*-*)
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
;;
esac
@@ -241,7 +248,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/boehm-gc/dbg_mlc.c b/boehm-gc/dbg_mlc.c
index af55032fde4..57de3dab28c 100644
--- a/boehm-gc/dbg_mlc.c
+++ b/boehm-gc/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/boehm-gc/doc/README b/boehm-gc/doc/README
index b161ccf4a46..6ac37c6c8ce 100644
--- a/boehm-gc/doc/README
+++ b/boehm-gc/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.1alpha3 of a conservative garbage collector for C and C++.
You might find a more recent version of this at
diff --git a/boehm-gc/doc/README.changes b/boehm-gc/doc/README.changes
index 8c00e938b5f..232938b4375 100644
--- a/boehm-gc/doc/README.changes
+++ b/boehm-gc/doc/README.changes
@@ -1413,6 +1413,61 @@ 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.1alpha1:
+ - 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 (elrond<at>samba-tng.org).)
+ - 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 those overflow the mark stack. (Thanks to
+ Matthew Flatt for tracking down the problem.)
+ - Some minor cleanups to mostly support the Intel compiler on Linux/IA64.
+
+Since 6.1 alpha2:
+ - Minor cleanup on the gcconfig.h section for SPARC.
+ - Minor fix to support Intel compiler for I386/Linux. (Thanks to Sven
+ Hartrumpf.)
+ - Added SPARC V9 (64-bit) support. (Thanks to Jeff Sturm.)
+ - Restructured the way in which we determine whether or not to keep
+ call stacks for debug allocation. By default SAVE_CALL_COUNT is
+ now zero on all platforms. Added SAVE_CALL_NARGS parameters.
+ If possible, use execinfo.h to capture call stack. (This should
+ add support for a number of new platforms, though often at
+ considerable runtime expense.)
+ - Try to print symbolic information for call stacks. On Linux, we
+ do this with a combination of execinfo.h and running addr2line in
+ a separate process. This is both much more expensive and much more
+ useful. Amazingly, it seems to be fast enough for most purposes.
+ - Redefined strdup if -DREDIRECT_MALLOC is given.
+ - Changed incremental collector and MPROTECT_VDB implementation so that,
+ under favorable conditions, pointerfree objects are not protected.
+ Added GC_incremental_protection_needs() to determine ahead of time whether
+ pointerfree objects may be protected. Replaced GC_write_hint() with
+ GC_remove_protection().
+ - Added test for GC_ENABLE_INCREMENTAL environment variable.
+ - Made GC_time_limit runtime configurable. Added GC_PAUSE_TIME_TARGET
+ environment variable.
+ - Eliminated GC_page_sz, a duplicate of GC_page_size.
+ - Caused the Solaris and Irix thread creation primitives to call
+ GC_init_inner().
To do:
diff --git a/boehm-gc/doc/README.environment b/boehm-gc/doc/README.environment
index 5760342a86a..6b25af1f6fe 100644
--- a/boehm-gc/doc/README.environment
+++ b/boehm-gc/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,47 @@ 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 .
+
+GC_ENABLE_INCREMENTAL - Turn on incremental collection at startup. Note that,
+ depending on platform and collector configuration, this
+ may involve write protecting pieces of the heap to
+ track modifications. These pieces may include pointerfree
+ objects or not. Although this is intended to be
+ transparent, it may cause unintended system call failures.
+ Use with caution.
+
+GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs.
+ This only has an effect if incremental collection is enabled.
+ If a collection requires appreciably more time than this,
+ the client will be restarted, and the collector will need
+ to do additional work to compensate. The special value
+ "999999" indicates that pause time is unlimited, and the
+ incremental collector will behave completely like a
+ simple generational collector. If the collector is
+ configured for parallel marking, and run on a multiprocessor,
+ incremental collection should only be used with unlimited
+ pause time.
+
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/boehm-gc/doc/README.win32 b/boehm-gc/doc/README.win32
index 417281da43d..b1a6ec59664 100644
--- a/boehm-gc/doc/README.win32
+++ b/boehm-gc/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/boehm-gc/doc/debugging.html b/boehm-gc/doc/debugging.html
index a186ff507a0..04773fa66a3 100644
--- a/boehm-gc/doc/debugging.html
+++ b/boehm-gc/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/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index c970fa5a939..2b37e9498dd 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -79,6 +79,23 @@
# define l_name lm_name
#endif
+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+ (defined(FREEBSD) && defined(__ELF__)) || \
+ (defined(NETBSD) && defined(__ELF__)) || defined(HURD)
+# include <stddef.h>
+# include <elf.h>
+# include <link.h>
+#endif
+
+/* Newer versions of GNU/Linux define this macro. We
+ * define it similarly for any ELF systems that don't. */
+# ifndef ElfW
+# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
+# define ElfW(type) Elf32_##type
+# else
+# define ElfW(type) Elf64_##type
+# endif
+# endif
#if defined(SUNOS5DL) && !defined(USE_PROC_FOR_LIBRARIES)
@@ -89,11 +106,11 @@
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
- extern Elf32_Dyn _DYNAMIC;
- Elf32_Dyn *dp;
+ extern ElfW(Dyn) _DYNAMIC;
+ ElfW(Dyn) *dp;
struct r_debug *r;
static struct link_map * cachedResult = 0;
- static Elf32_Dyn *dynStructureAddr = 0;
+ static ElfW(Dyn) *dynStructureAddr = 0;
/* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */
# ifdef SUNOS53_SHARED_LIB
@@ -103,7 +120,7 @@ GC_FirstDLOpenedLinkMap()
/* at program startup. */
if( dynStructureAddr == 0 ) {
void* startupSyms = dlopen(0, RTLD_LAZY);
- dynStructureAddr = (Elf32_Dyn*)dlsym(startupSyms, "_DYNAMIC");
+ dynStructureAddr = (ElfW(Dyn)*)dlsym(startupSyms, "_DYNAMIC");
}
# else
dynStructureAddr = &_DYNAMIC;
@@ -114,7 +131,7 @@ GC_FirstDLOpenedLinkMap()
}
if( cachedResult == 0 ) {
int tag;
- for( dp = ((Elf32_Dyn *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) {
+ for( dp = ((ElfW(Dyn) *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) {
if( tag == DT_DEBUG ) {
struct link_map *lm
= ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
@@ -200,14 +217,14 @@ void GC_register_dynamic_libraries()
TRUE);
# endif
# ifdef SUNOS5DL
- Elf32_Ehdr * e;
- Elf32_Phdr * p;
+ ElfW(Ehdr) * e;
+ ElfW(Phdr) * p;
unsigned long offset;
char * start;
register int i;
- e = (Elf32_Ehdr *) lm->l_addr;
- p = ((Elf32_Phdr *)(((char *)(e)) + e->e_phoff));
+ e = (ElfW(Ehdr) *) lm->l_addr;
+ p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
@@ -429,10 +446,6 @@ static char *parse_map_entry(char *buf_ptr, word *start, word *end,
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-#include <stddef.h>
-#include <elf.h>
-#include <link.h>
-
# if defined(LINUX) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
@@ -516,16 +529,6 @@ GC_bool GC_register_dynamic_libraries_dl_iterate_phdr()
# endif
-/* Newer versions of Linux/Alpha and Linux/x86 define this macro. We
- * define it for those older versions that don't. */
-# ifndef ElfW
-# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
-# define ElfW(type) Elf32_##type
-# else
-# define ElfW(type) Elf64_##type
-# endif
-# endif
-
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
diff --git a/boehm-gc/finalize.c b/boehm-gc/finalize.c
index d69ba6f1e22..a316010a680 100644
--- a/boehm-gc/finalize.c
+++ b/boehm-gc/finalize.c
@@ -838,3 +838,4 @@ void GC_notify_or_invoke_finalizers GC_PROTO((void))
# endif
return(result);
}
+
diff --git a/boehm-gc/gcj_mlc.c b/boehm-gc/gcj_mlc.c
index 7e79521eb1f..89f0d728a57 100644
--- a/boehm-gc/gcj_mlc.c
+++ b/boehm-gc/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/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
index 8ac709b9b5d..abf37326229 100644
--- a/boehm-gc/include/gc.h
+++ b/boehm-gc/include/gc.h
@@ -296,6 +296,20 @@ GC_API int GC_dont_precollect; /* Don't collect as part of */
/* Interferes with blacklisting. */
/* Wizards only. */
+GC_API unsigned long GC_time_limit;
+ /* If incremental collection is enabled, */
+ /* We try to terminate collections */
+ /* after this many milliseconds. Not a */
+ /* hard time bound. Setting this to */
+ /* GC_TIME_UNLIMITED will essentially */
+ /* disable incremental collection while */
+ /* leaving generational collection */
+ /* enabled. */
+# define GC_TIME_UNLIMITED 999999
+ /* Setting GC_time_limit to this value */
+ /* will disable the "pause time exceeded */
+ /* tests. */
+
/* Public procedures */
/*
* general purpose allocation routines, with roughly malloc calling conv.
@@ -455,6 +469,16 @@ GC_API size_t GC_get_total_bytes GC_PROTO((void));
/* functional if GC_parallel is TRUE. */
GC_API void GC_enable_incremental GC_PROTO((void));
+/* Does incremental mode write-protect pages? Returns zero or */
+/* more of the following, or'ed together: */
+#define GC_PROTECTS_POINTER_HEAP 1 /* May protect non-atomic objs. */
+#define GC_PROTECTS_PTRFREE_HEAP 2
+#define GC_PROTECTS_STATIC_DATA 4 /* Curently never. */
+#define GC_PROTECTS_STACK 8 /* Probably impractical. */
+
+#define GC_PROTECTS_NONE 0
+GC_API int GC_incremental_protection_needs GC_PROTO((void));
+
/* Perform some garbage collection work, if appropriate. */
/* Return 0 if there is no more work to be done. */
/* Typically performs an amount of work corresponding roughly */
diff --git a/boehm-gc/include/gc_pthread_redirects.h b/boehm-gc/include/gc_pthread_redirects.h
index ac254a86726..47284fbc97a 100644
--- a/boehm-gc/include/gc_pthread_redirects.h
+++ b/boehm-gc/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/boehm-gc/include/leak_detector.h b/boehm-gc/include/leak_detector.h
index 6786825ab6d..0674ab4d09f 100644
--- a/boehm-gc/include/leak_detector.h
+++ b/boehm-gc/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/boehm-gc/include/private/dbg_mlc.h b/boehm-gc/include/private/dbg_mlc.h
index 6f5b3c8677d..5378835811c 100644
--- a/boehm-gc/include/private/dbg_mlc.h
+++ b/boehm-gc/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/boehm-gc/include/private/gc_pmark.h b/boehm-gc/include/private/gc_pmark.h
index cf707069ad6..5936f2e8ee4 100644
--- a/boehm-gc/include/private/gc_pmark.h
+++ b/boehm-gc/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/boehm-gc/include/private/gc_priv.h b/boehm-gc/include/private/gc_priv.h
index ad204e99267..33d7d477e3e 100644
--- a/boehm-gc/include/private/gc_priv.h
+++ b/boehm-gc/include/private/gc_priv.h
@@ -249,20 +249,6 @@ typedef char * ptr_t; /* A generic pointer to which we can add */
#ifdef SAVE_CALL_CHAIN
-/*
- * Number of frames and arguments to save in objects allocated by
- * debugging allocator.
- */
-# ifndef SAVE_CALL_COUNT
-# define NFRAMES 6 /* Number of frames to save. Even for */
- /* alignment reasons. */
-# else
-# define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
-# endif
-# define NARGS 2 /* Mumber of arguments to save for each call. */
-
-# define NEED_CALLINFO
-
/* Fill in the pc and argument information for up to NFRAMES of my */
/* callers. Ignore my frame and my callers frame. */
struct callinfo;
@@ -270,14 +256,6 @@ void GC_save_callers GC_PROTO((struct callinfo info[NFRAMES]));
void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
-#else
-
-# ifdef GC_ADD_CALLER
-# define NFRAMES 1
-# define NARGS 0
-# define NEED_CALLINFO
-# endif
-
#endif
#ifdef NEED_CALLINFO
@@ -396,7 +374,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)
@@ -787,12 +766,11 @@ struct hblkhdr {
# define BODY_SZ (HBLKSIZE/sizeof(word))
struct hblk {
-# if 0 /* DISCARDWORDS no longer supported */
- word garbage[DISCARD_WORDS];
-# endif
word hb_body[BODY_SZ];
};
+# define HBLK_IS_FREE(hdr) ((hdr) -> hb_map == GC_invalid_map)
+
# define OBJ_SZ_TO_BLOCKS(sz) \
divHBLKSZ(WORDS_TO_BYTES(sz) + HBLKSIZE-1)
/* Size of block (in units of HBLKSIZE) needed to hold objects of */
@@ -1766,8 +1744,12 @@ GC_bool GC_page_was_ever_dirty GC_PROTO((struct hblk *h));
void GC_is_fresh GC_PROTO((struct hblk *h, word n));
/* Assert the region currently contains no */
/* valid pointers. */
-void GC_write_hint GC_PROTO((struct hblk *h));
- /* h is about to be written. */
+void GC_remove_protection GC_PROTO((struct hblk *h, word nblocks,
+ GC_bool pointerfree));
+ /* h is about to be writteni or allocated. Ensure */
+ /* that it's not write protected by the virtual */
+ /* dirty bit implementation. */
+
void GC_dirty_init GC_PROTO((void));
/* Slow/general mark bit manipulation: */
diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
index 6f25d30563f..6bce58cdbcf 100644
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/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
@@ -715,8 +718,11 @@
# define MACH_TYPE "SPARC"
# if defined(__arch64__) || defined(__sparcv9)
# define ALIGNMENT 8
+# define CPP_WORDSZ 64
+# define ELF_CLASS ELFCLASS64
# else
# define ALIGNMENT 4 /* Required by hardware */
+# define CPP_WORDSZ 32
# endif
# define ALIGN_DOUBLE
# ifdef SUNOS5
@@ -726,8 +732,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
@@ -751,7 +761,9 @@
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
/* getpagesize() appeared to be missing from at least one */
/* Solaris 5.4 installation. Weird. */
-# define DYNAMIC_LOADING
+# if CPP_WORDSZ == 32
+# define DYNAMIC_LOADING
+# endif
# endif
# ifdef SUNOS4
# define OS_TYPE "SUNOS4"
@@ -773,7 +785,6 @@
# define DYNAMIC_LOADING
# endif
# ifdef DRSNX
-# define CPP_WORDSZ 32
# define OS_TYPE "DRSNX"
extern char * GC_SysVGetDataStart();
extern int etext;
@@ -796,7 +807,6 @@
# ifdef __arch64__
# define STACKBOTTOM ((ptr_t) 0x80000000000ULL)
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x100000, &_etext)
-# define CPP_WORDSZ 64
# else
# define STACKBOTTOM ((ptr_t) 0xf0000000)
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
@@ -849,21 +859,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
@@ -888,6 +906,10 @@
# define ELF_CLASS ELFCLASS32
# endif
# ifdef LINUX
+# ifndef __GNUC__
+ /* The Intel compiler doesn't like inline assembly */
+# define USE_GENERIC_PUSH_REGS
+# endif
# define OS_TYPE "LINUX"
# define LINUX_STACKBOTTOM
# if 0
@@ -1014,11 +1036,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 +1057,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 +1125,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 +1425,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;
@@ -1678,17 +1735,68 @@
/* descriptions. */
# define USE_GENERIC_PUSH_REGS
# endif
-# if defined(I386) && defined(LINUX)
+
+# if defined(SPARC)
+# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
+ /* include assembly code to do it well. */
+# endif
+
+/* Can we save call chain in objects for debugging? */
+/* SET NFRAMES (# of saved frames) and NARGS (#of args for each frame) */
+/* to reasonable values for the platform. */
+/* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified at */
+/* build time, though we feel free to adjust it slightly. */
+/* Define NEED_CALLINFO if we either save the call stack or */
+/* GC_ADD_CALLER is defined. */
+#ifdef LINUX
+# include <features.h>
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
+# define HAVE_BUILTIN_BACKTRACE
+# endif
+#endif
+
+#if defined(SPARC)
+# define CAN_SAVE_CALL_STACKS
+# define CAN_SAVE_CALL_ARGS
+#endif
+#if defined(I386) && defined(LINUX)
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
-# ifdef SAVE_CALL_COUNT
+# define CAN_SAVE_CALL_STACKS
+# define CAN_SAVE_CALL_ARGS
+#endif
+#if defined(HAVE_BUILTIN_BACKTRACE) && !defined(CAN_SAVE_CALL_STACKS)
+# define CAN_SAVE_CALL_STACKS
+#endif
+
+# if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
+ && defined(CAN_SAVE_CALL_STACKS)
# define SAVE_CALL_CHAIN
# endif
+# ifdef SAVE_CALL_CHAIN
+# if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
+# define NARGS SAVE_CALL_NARGS
+# else
+# define NARGS 0 /* Number of arguments to save for each call. */
+# endif
# endif
-# if defined(SPARC)
-# define SAVE_CALL_CHAIN
-# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
- /* include assembly code to do it well. */
+# ifdef SAVE_CALL_CHAIN
+# ifndef SAVE_CALL_COUNT
+# define NFRAMES 6 /* Number of frames to save. Even for */
+ /* alignment reasons. */
+# else
+# define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
+# endif
+# define NEED_CALLINFO
+# endif /* SAVE_CALL_CHAIN */
+# ifdef GC_ADD_CALLER
+# define NFRAMES 1
+# define NARGS 0
+# define NEED_CALLINFO
+# endif
+
+# if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
+# define DBG_HDRS_ALL
# endif
# endif /* GCCONFIG_H */
diff --git a/boehm-gc/include/private/solaris_threads.h b/boehm-gc/include/private/solaris_threads.h
index b2cdb36e98d..1464bc14fd7 100644
--- a/boehm-gc/include/private/solaris_threads.h
+++ b/boehm-gc/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/boehm-gc/irix_threads.c b/boehm-gc/irix_threads.c
index c894a31006d..12204fdabc2 100644
--- a/boehm-gc/irix_threads.c
+++ b/boehm-gc/irix_threads.c
@@ -141,8 +141,6 @@ GC_bool GC_thr_initialized = FALSE;
size_t GC_min_stack_sz;
-size_t GC_page_sz;
-
# define N_FREE_LISTS 25
ptr_t GC_stack_free_lists[N_FREE_LISTS] = { 0 };
/* GC_stack_free_lists[i] is free list for stacks of */
@@ -171,14 +169,14 @@ ptr_t GC_stack_alloc(size_t * stack_size)
if (result != 0) {
GC_stack_free_lists[index] = *(ptr_t *)result;
} else {
- result = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_sz);
- result = (ptr_t)(((word)result + GC_page_sz) & ~(GC_page_sz - 1));
+ result = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_size);
+ result = (ptr_t)(((word)result + GC_page_size) & ~(GC_page_size - 1));
/* Protect hottest page to detect overflow. */
# ifdef STACK_GROWS_UP
- /* mprotect(result + search_sz, GC_page_sz, PROT_NONE); */
+ /* mprotect(result + search_sz, GC_page_size, PROT_NONE); */
# else
- /* mprotect(result, GC_page_sz, PROT_NONE); */
- result += GC_page_sz;
+ /* mprotect(result, GC_page_size, PROT_NONE); */
+ result += GC_page_size;
# endif
}
*stack_size = search_sz;
@@ -438,7 +436,6 @@ void GC_thr_init()
if (GC_thr_initialized) return;
GC_thr_initialized = TRUE;
GC_min_stack_sz = HBLKSIZE;
- GC_page_sz = sysconf(_SC_PAGESIZE);
(void) sigaction(SIG_SUSPEND, 0, &act);
if (act.sa_handler != SIG_DFL)
ABORT("Previously installed SIG_SUSPEND handler");
@@ -602,7 +599,7 @@ GC_pthread_create(pthread_t *new_thread,
si -> start_routine = start_routine;
si -> arg = arg;
LOCK();
- if (!GC_thr_initialized) GC_thr_init();
+ if (!GC_initialized) GC_init();
if (NULL == attr) {
stack = 0;
(void) pthread_attr_init(&new_attr);
diff --git a/boehm-gc/linux_threads.c b/boehm-gc/linux_threads.c
index 7958ed9bc17..b63dfb7fd7e 100644
--- a/boehm-gc/linux_threads.c
+++ b/boehm-gc/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/boehm-gc/mach_dep.c b/boehm-gc/mach_dep.c
index 35e9264bd85..b582db034df 100644
--- a/boehm-gc/mach_dep.c
+++ b/boehm-gc/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/boehm-gc/malloc.c b/boehm-gc/malloc.c
index 943f27d337c..5ac21421bea 100644
--- a/boehm-gc/malloc.c
+++ b/boehm-gc/malloc.c
@@ -337,6 +337,20 @@ DCL_LOCK_STATE;
{
return((GC_PTR)REDIRECT_MALLOC(n*lb));
}
+
+# include <string.h>
+# ifdef __STDC__
+ char *strdup(const char *s)
+# else
+ char *strdup(s)
+ char *s;
+# endif
+ {
+ size_t len = strlen + 1;
+ char * result = ((char *)REDIRECT_MALLOC(len+1));
+ BCOPY(s, result, len+1);
+ return result;
+ }
# endif /* REDIRECT_MALLOC */
/* Explicitly deallocate an object p. */
diff --git a/boehm-gc/mark.c b/boehm-gc/mark.c
index 4d7504799d4..70ba135f1ab 100644
--- a/boehm-gc/mark.c
+++ b/boehm-gc/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/boehm-gc/mark_rts.c b/boehm-gc/mark_rts.c
index a082e2b2e06..628cba289ac 100644
--- a/boehm-gc/mark_rts.c
+++ b/boehm-gc/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/boehm-gc/misc.c b/boehm-gc/misc.c
index 2bb93f3dd57..ec046d02503 100644
--- a/boehm-gc/misc.c
+++ b/boehm-gc/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
@@ -474,6 +477,12 @@ int sig;
}
#endif
+#ifdef MSWIN32
+ extern GC_bool GC_is_win32s();
+#else
+# define GC_is_win32s() FALSE
+#endif
+
void GC_init_inner()
{
# if !defined(THREADS) && defined(GC_ASSERTIONS)
@@ -497,6 +506,22 @@ 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;
+ }
+ {
+ char * time_limit_string = GETENV("GC_PAUSE_TIME_TARGET");
+ if (0 != time_limit_string) {
+ long time_limit;
+ if (time_limit_string != 0) time_limit = atol(time_limit_string);
+ if (time_limit < 5) {
+ WARN("GC_PAUSE_TIME_TARGET environment variable value too small "
+ "or bad syntax: Ignoring\n", 0);
+ } else {
+ GC_time_limit = time_limit;
+ }
+ }
+ }
# ifdef UNIX_LIKE
if (0 != GETENV("GC_LOOP_ON_ABORT")) {
GC_set_and_save_fault_handler(looping_handler);
@@ -606,8 +631,19 @@ void GC_init_inner()
PCR_IL_Unlock();
GC_pcr_install();
# endif
- /* Get black list set up */
- if (!GC_dont_precollect) GC_gcollect_inner();
+# if !defined(SMALL_CONFIG)
+ if (!GC_is_win32s() && 0 != GETENV("GC_ENABLE_INCREMENTAL")) {
+ GC_ASSERT(!GC_incremental);
+ GC_setpagesize();
+# ifndef GC_SOLARIS_THREADS
+ GC_dirty_init();
+# endif
+ GC_ASSERT(GC_words_allocd == 0)
+ GC_incremental = TRUE;
+ }
+# endif /* !SMALL_CONFIG */
+ /* Get black list set up and/or incrmental GC started */
+ if (!GC_dont_precollect || GC_incremental) GC_gcollect_inner();
GC_is_initialized = TRUE;
# ifdef STUBBORN_ALLOC
GC_stubborn_init();
@@ -640,20 +676,14 @@ void GC_enable_incremental GC_PROTO(())
LOCK();
if (GC_incremental) goto out;
GC_setpagesize();
-# ifdef MSWIN32
- {
- extern GC_bool GC_is_win32s();
-
- /* VirtualProtect is not functional under win32s. */
- if (GC_is_win32s()) goto out;
- }
-# endif /* MSWIN32 */
+ if (GC_is_win32s()) goto out;
# ifndef GC_SOLARIS_THREADS
GC_dirty_init();
# endif
if (!GC_is_initialized) {
GC_init_inner();
}
+ if (GC_incremental) goto out;
if (GC_dont_gc) {
/* Can't easily do it. */
UNLOCK();
@@ -886,6 +916,13 @@ GC_CONST char * msg;
#ifdef NEED_CALLINFO
+#ifdef HAVE_BUILTIN_BACKTRACE
+# include <execinfo.h>
+# ifdef LINUX
+# include <unistd.h>
+# endif
+#endif
+
void GC_print_callers (info)
struct callinfo info[NFRAMES];
{
@@ -911,7 +948,73 @@ struct callinfo info[NFRAMES];
GC_err_printf0("\n");
}
# endif
- GC_err_printf1("\t\t##PC##= 0x%X\n", info[i].ci_pc);
+# if defined(HAVE_BUILTIN_BACKTRACE) && !defined(REDIRECT_MALLOC)
+ /* Unfortunately backtrace_symbols calls malloc, which makes */
+ /* it dangersous if that has been redirected. */
+ {
+ char **sym_name =
+ backtrace_symbols((void **)(&(info[i].ci_pc)), 1);
+ char *name = sym_name[0];
+ GC_bool found_it = (strchr(name, '(') != 0);
+ FILE *pipe;
+# ifdef LINUX
+ if (!found_it) {
+# define EXE_SZ 100
+ static char exe_name[EXE_SZ];
+# define CMD_SZ 200
+ char cmd_buf[CMD_SZ];
+# define RESULT_SZ 200
+ static char result_buf[RESULT_SZ];
+ size_t result_len;
+ static GC_bool found_exe_name = FALSE;
+ static GC_bool will_fail = FALSE;
+ int ret_code;
+ /* Unfortunately, this is the common case for the */
+ /* main executable. */
+ /* Try to get it via a hairy and expensive scheme. */
+ /* First we get the name of the executable: */
+ if (will_fail) goto out;
+ if (!found_exe_name) {
+ ret_code = readlink("/proc/self/exe", exe_name, EXE_SZ);
+ if (ret_code < 0 || ret_code >= EXE_SZ || exe_name[0] != '/') {
+ will_fail = TRUE; /* Dont try again. */
+ goto out;
+ }
+ exe_name[ret_code] = '\0';
+ found_exe_name = TRUE;
+ }
+ /* Then we use popen to start addr2line -e <exe> <addr> */
+ /* There are faster ways to do this, but hopefully this */
+ /* isn't time critical. */
+ sprintf(cmd_buf, "/usr/bin/addr2line -e %s 0x%lx", exe_name,
+ (unsigned long)info[i].ci_pc);
+ pipe = popen(cmd_buf, "r");
+ if (pipe < 0 || fgets(result_buf, RESULT_SZ, pipe) == 0) {
+ will_fail = TRUE;
+ goto out;
+ }
+ result_len = strlen(result_buf);
+ if (result_buf[result_len - 1] == '\n') --result_len;
+ if (result_buf[0] == '?'
+ || result_buf[result_len-2] == ':'
+ && result_buf[result_len-1] == '0')
+ goto out;
+ if (result_len < RESULT_SZ - 25) {
+ /* Add in hex address */
+ sprintf(result_buf + result_len, " [0x%lx]",
+ (unsigned long)info[i].ci_pc);
+ }
+ name = result_buf;
+ pclose(pipe);
+ out:
+ }
+# endif
+ GC_err_printf1("\t\t%s\n", name);
+ free(sym_name);
+ }
+# else
+ GC_err_printf1("\t\t##PC##= 0x%lx\n", info[i].ci_pc);
+# endif
}
}
diff --git a/boehm-gc/os_dep.c b/boehm-gc/os_dep.c
index f8fee92312b..e42d4acd3d0 100644
--- a/boehm-gc/os_dep.c
+++ b/boehm-gc/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. */
@@ -1732,11 +1741,18 @@ word n;
{
}
-/* A call hints that h is about to be written. */
-/* May speed up some dirty bit implementations. */
+/* A call that: */
+/* I) hints that [h, h+nblocks) is about to be written. */
+/* II) guarantees that protection is removed. */
+/* (I) may speed up some dirty bit implementations. */
+/* (II) may be essential if we need to ensure that */
+/* pointer-free system call buffers in the heap are */
+/* not protected. */
/*ARGSUSED*/
-void GC_write_hint(h)
+void GC_remove_protection(h, nblocks, is_ptrfree)
struct hblk *h;
+word nblocks;
+GC_bool is_ptrfree;
{
}
@@ -1839,12 +1855,16 @@ struct hblk *h;
# endif
#endif
#if defined(LINUX)
-# include <linux/version.h>
-# if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA) || defined(IA64)
+# if __GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2
typedef struct sigcontext s_c;
-# else
- typedef struct sigcontext_struct s_c;
-# endif
+# else /* glibc < 2.2 */
+# include <linux/version.h>
+# if (LINUX_VERSION_CODE >= 0x20100) && !defined(M68K) || defined(ALPHA)
+ typedef struct sigcontext s_c;
+# else
+ typedef struct sigcontext_struct s_c;
+# endif
+# endif /* glibc < 2.2 */
# if defined(ALPHA) || defined(M68K)
typedef void (* REAL_SIG_PF)(int, int, s_c *);
# else
@@ -2310,29 +2330,33 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
/*
* We hold the allocation lock. We expect block h to be written
- * shortly.
+ * shortly. Ensure that all pages cvontaining any part of the n hblks
+ * starting at h are no longer protected. If is_ptrfree is false,
+ * also ensure that they will subsequently appear to be dirty.
*/
-void GC_write_hint(h)
+void GC_remove_protection(h, nblocks, is_ptrfree)
struct hblk *h;
+word nblocks;
+GC_bool is_ptrfree;
{
- register struct hblk * h_trunc;
- register unsigned i;
- register GC_bool found_clean;
+ struct hblk * h_trunc; /* Truncated to page boundary */
+ struct hblk * h_end; /* Page boundary following block end */
+ struct hblk * current;
+ GC_bool found_clean;
if (!GC_dirty_maintained) return;
h_trunc = (struct hblk *)((word)h & ~(GC_page_size-1));
+ h_end = (struct hblk *)(((word)(h + nblocks) + GC_page_size-1)
+ & ~(GC_page_size-1));
found_clean = FALSE;
- for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
- register int index = PHT_HASH(h_trunc+i);
+ for (current = h_trunc; current < h_end; ++current) {
+ int index = PHT_HASH(current);
- if (!get_pht_entry_from_index(GC_dirty_pages, index)) {
- found_clean = TRUE;
+ if (!is_ptrfree || current < h || current >= h + nblocks) {
async_set_pht_entry_from_index(GC_dirty_pages, index);
}
}
- if (found_clean) {
- UNPROTECT(h_trunc, GC_page_size);
- }
+ UNPROTECT(h_trunc, (ptr_t)h_end - (ptr_t)h_trunc);
}
void GC_dirty_init()
@@ -2451,18 +2475,77 @@ void GC_dirty_init()
# endif
}
+int GC_incremental_protection_needs()
+{
+ if (GC_page_size == HBLKSIZE) {
+ return GC_PROTECTS_POINTER_HEAP;
+ } else {
+ return GC_PROTECTS_POINTER_HEAP | GC_PROTECTS_PTRFREE_HEAP;
+ }
+}
+#define HAVE_INCREMENTAL_PROTECTION_NEEDS
+#define IS_PTRFREE(hhdr) ((hhdr)->hb_descr == 0)
+
+#define PAGE_ALIGNED(x) !((word)(x) & (GC_page_size - 1))
void GC_protect_heap()
{
ptr_t start;
word len;
+ struct hblk * current;
+ struct hblk * current_start; /* Start of block to be protected. */
+ struct hblk * limit;
unsigned i;
-
+ GC_bool protect_all =
+ (0 != (GC_incremental_protection_needs() & GC_PROTECTS_PTRFREE_HEAP));
for (i = 0; i < GC_n_heap_sects; i++) {
start = GC_heap_sects[i].hs_start;
len = GC_heap_sects[i].hs_bytes;
- PROTECT(start, len);
+ if (protect_all) {
+ PROTECT(start, len);
+ } else {
+ GC_ASSERT(PAGE_ALIGNED(len))
+ GC_ASSERT(PAGE_ALIGNED(start))
+ current_start = current = (struct hblk *)start;
+ limit = (struct hblk *)(start + len);
+ while (current < limit) {
+ hdr * hhdr;
+ word nhblks;
+ GC_bool is_ptrfree;
+
+ GC_ASSERT(PAGE_ALIGNED(current));
+ GET_HDR(current, hhdr);
+ if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
+ /* This can happen only if we're at the beginning of a */
+ /* heap segment, and a block spans heap segments. */
+ /* We will handle that block as part of the preceding */
+ /* segment. */
+ GC_ASSERT(current_start == current);
+ current_start = ++current;
+ continue;
+ }
+ if (HBLK_IS_FREE(hhdr)) {
+ GC_ASSERT(PAGE_ALIGNED(hhdr -> hb_sz));
+ nhblks = divHBLKSZ(hhdr -> hb_sz);
+ is_ptrfree = TRUE; /* dirty on alloc */
+ } else {
+ nhblks = OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz);
+ is_ptrfree = IS_PTRFREE(hhdr);
+ }
+ if (is_ptrfree) {
+ if (current_start < current) {
+ PROTECT(current_start, (ptr_t)current - (ptr_t)current_start);
+ }
+ current_start = (current += nhblks);
+ } else {
+ current += nhblks;
+ }
+ }
+ if (current_start < current) {
+ PROTECT(current_start, (ptr_t)current - (ptr_t)current_start);
+ }
+ }
}
}
@@ -2519,7 +2602,7 @@ word len;
register struct hblk *h;
ptr_t obj_start;
- if (!GC_incremental) return;
+ if (!GC_dirty_maintained) return;
obj_start = GC_base(addr);
if (obj_start == 0) return;
if (GC_base(addr + len - 1) != obj_start) {
@@ -2537,11 +2620,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 +2676,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. */
@@ -2728,8 +2815,10 @@ void GC_dirty_init()
/* Ignore write hints. They don't help us here. */
/*ARGSUSED*/
-void GC_write_hint(h)
+void GC_remove_protection(h, nblocks, is_ptrfree)
struct hblk *h;
+word nblocks;
+GC_bool is_ptrfree;
{
}
@@ -2937,15 +3026,24 @@ struct hblk *h;
}
/*ARGSUSED*/
-void GC_write_hint(h)
+void GC_remove_protection(h, nblocks, is_ptrfree)
struct hblk *h;
+word nblocks;
+GC_bool is_ptrfree;
{
- PCR_VD_WriteProtectDisable(h, HBLKSIZE);
- PCR_VD_WriteProtectEnable(h, HBLKSIZE);
+ PCR_VD_WriteProtectDisable(h, nblocks*HBLKSIZE);
+ PCR_VD_WriteProtectEnable(h, nblocks*HBLKSIZE);
}
# endif /* PCR_VDB */
+# ifndef HAVE_INCREMENTAL_PROTECTION_NEEDS
+ int GC_incremental_protection_needs()
+ {
+ return GC_PROTECTS_NONE;
+ }
+# endif /* !HAVE_INCREMENTAL_PROTECTION_NEEDS */
+
/*
* Call stack save code for debugging.
* Should probably be in mach_dep.c, but that requires reorganization.
@@ -2955,6 +3053,8 @@ struct hblk *h;
/* long as the frame pointer is explicitly stored. In the case of gcc, */
/* compiler flags (e.g. -fomit-frame-pointer) determine whether it is. */
#if defined(I386) && defined(LINUX) && defined(SAVE_CALL_CHAIN)
+# include <features.h>
+
struct frame {
struct frame *fr_savfp;
long fr_savpc;
@@ -2964,6 +3064,8 @@ struct hblk *h;
#if defined(SPARC)
# if defined(LINUX)
+# include <features.h>
+
struct frame {
long fr_local[8];
long fr_arg[6];
@@ -2999,6 +3101,35 @@ struct hblk *h;
/* Fill in the pc and argument information for up to NFRAMES of my */
/* callers. Ignore my frame and my callers frame. */
+#ifdef LINUX
+# include <features.h>
+# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2
+# define HAVE_BUILTIN_BACKTRACE
+# endif
+#endif
+
+#if NARGS == 0 && NFRAMES % 2 == 0 /* No padding */ \
+ && defined(HAVE_BUILTIN_BACKTRACE)
+
+#include <execinfo.h>
+
+void GC_save_callers (info)
+struct callinfo info[NFRAMES];
+{
+ void * tmp_info[NFRAMES + 1];
+ int npcs, i;
+# define IGNORE_FRAMES 1
+
+ /* We retrieve NFRAMES+1 pc values, but discard the first, since it */
+ /* points to our own frame. */
+ GC_ASSERT(sizeof(struct callinfo) == sizeof(void *));
+ npcs = backtrace((void **)tmp_info, NFRAMES + IGNORE_FRAMES);
+ BCOPY(tmp_info+IGNORE_FRAMES, info, (npcs - IGNORE_FRAMES) * sizeof(void *));
+ for (i = npcs - IGNORE_FRAMES; i < NFRAMES; ++i) info[i].ci_pc = 0;
+}
+
+#else /* No builtin backtrace; do it ourselves */
+
#if (defined(OPENBSD) || defined(NETBSD)) && defined(SPARC)
# define FR_SAVFP fr_fp
# define FR_SAVPC fr_pc
@@ -3045,6 +3176,8 @@ struct callinfo info[NFRAMES];
if (nframes < NFRAMES) info[nframes].ci_pc = 0;
}
+#endif /* No builtin backtrace */
+
#endif /* SAVE_CALL_CHAIN */
#if defined(LINUX) && defined(__ELF__) && \
diff --git a/boehm-gc/reclaim.c b/boehm-gc/reclaim.c
index 48db1e292a3..846215edb4f 100644
--- a/boehm-gc/reclaim.c
+++ b/boehm-gc/reclaim.c
@@ -631,47 +631,41 @@ COUNT_DECL
ptr_t result = list;
GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr);
+ GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */);
if (init) {
switch(sz) {
# if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
case 1:
/* We now issue the hint even if GC_nearly_full returned */
/* DONT_KNOW. */
- GC_write_hint(hbp);
result = GC_reclaim1(hbp, hhdr, list COUNT_ARG);
break;
case 2:
- GC_write_hint(hbp);
result = GC_reclaim_clear2(hbp, hhdr, list COUNT_ARG);
break;
case 4:
- GC_write_hint(hbp);
result = GC_reclaim_clear4(hbp, hhdr, list COUNT_ARG);
break;
# endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
default:
- GC_write_hint(hbp);
result = GC_reclaim_clear(hbp, hhdr, sz, list COUNT_ARG);
break;
}
} else {
+ GC_ASSERT((hhdr)->hb_descr == 0 /* Pointer-free block */);
switch(sz) {
# if !defined(SMALL_CONFIG) && !defined(USE_MARK_BYTES)
case 1:
- GC_write_hint(hbp);
result = GC_reclaim1(hbp, hhdr, list COUNT_ARG);
break;
case 2:
- GC_write_hint(hbp);
result = GC_reclaim_uninit2(hbp, hhdr, list COUNT_ARG);
break;
case 4:
- GC_write_hint(hbp);
result = GC_reclaim_uninit4(hbp, hhdr, list COUNT_ARG);
break;
# endif /* !SMALL_CONFIG && !USE_MARK_BYTES */
default:
- GC_write_hint(hbp);
result = GC_reclaim_uninit(hbp, hhdr, sz, list COUNT_ARG);
break;
}
diff --git a/boehm-gc/solaris_pthreads.c b/boehm-gc/solaris_pthreads.c
index e00e00b39b6..a197ccc6b48 100644
--- a/boehm-gc/solaris_pthreads.c
+++ b/boehm-gc/solaris_pthreads.c
@@ -89,8 +89,8 @@ GC_pthread_create(pthread_t *new_thread,
}
LOCK();
- if (!GC_thr_initialized) {
- GC_thr_init();
+ if (!GC_is_initialized) {
+ GC_init_inner();
}
GC_multithreaded++;
diff --git a/boehm-gc/solaris_threads.c b/boehm-gc/solaris_threads.c
index 365c6b12a30..2b520d3d085 100644
--- a/boehm-gc/solaris_threads.c
+++ b/boehm-gc/solaris_threads.c
@@ -16,7 +16,7 @@
*/
/* Boehm, September 14, 1994 4:44 pm PDT */
-# if defined(GC_SOLARIS_THREADS)
+# if defined(GC_SOLARIS_THREADS) || defined(GC_SOLARIS_PTHREADS)
# include "private/gc_priv.h"
# include "private/solaris_threads.h"
@@ -414,7 +414,6 @@ GC_bool GC_thr_initialized = FALSE;
size_t GC_min_stack_sz;
-size_t GC_page_sz;
/*
* stack_head is stored at the top of free stacks
@@ -456,7 +455,7 @@ ptr_t GC_stack_alloc(size_t * stack_size)
GC_stack_free_lists[index] = GC_stack_free_lists[index]->next;
} else {
#ifdef MMAP_STACKS
- base = (ptr_t)mmap(0, search_sz + GC_page_sz,
+ base = (ptr_t)mmap(0, search_sz + GC_page_size,
PROT_READ|PROT_WRITE, MAP_PRIVATE |MAP_NORESERVE,
GC_zfd, 0);
if (base == (ptr_t)-1)
@@ -465,27 +464,27 @@ ptr_t GC_stack_alloc(size_t * stack_size)
return NULL;
}
- mprotect(base, GC_page_sz, PROT_NONE);
- /* Should this use divHBLKSZ(search_sz + GC_page_sz) ? -- cf */
+ mprotect(base, GC_page_size, PROT_NONE);
+ /* Should this use divHBLKSZ(search_sz + GC_page_size) ? -- cf */
GC_is_fresh((struct hblk *)base, divHBLKSZ(search_sz));
- base += GC_page_sz;
+ base += GC_page_size;
#else
- base = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_sz);
+ base = (ptr_t) GC_scratch_alloc(search_sz + 2*GC_page_size);
if (base == NULL)
{
*stack_size = 0;
return NULL;
}
- base = (ptr_t)(((word)base + GC_page_sz) & ~(GC_page_sz - 1));
+ base = (ptr_t)(((word)base + GC_page_size) & ~(GC_page_size - 1));
/* Protect hottest page to detect overflow. */
# ifdef SOLARIS23_MPROTECT_BUG_FIXED
- mprotect(base, GC_page_sz, PROT_NONE);
+ mprotect(base, GC_page_size, PROT_NONE);
# endif
GC_is_fresh((struct hblk *)base, divHBLKSZ(search_sz));
- base += GC_page_sz;
+ base += GC_page_size;
#endif
}
*stack_size = search_sz;
@@ -621,7 +620,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;
@@ -654,8 +664,8 @@ void GC_my_stack_limits()
/* original thread */
/* Empirically, what should be the stack page with lowest */
/* address is actually inaccessible. */
- stack_size = GC_get_orig_stack_size() - GC_page_sz;
- stack = GC_stackbottom - stack_size + GC_page_sz;
+ stack_size = GC_get_orig_stack_size() - GC_page_size;
+ stack = GC_stackbottom - stack_size + GC_page_size;
} else {
stack = me -> stack;
}
@@ -693,7 +703,7 @@ void GC_push_all_stacks()
top = p -> stack + p -> stack_size;
} else {
/* The original stack. */
- bottom = GC_stackbottom - GC_get_orig_stack_size() + GC_page_sz;
+ bottom = GC_stackbottom - GC_get_orig_stack_size() + GC_page_size;
top = GC_stackbottom;
}
if ((word)sp > (word)bottom && (word)sp < (word)top) bottom = sp;
@@ -778,7 +788,6 @@ void GC_thr_init(void)
GC_thr_initialized = TRUE;
GC_min_stack_sz = ((thr_min_stack() + 32*1024 + HBLKSIZE-1)
& ~(HBLKSIZE - 1));
- GC_page_sz = sysconf(_SC_PAGESIZE);
#ifdef MMAP_STACKS
GC_zfd = open("/dev/zero", O_RDONLY);
if (GC_zfd == -1)
@@ -900,10 +909,7 @@ GC_thr_create(void *stack_base, size_t stack_size,
void * stack = stack_base;
LOCK();
- if (!GC_thr_initialized)
- {
- GC_thr_init();
- }
+ if (!GC_is_initialized) GC_init_inner();
GC_multithreaded++;
if (stack == 0) {
if (stack_size == 0) stack_size = 1024*1024;
diff --git a/boehm-gc/tests/test.c b/boehm-gc/tests/test.c
index 35cb1357883..7cb4d0c768f 100644
--- a/boehm-gc/tests/test.c
+++ b/boehm-gc/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/boehm-gc/threadlibs.c b/boehm-gc/threadlibs.c
index 991647ee849..99968a94a6c 100644
--- a/boehm-gc/threadlibs.c
+++ b/boehm-gc/threadlibs.c
@@ -10,13 +10,13 @@ int main()
"-Wl,--wrap -Wl,pthread_sigmask -Wl,--wrap -Wl,sleep\n");
# endif
# if defined(GC_LINUX_THREADS) || defined(GC_IRIX_THREADS) \
- || defined(GC_FREEBSD_THREADS)
+ || defined(GC_FREEBSD_THREADS) || defined(GC_SOLARIS_PTHREADS)
printf("-lpthread\n");
# endif
# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS)
printf("-lpthread -lrt\n");
# endif
-# if defined(GC_SOLARIS_THREADS)
+# if defined(GC_SOLARIS_THREADS) && !defined(GC_SOLARIS_PTHREADS)
printf("-lthread -ldl\n");
# endif
return 0;
diff --git a/boehm-gc/version.h b/boehm-gc/version.h
index d4e692345c5..96b7e64cbbe 100644
--- a/boehm-gc/version.h
+++ b/boehm-gc/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 3
# define GC_NOT_ALPHA 0xff