summaryrefslogtreecommitdiffstats
path: root/boehm-gc/pthread_support.c
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-25 03:03:14 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-25 03:03:14 +0000
commit8e86a8789d7a82b6f389c7c9052ba250933fafcb (patch)
tree575ef0143266ff2f57b09fe0143e9a412b1fb27f /boehm-gc/pthread_support.c
parent81aeb57750e78fcb33d69a741e75754851058883 (diff)
downloadppe42-gcc-8e86a8789d7a82b6f389c7c9052ba250933fafcb.tar.gz
ppe42-gcc-8e86a8789d7a82b6f389c7c9052ba250933fafcb.zip
Import Boehm GC version 6.6.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110204 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/pthread_support.c')
-rw-r--r--boehm-gc/pthread_support.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/boehm-gc/pthread_support.c b/boehm-gc/pthread_support.c
index 2a3b91917c7..4271803c7c2 100644
--- a/boehm-gc/pthread_support.c
+++ b/boehm-gc/pthread_support.c
@@ -2,7 +2,7 @@
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
* Copyright (c) 1998 by Fergus Henderson. All rights reserved.
- * Copyright (c) 2000-2001 by Hewlett-Packard Company. All rights reserved.
+ * Copyright (c) 2000-2004 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.
@@ -51,8 +51,7 @@
# include "private/pthread_support.h"
# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
- && !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \
- && !defined(GC_AIX_THREADS)
+ && !defined(GC_WIN32_THREADS)
# if defined(GC_HPUX_THREADS) && !defined(USE_PTHREAD_SPECIFIC) \
&& !defined(USE_COMPILER_TLS)
@@ -69,7 +68,8 @@
# endif
# if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
- defined(GC_DARWIN_THREADS)) && !defined(USE_PTHREAD_SPECIFIC)
+ defined(GC_DARWIN_THREADS) || defined(GC_AIX_THREADS)) \
+ && !defined(USE_PTHREAD_SPECIFIC)
# define USE_PTHREAD_SPECIFIC
# endif
@@ -117,7 +117,7 @@
# include <semaphore.h>
#endif /* !GC_DARWIN_THREADS */
-#if defined(GC_DARWIN_THREADS)
+#if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
# include <sys/sysctl.h>
#endif /* GC_DARWIN_THREADS */
@@ -840,9 +840,9 @@ int GC_get_nprocs()
/* We hold the allocation lock. */
void GC_thr_init()
{
-# ifndef GC_DARWIN_THREADS
- int dummy;
-# endif
+# ifndef GC_DARWIN_THREADS
+ int dummy;
+# endif
GC_thread t;
if (GC_thr_initialized) return;
@@ -874,14 +874,15 @@ void GC_thr_init()
# if defined(GC_HPUX_THREADS)
GC_nprocs = pthread_num_processors_np();
# endif
-# if defined(GC_OSF1_THREADS)
+# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# endif
-# if defined(GC_FREEBSD_THREADS)
- GC_nprocs = 1;
+# if defined(GC_IRIX_THREADS)
+ GC_nprocs = sysconf(_SC_NPROC_ONLN);
+ if (GC_nprocs <= 0) GC_nprocs = 1;
# endif
-# if defined(GC_DARWIN_THREADS)
+# if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
int ncpus = 1;
size_t len = sizeof(ncpus);
sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0);
@@ -928,6 +929,8 @@ void GC_thr_init()
/* Disable true incremental collection, but generational is OK. */
GC_time_limit = GC_TIME_UNLIMITED;
}
+ /* If we are using a parallel marker, actually start helper threads. */
+ if (GC_parallel) start_mark_threads();
# endif
}
@@ -944,10 +947,6 @@ void GC_init_parallel()
/* GC_init() calls us back, so set flag first. */
if (!GC_is_initialized) GC_init();
- /* If we are using a parallel marker, start the helper threads. */
-# ifdef PARALLEL_MARK
- if (GC_parallel) start_mark_threads();
-# endif
/* Initialize thread local free lists if used. */
# if defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
LOCK();
@@ -1223,7 +1222,7 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread,
if (!GC_thr_initialized) GC_thr_init();
# ifdef GC_ASSERTIONS
{
- int stack_size;
+ size_t stack_size;
if (NULL == attr) {
pthread_attr_t my_attr;
pthread_attr_init(&my_attr);
@@ -1231,7 +1230,13 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread,
} else {
pthread_attr_getstacksize(attr, &stack_size);
}
- GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word)));
+# ifdef PARALLEL_MARK
+ GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word)));
+# else
+ /* FreeBSD-5.3/Alpha: default pthread stack is 64K, */
+ /* HBLKSIZE=8192, sizeof(word)=8 */
+ GC_ASSERT(stack_size >= 65536);
+# endif
/* Our threads may need to do some work for the GC. */
/* Ridiculously small threads won't work, and they */
/* probably wouldn't work anyway. */
OpenPOWER on IntegriCloud