summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 17:02:36 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 17:02:36 +0200
commitbf7cccc40abb56803f16203c8925ad83d98f6f9c (patch)
treedc706b806454055ce567b59a76ba4db24a5669d5
parente68119ed50536e409cc0eeba1508716d6fd7277b (diff)
gc6.8 tarball importgc6_8
-rwxr-xr-xconfigure44
-rw-r--r--configure.in22
-rw-r--r--darwin_stop_world.c33
-rw-r--r--doc/README2
-rw-r--r--doc/README.changes16
-rw-r--r--dyn_load.c4
-rw-r--r--include/gc.h18
-rw-r--r--include/gc_config_macros.h2
-rw-r--r--include/private/gcconfig.h92
-rw-r--r--malloc.c6
-rw-r--r--os_dep.c11
-rw-r--r--pthread_support.c10
-rw-r--r--version.h2
13 files changed, 212 insertions, 50 deletions
diff --git a/configure b/configure
index 372c8a8..2209d2c 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.in Revision: 1.2 .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for gc 6.7.
+# Generated by GNU Autoconf 2.59 for gc 6.8.
#
# Report bugs to <Hans.Boehm@hp.com>.
#
@@ -429,8 +429,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='gc'
PACKAGE_TARNAME='gc'
-PACKAGE_VERSION='6.7'
-PACKAGE_STRING='gc 6.7'
+PACKAGE_VERSION='6.8'
+PACKAGE_STRING='gc 6.8'
PACKAGE_BUGREPORT='Hans.Boehm@hp.com'
ac_unique_file="gcj_mlc.c"
@@ -956,7 +956,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gc 6.7 to adapt to many kinds of systems.
+\`configure' configures gc 6.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1023,7 +1023,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gc 6.7:";;
+ short | recursive ) echo "Configuration of gc 6.8:";;
esac
cat <<\_ACEOF
@@ -1167,7 +1167,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-gc configure 6.7
+gc configure 6.8
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1181,7 +1181,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gc $as_me 6.7, which was
+It was created by gc $as_me 6.8, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1953,7 +1953,7 @@ fi
# Define the identity of the package.
PACKAGE='gc'
- VERSION='6.7'
+ VERSION='6.8'
cat >>confdefs.h <<_ACEOF
@@ -4008,9 +4008,9 @@ _ACEOF
_ACEOF
;;
- *-*-hpux*)
- { echo "$as_me:$LINENO: WARNING: \"Only HP/UX 11 threads are supported.\"" >&5
-echo "$as_me: WARNING: \"Only HP/UX 11 threads are supported.\"" >&2;}
+ *-*-hpux11*)
+ { echo "$as_me:$LINENO: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5
+echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
cat >>confdefs.h <<\_ACEOF
#define GC_HPUX_THREADS 1
_ACEOF
@@ -4030,6 +4030,16 @@ _ACEOF
_ACEOF
THREADDLLIBS="-lpthread -lrt"
+ # HPUX needs REENTRANT for the _r calls.
+
+cat >>confdefs.h <<\_ACEOF
+#define _REENTRANT 1
+_ACEOF
+
+ ;;
+ *-*-hpux10*)
+ { echo "$as_me:$LINENO: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&5
+echo "$as_me: WARNING: \"Only HP-UX 11 POSIX threads are supported.\"" >&2;}
;;
*-*-freebsd*)
{ echo "$as_me:$LINENO: WARNING: \"FreeBSD does not yet fully support threads with Boehm GC.\"" >&5
@@ -6069,7 +6079,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
case $host in
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6072 "configure"' > conftest.$ac_ext
+ echo '#line 6082 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -6642,7 +6652,7 @@ chmod -w .
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
compiler_c_o=no
-if { (eval echo configure:6645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:6655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
if test -s out/conftest.err; then
@@ -8569,7 +8579,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8572 "configure"
+#line 8582 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8667,7 +8677,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8670 "configure"
+#line 8680 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10289,7 +10299,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by gc $as_me 6.7, which was
+This file was extended by gc $as_me 6.8, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10347,7 +10357,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-gc config.status 6.7
+gc config.status 6.8
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/configure.in b/configure.in
index 247760c..9923a2b 100644
--- a/configure.in
+++ b/configure.in
@@ -17,7 +17,7 @@ dnl Process this file with autoconf to produce configure.
# Initialization
# ==============
-AC_INIT(gc,6.7,Hans.Boehm@hp.com)
+AC_INIT(gc,6.8,Hans.Boehm@hp.com)
## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
AC_CONFIG_SRCDIR(gcj_mlc.c)
AC_CANONICAL_TARGET
@@ -94,8 +94,8 @@ case "$THREADS" in
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
;;
- *-*-hpux*)
- AC_MSG_WARN("Only HP/UX 11 threads are supported.")
+ *-*-hpux11*)
+ AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
AC_DEFINE(GC_HPUX_THREADS)
AC_DEFINE(_POSIX_C_SOURCE,199506L)
if test "${enable_parallel_mark}" = yes; then
@@ -103,6 +103,11 @@ case "$THREADS" in
fi
AC_DEFINE(THREAD_LOCAL_ALLOC)
THREADDLLIBS="-lpthread -lrt"
+ # HPUX needs REENTRANT for the _r calls.
+ AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
+ ;;
+ *-*-hpux10*)
+ AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
*-*-freebsd*)
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
@@ -110,6 +115,17 @@ case "$THREADS" in
INCLUDES="$INCLUDES -pthread"
THREADDLLIBS=-pthread
;;
+ *-*-kfreebsd*-gnu)
+ AC_DEFINE(GC_FREEBSD_THREADS)
+ INCLUDES="$INCLUDES -pthread"
+ THREADDLLIBS=-pthread
+ AC_DEFINE(_REENTRANT)
+ if test "${enable_parallel_mark}" = yes; then
+ AC_DEFINE(PARALLEL_MARK)
+ fi
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ AC_DEFINE(USE_COMPILER_TLS)
+ ;;
*-*-netbsd*)
AC_MSG_WARN("Only on NetBSD 2.0 or later.")
AC_DEFINE(GC_NETBSD_THREADS)
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 665e896..4ba5381 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -169,6 +169,7 @@ void GC_push_all_stacks() {
void GC_push_all_stacks() {
int i;
+ task_t my_task;
kern_return_t r;
mach_port_t me;
ptr_t lo, hi;
@@ -178,7 +179,8 @@ void GC_push_all_stacks() {
me = mach_thread_self();
if (!GC_thr_initialized) GC_thr_init();
- r = task_threads(current_task(), &act_list, &listcount);
+ my_task = current_task();
+ r = task_threads(my_task, &act_list, &listcount);
if(r != KERN_SUCCESS) ABORT("task_threads failed");
for(i = 0; i < listcount; i++) {
thread_act_t thread = act_list[i];
@@ -268,8 +270,10 @@ void GC_push_all_stacks() {
);
# endif
GC_push_all_stack(lo, hi);
+ mach_port_deallocate(my_task, thread);
} /* for(p=GC_threads[i]...) */
- vm_deallocate(current_task(), (vm_address_t)act_list, sizeof(thread_t) * listcount);
+ vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
+ mach_port_deallocate(my_task, me);
}
#endif /* !DARWIN_DONT_PARSE_STACK */
@@ -363,6 +367,7 @@ int GC_suspend_thread_list(thread_act_array_t act_list, int count,
}
if (!found) GC_mach_threads_count++;
}
+ mach_port_deallocate(current_task(), my_thread);
return changed;
}
@@ -372,6 +377,7 @@ void GC_stop_world()
{
int i, changes;
GC_thread p;
+ task_t my_task = current_task();
mach_port_t my_thread = mach_thread_self();
kern_return_t kern_result;
thread_act_array_t act_list, prev_list;
@@ -407,13 +413,21 @@ void GC_stop_world()
prevcount = 0;
do {
int result;
- kern_result = task_threads(current_task(), &act_list, &listcount);
+ kern_result = task_threads(my_task, &act_list, &listcount);
result = GC_suspend_thread_list(act_list, listcount,
prev_list, prevcount);
changes = result;
prev_list = act_list;
prevcount = listcount;
- vm_deallocate(current_task(), (vm_address_t)act_list, sizeof(thread_t) * listcount);
+
+ if(kern_result == KERN_SUCCESS) {
+ int i;
+
+ for(i = 0; i < listcount; i++)
+ mach_port_deallocate(my_task, act_list[i]);
+
+ vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
+ }
} while (changes);
@@ -430,12 +444,15 @@ void GC_stop_world()
#if DEBUG_THREADS
GC_printf1("World stopped from 0x%lx\n", my_thread);
#endif
+
+ mach_port_deallocate(my_task, my_thread);
}
/* Caller holds allocation lock, and has held it continuously since */
/* the world stopped. */
void GC_start_world()
{
+ task_t my_task = current_task();
mach_port_t my_thread = mach_thread_self();
int i, j;
GC_thread p;
@@ -456,7 +473,7 @@ void GC_start_world()
}
# endif
- kern_result = task_threads(current_task(), &act_list, &listcount);
+ kern_result = task_threads(my_task, &act_list, &listcount);
for(i = 0; i < listcount; i++) {
thread_act_t thread = act_list[i];
if (thread != my_thread &&
@@ -484,8 +501,12 @@ void GC_start_world()
}
}
}
+
+ mach_port_deallocate(my_task, thread);
}
- vm_deallocate(current_task(), (vm_address_t)act_list, sizeof(thread_t) * listcount);
+ vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
+
+ mach_port_deallocate(my_task, my_thread);
# if DEBUG_THREADS
GC_printf0("World started\n");
# endif
diff --git a/doc/README b/doc/README
index 46651ec..7d6659c 100644
--- a/doc/README
+++ b/doc/README
@@ -28,7 +28,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.7 of a conservative garbage collector for C and C++.
+This is version 6.8 of a conservative garbage collector for C and C++.
You might find a more recent version of this at
diff --git a/doc/README.changes b/doc/README.changes
index 2b6ff9a..3784930 100644
--- a/doc/README.changes
+++ b/doc/README.changes
@@ -2284,6 +2284,22 @@ Since 6.6:
- Fix Makefile.am, so it handles exe extensions under Cygwin correctly
for gctest.
+Since 6.7:
+ - Added some support for Dragonfly BSD. (Thanks to Joerg Sonnenberger and
+ Thomas Klausner.)
+ - Improvements to the HP/UX section of configure.in.
+ (Thanks to Andreas Tobler.)
+ - GC_unix_get_mem could neglect to release the malloc lock on Irix, under
+ extremely unlikely circumstances. Thanks to Jean-Baptiste Nivois for
+ some careful code reading.
+ - Added support for kFreeBSD + glibc (Thanks to Petr Salinger)
+ - Fix more MacOS threads memory leaks (Thanks to Allan Hsu)
+ - Added initial Solaris/X86-64 support (Thanks to Rainer Orth)
+ - Applied a long-lost MINGW patch from Gerard Allan for malloc redirection
+ with threads. This one probably makes no sense for 7.0, and was not applied
+ there.
+ - The Solaris/SPARC definition of GC_INIT() in gc.h wasn't C++-compilable.
+
To do:
- The USE_MUNMAP code should really use a separate data structure
indexed by physical page to keep track of time since last use of
diff --git a/dyn_load.c b/dyn_load.c
index c910609..ea1f867 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -26,7 +26,7 @@
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
-#if defined(__linux__) && !defined(_GNU_SOURCE)
+#if (defined(__linux__) || defined(__GLIBC__)) && !defined(_GNU_SOURCE)
/* Can't test LINUX, since this must be define before other includes */
# define _GNU_SOURCE
#endif
@@ -381,7 +381,7 @@ GC_bool GC_register_main_static_data()
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-# if defined(LINUX) /* Are others OK here, too? */ \
+# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
diff --git a/include/gc.h b/include/gc.h
index e1bbdeb..e4d2f4f 100644
--- a/include/gc.h
+++ b/include/gc.h
@@ -469,7 +469,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__GLIBC__)
# include <features.h>
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
&& !defined(__ia64__)
@@ -498,7 +498,7 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
/* This may also be desirable if it is possible but expensive to */
/* retrieve the call chain. */
#if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \
- || defined(__FreeBSD__)) & !defined(GC_CAN_SAVE_CALL_STACKS)
+ || defined(__FreeBSD__) || defined(__DragonFly__)) & !defined(GC_CAN_SAVE_CALL_STACKS)
# define GC_ADD_CALLER
# if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
/* gcc knows how to retrieve return address, but we don't know */
@@ -750,7 +750,7 @@ GC_API int GC_invoke_finalizers GC_PROTO((void));
/* be finalized. Return the number of finalizers */
/* that were run. Normally this is also called */
/* implicitly during some allocations. If */
- /* GC-finalize_on_demand is nonzero, it must be called */
+ /* GC_finalize_on_demand is nonzero, it must be called */
/* explicitly. */
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
@@ -945,16 +945,14 @@ extern void GC_thr_init GC_PROTO((void));/* Needed for Solaris/X86 */
* from the statically loaded program section.
* This circumvents a Solaris 2.X (X<=4) linker bug.
*/
+ extern int _end[], _etext[];
# ifdef __cplusplus
-# define GC_INIT() { extern int _end[], _etext[]; \
- extern "C" void GC_noop1(GC_word); \
- GC_noop1((GC_word)_end); \
- GC_noop1((GC_word)_etext); }
+ extern "C" void GC_noop1(GC_word);
# else
-# define GC_INIT() { extern int _end[], _etext[]; \
- extern void GC_noop(); \
- GC_noop(_end, _etext); }
+ void GC_noop1();
# endif /* !__cplusplus */
+# define GC_INIT() { GC_noop1((GC_word)_end); \
+ GC_noop1((GC_word)_etext); }
#else
# if defined(__CYGWIN32__) || defined (_AIX)
/*
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
index 8e3a8ae..1d1a2da 100644
--- a/include/gc_config_macros.h
+++ b/include/gc_config_macros.h
@@ -92,7 +92,7 @@
# define GC_DARWIN_THREADS
# define GC_PTHREADS
# endif
-# if !defined(GC_PTHREADS) && defined(__FreeBSD__)
+# if !defined(GC_PTHREADS) && (defined(__FreeBSD__) || defined(__DragonFly__))
# define GC_FREEBSD_THREADS
# define GC_PTHREADS
# endif
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index ccba470..5f897a4 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -55,7 +55,8 @@
# endif
/* And one for FreeBSD: */
-# if defined(__FreeBSD__) && !defined(FREEBSD)
+# if (defined(__FreeBSD__) || defined(__DragonFly__) || \
+ defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
# define FREEBSD
# endif
@@ -153,6 +154,11 @@
# define SUNOS5
# define mach_type_known
# endif
+# if defined(sun) && defined(__amd64)
+# define X86_64
+# define SOLARIS
+# define mach_type_known
+# endif
# if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
# define I386
# define OS2
@@ -174,7 +180,8 @@
# define mach_type_known
# endif
# if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
- && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
+ && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) \
+ && !defined(__DragonFly__)
# define SPARC
# define DRSNX
# define mach_type_known
@@ -1249,8 +1256,15 @@
# ifndef GC_FREEBSD_THREADS
# define MPROTECT_VDB
# endif
-# define SIG_SUSPEND SIGUSR1
-# define SIG_THR_RESTART SIGUSR2
+# ifdef __GLIBC__
+# define SIG_SUSPEND (32+6)
+# define SIG_THR_RESTART (32+5)
+ extern int _end[];
+# define DATAEND (_end)
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# endif
# define FREEBSD_STACKBOTTOM
# ifdef __ELF__
# define DYNAMIC_LOADING
@@ -1993,6 +2007,28 @@
# define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
# endif
# endif
+# ifdef FREEBSD
+# define OS_TYPE "FREEBSD"
+# ifndef GC_FREEBSD_THREADS
+# define MPROTECT_VDB
+# endif
+# ifdef __GLIBC__
+# define SIG_SUSPEND (32+6)
+# define SIG_THR_RESTART (32+5)
+ extern int _end[];
+# define DATAEND (_end)
+# else
+# define SIG_SUSPEND SIGUSR1
+# define SIG_THR_RESTART SIGUSR2
+# endif
+# define FREEBSD_STACKBOTTOM
+# ifdef __ELF__
+# define DYNAMIC_LOADING
+# endif
+ extern char etext[];
+ extern char * GC_FreeBSDGetDataStart();
+# define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
+# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# ifdef __ELF__
@@ -2002,6 +2038,47 @@
extern char etext[];
# define SEARCH_FOR_DATA_START
# endif
+# ifdef SOLARIS
+# define OS_TYPE "SOLARIS"
+# define ELF_CLASS ELFCLASS64
+ extern int _etext[], _end[];
+ extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
+# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_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. */
+/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
+/* installations that's undefined. We work around this with a */
+/* gross hack: */
+# include <sys/vmparam.h>
+# ifdef USERLIMIT
+ /* This should work everywhere, but doesn't. */
+# define STACKBOTTOM USRSTACK
+# else
+# define HEURISTIC2
+# endif
+/* 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
+# 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
+# else
+# define HEAP_START DATAEND
+# endif
+# endif
# endif
#if defined(LINUX) && defined(USE_MMAP)
@@ -2064,7 +2141,8 @@
# define SUNOS5SIGS
# endif
-# if defined(FREEBSD) && (__FreeBSD__ >= 4)
+# if defined(FREEBSD) && \
+ (defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4))
# define SUNOS5SIGS
# endif
@@ -2132,7 +2210,7 @@
# define CACHE_LINE_SIZE 32 /* Wild guess */
# endif
-# ifdef LINUX
+# if defined(LINUX) || defined(__GLIBC__)
# define REGISTER_LIBRARIES_EARLY
/* We sometimes use dl_iterate_phdr, which may acquire an internal */
/* lock. This isn't safe after the world has stopped. So we must */
@@ -2216,7 +2294,7 @@
#if defined(SPARC)
# define CAN_SAVE_CALL_ARGS
#endif
-#if (defined(I386) || defined(X86_64)) && defined(LINUX)
+#if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
/* SAVE_CALL_CHAIN is supported if the code is compiled to save */
/* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
# define CAN_SAVE_CALL_ARGS
diff --git a/malloc.c b/malloc.c
index b7617df..8409751 100644
--- a/malloc.c
+++ b/malloc.c
@@ -355,6 +355,12 @@ DCL_LOCK_STATE;
size_t lb;
# endif
{
+# if defined(GC_WIN32_THREADS) && defined(__GNUC__)
+ /* According to Gerard Allen, this helps with MINGW. */
+ /* When using threads need to initalised before use, but GCC uses a malloc
+ in __w32_sharedptr_initialize (w32-shared-ptr.c) */
+ if (!GC_is_initialized) GC_init();
+# endif
/* It might help to manually inline the GC_malloc call here. */
/* But any decent compiler should reduce the extra procedure call */
/* to at most a jump instruction in this case. */
diff --git a/os_dep.c b/os_dep.c
index b6068c9..c9396f5 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1626,13 +1626,20 @@ word bytes;
ptr_t cur_brk = (ptr_t)sbrk(0);
SBRK_ARG_T lsbs = (word)cur_brk & (GC_page_size-1);
- if ((SBRK_ARG_T)bytes < 0) return(0); /* too big */
+ if ((SBRK_ARG_T)bytes < 0) {
+ result = 0; /* too big */
+ goto out;
+ }
if (lsbs != 0) {
- if((ptr_t)sbrk(GC_page_size - lsbs) == (ptr_t)(-1)) return(0);
+ if((ptr_t)sbrk(GC_page_size - lsbs) == (ptr_t)(-1)) {
+ result = 0;
+ goto out;
+ }
}
result = (ptr_t)sbrk((SBRK_ARG_T)bytes);
if (result == (ptr_t)(-1)) result = 0;
}
+ out:
# ifdef IRIX5
__UNLOCK_MALLOC();
# endif
diff --git a/pthread_support.c b/pthread_support.c
index e8f4902..0855a88 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -598,6 +598,11 @@ void GC_delete_thread(pthread_t id)
} else {
prev -> next = p -> next;
}
+
+#ifdef GC_DARWIN_THREADS
+ mach_port_deallocate(mach_task_self(), p->stop_info.mach_thread);
+#endif
+
GC_INTERNAL_FREE(p);
}
@@ -620,6 +625,11 @@ void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
} else {
prev -> next = p -> next;
}
+
+#ifdef GC_DARWIN_THREADS
+ mach_port_deallocate(mach_task_self(), p->stop_info.mach_thread);
+#endif
+
GC_INTERNAL_FREE(p);
}
diff --git a/version.h b/version.h
index 930f3f2..f8f025d 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
/* Eventually this one may become unnecessary. For now we need */
/* it to keep the old-style build process working. */
#define GC_TMP_VERSION_MAJOR 6
-#define GC_TMP_VERSION_MINOR 7
+#define GC_TMP_VERSION_MINOR 8
#define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA
#ifndef GC_NOT_ALPHA