diff options
author | hboehm <hboehm> | 2006-05-19 00:58:44 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:37 +0400 |
commit | 5a4029619166b0e9cce266bc1408ade9afd49351 (patch) | |
tree | 97d5c2c24c75525fbec40e9ddd243628a709fbcf | |
parent | 202c39dc85257e50c8ecacba67a4e804ec90bc99 (diff) | |
download | bdwgc-5a4029619166b0e9cce266bc1408ade9afd49351.tar.gz |
2006-05-18 Hans Boehm <Hans.Boehm@hp.com>
* pthread_support.c: Fix stack size sanity check for Solaris.
* specific.c: Use for non-Linux platforms.
* include/private/thread_local_alloc.h: GC-remove_specific always
takes an argument.
* configure.ac: Enable thread-local allocation on Solaris.
* configure: Regenerate.
-rwxr-xr-x | configure | 14 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | doc/README.changes | 3 | ||||
-rw-r--r-- | include/private/thread_local_alloc.h | 6 | ||||
-rw-r--r-- | pthread_support.c | 19 | ||||
-rw-r--r-- | specific.c | 9 |
6 files changed, 37 insertions, 17 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 1.10 . +# From configure.ac Revision: 1.11 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for gc 7.0alpha6. # @@ -4187,6 +4187,10 @@ _ACEOF #define GC_SOLARIS_THREADS 1 _ACEOF + cat >>confdefs.h <<\_ACEOF +#define THREAD_LOCAL_ALLOC 1 +_ACEOF + THREADDLLIBS="-lpthread -lrt" ;; *-*-irix*) @@ -6219,7 +6223,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 6222 "configure"' > conftest.$ac_ext + echo '#line 6226 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6792,7 +6796,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:6795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:6799: \"$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 @@ -8719,7 +8723,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 8722 "configure" +#line 8726 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -8817,7 +8821,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 8820 "configure" +#line 8824 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/configure.ac b/configure.ac index c31d35cd..1c78502c 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_INIT(gc,7.0alpha6,Hans.Boehm@hp.com) AC_CONFIG_SRCDIR(gcj_mlc.c) AC_CANONICAL_TARGET AC_PREREQ(2.53) -AC_REVISION($Revision: 1.11 $) +AC_REVISION($Revision: 1.12 $) GC_SET_VERSION AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc]) AM_MAINTAINER_MODE @@ -126,6 +126,7 @@ case "$THREADS" in ;; *-*-solaris*) AC_DEFINE(GC_SOLARIS_THREADS) + AC_DEFINE(THREAD_LOCAL_ALLOC) THREADDLLIBS="-lpthread -lrt" ;; *-*-irix*) diff --git a/doc/README.changes b/doc/README.changes index e923beb0..874e8234 100644 --- a/doc/README.changes +++ b/doc/README.changes @@ -2506,6 +2506,9 @@ Since gc7.0alpha5 - Add GC_INIT() to middle.c, fix some more GC_printfn calls. - Some assertions erroneously used I_HOLD_LOCK() negatively, eventhough it can now spuriously return TRUE. + - Rename SUNOS5 macro and OS name to SOLARIS and SUNOS5DL to SOLARISDL. + - On Linux and some Un*x variants, allocate memory by first trying sbrk, + and then switching to mmap if that fails. To do: - REDIRECT_MALLOC and threads combination is getting closer, but currently diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index 9074fadf..3f126d57 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -93,13 +93,13 @@ typedef struct thread_local_freelists { # define GC_getspecific pthread_getspecific # define GC_setspecific pthread_setspecific # define GC_key_create pthread_key_create -# define GC_remove_specific() /* No need for cleanup on exit. */ +# define GC_remove_specific(key) /* No need for cleanup on exit. */ typedef pthread_key_t GC_key_t; # elif defined(USE_COMPILER_TLS) || defined(USE_WIN32_COMPILER_TLS) # define GC_getspecific(x) (x) # define GC_setspecific(key, v) ((key) = (v), 0) # define GC_key_create(key, d) 0 -# define GC_remove_specific() /* No need for cleanup on exit. */ +# define GC_remove_specific(key) /* No need for cleanup on exit. */ typedef void * GC_key_t; # elif defined(USE_WIN32_SPECIFIC) # include <windows.h> @@ -109,7 +109,7 @@ typedef struct thread_local_freelists { # define GC_key_create(key, d) \ ((d) != 0? (ABORT("Destructor unsupported by TlsAlloc"),0) \ : (*(key) = TlsAlloc(), 0)) -# define GC_remove_specific() /* No need for cleanup on thread exit. */ +# define GC_remove_specific(key) /* No need for cleanup on thread exit. */ /* Need TlsFree on process exit/detach ? */ typedef DWORD GC_key_t; # elif defined(USE_CUSTOM_SPECIFIC) diff --git a/pthread_support.c b/pthread_support.c index ddd051a8..536f5ce1 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -869,7 +869,7 @@ int GC_unregister_my_thread(void) me -> flags |= FINISHED; } # if defined(THREAD_LOCAL_ALLOC) - GC_remove_specific(); + GC_remove_specific(GC_thread_key); # endif UNLOCK(); return GC_SUCCESS; @@ -1068,13 +1068,22 @@ WRAP_FUNC(pthread_create)(pthread_t *new_thread, if (!GC_thr_initialized) GC_thr_init(); # ifdef GC_ASSERTIONS { - size_t stack_size; - if (NULL == attr) { + size_t stack_size = 0; + if (NULL != attr) { + pthread_attr_getstacksize(attr, &stack_size); + } + if (0 == stack_size) { pthread_attr_t my_attr; pthread_attr_init(&my_attr); pthread_attr_getstacksize(&my_attr, &stack_size); - } else { - pthread_attr_getstacksize(attr, &stack_size); + } + /* On Solaris 10, with default attr initialization, */ + /* stack_size remains 0. Fudge it. */ + if (0 == stack_size) { +# ifndef SOLARIS + WARN("Failed to get stack size for assertion checking\n", 0); +# endif + stack_size = 1000000; } # ifdef PARALLEL_MARK GC_ASSERT(stack_size >= (8*HBLKSIZE*sizeof(word))); @@ -12,11 +12,14 @@ */ #include "private/gc_priv.h" /* For configuration, pthreads.h. */ +#include "private/thread_local_alloc.h" + /* To determine type of tsd impl. */ + /* Includes private/specific.h */ + /* if needed. */ -#if defined(GC_LINUX_THREADS) +#if defined(USE_CUSTOM_SPECIFIC) #include "atomic_ops.h" -#include "private/specific.h" static tse invalid_tse = {INVALID_QTID, 0, 0, INVALID_THREADID}; /* A thread-specific data entry which will never */ @@ -159,4 +162,4 @@ void PREFIXED(check_tsd_marks) (tsd *key) #endif -#endif /* GC_LINUX_THREADS */ +#endif /* USE_CUSTOM_SPECIFIC */ |