From e559309022a354a3d2bad049d66419949588cfc7 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 12 May 2017 23:32:23 +0300 Subject: Define GC_THREADS instead of GC_x_THREADS in Makefiles (code refactoring) * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT] (SRC): Add thread_local_alloc.c in a single place. * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Define GC_THREADS macro instead of GC_LINUX_THREADS, GC_AIX_THREADS, GC_HPUX_THREADS, GC_OPENBSD_THREADS, GC_FREEBSD_THREADS, GC_NETBSD_THREADS, GC_SOLARIS_THREADS, GC_IRIX_THREADS, GC_DARWIN_THREADS, GC_OSF1_THREADS. * configure.ac [THREADS=posix]: Likewise. * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Handle *-*-aix*, *-*-*freebsd* (including kfreebsd), *-*-gnu*, *-*-irix*, *-*-openbsd*, *-*-osf*, *-*-solaris* targets in the same ways as *-*-*linux*. * Makefile.direct (CFLAGS): Do not mention GC_HPUX_THREADS in comment. * README.QUICK: Refine documentation about macro and configure option for builds with (and without) threads support. * configure.ac (GC_AIX_THREADS, GC_DARWIN_THREADS, GC_FREEBSD_THREADS, GC_HPUX_THREADS, GC_IRIX_THREADS, GC_LINUX_THREADS, GC_NETBSD_THREADS, GC_OPENBSD_THREADS, GC_OSF1_THREADS, GC_SOLARIS_THREADS, GC_WIN32_THREADS, GC_RTEMS_PTHREADS): Remove AH_TEMPLATE. * configure.ac [THREADS=posix]: Handle *-*-aix*, *-*-irix* targets in the same ways as *-*-*linux*. * configure.ac [THREADS=win32 || THREADS=dgux386 || THREADS=aix || THREADS=rtems]: Define GC_THREADS macro instead of GC_WIN32_THREADS, GC_DGUX386_THREADS, GC_AIX_THREADS, GC_RTEMS_PTHREADS. * doc/README.darwin: Replace GC_MACOSX_THREADS with GC_THREADS. * doc/README.environment (doc/README.environment): Replace GC_OSF1_THREADS with OSF1. * doc/README.hp: Replace GC_HPUX_THREADS with GC_THREADS. * doc/README.linux: Replace GC_LINUX_THREADS with GC_THREADS. * doc/scale.html: Likewise. * doc/README.macros (GC_SOLARIS_THREADS, GC_IRIX_THREADS, GC_HPUX_THREADS, GC_LINUX_THREADS, GC_OSF1_THREADS, GC_FREEBSD_THREADS, GC_NETBSD_THREADS, GC_OPENBSD_THREADS, GC_DARWIN_THREADS, GC_AIX_THREADS, GC_DGUX386_THREADS, GC_WIN32_THREADS): Add note that the macro is deprecated (GC_THREADS one should be used instead). * doc/README.sgi: Replace GC_IRIX_THREADS with GC_THREADS. * doc/README.solaris2: Do not mention GC_SOLARIS_THREADS. * doc/gcinterface.html: Do not mention GC_XXXX_THREADS. --- CMakeLists.txt | 94 +++++--------------------------------------------- Makefile.direct | 12 ++----- README.QUICK | 7 ++-- configure.ac | 61 +++++++++----------------------- doc/README.darwin | 2 +- doc/README.environment | 2 +- doc/README.hp | 2 +- doc/README.linux | 13 ++++--- doc/README.macros | 32 +++++++++++------ doc/README.sgi | 4 +-- doc/README.solaris2 | 5 ++- doc/gcinterface.html | 3 +- doc/scale.html | 4 +-- 13 files changed, 66 insertions(+), 175 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4fda356..15c630f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,29 +79,19 @@ MESSAGE("HOST = ${HOST}") #Thread Detection. Relying on cmake for lib an includes. #TODO check cmake detection IF(CMAKE_USE_PTHREADS_INIT) - SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) - IF( HOST MATCHES .*-.*-.*linux.*|.*-.*-nacl.*) - ADD_DEFINITIONS("-DGC_LINUX_THREADS") + SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c thread_local_alloc.c) + IF( HOST MATCHES .*-.*-aix.*|.*-.*-.*freebsd.*|.*-.*-gnu.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) + ADD_DEFINITIONS("-DGC_THREADS") ADD_DEFINITIONS("-D_REENTRANT") IF(enable_parallel_mark) ADD_DEFINITIONS("-DPARALLEL_MARK") ENDIF(enable_parallel_mark) ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) MESSAGE("Explicit GC_INIT() calls may be required.") ENDIF() - IF ( HOST MATCHES .*-.*-aix.*) - ADD_DEFINITIONS("-DGC_AIX_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() IF ( HOST MATCHES .*-.*-hpux11.*) MESSAGE("Only HP/UX 11 POSIX threads are supported.") - ADD_DEFINITIONS("-DGC_HPUX_THREADS") + ADD_DEFINITIONS("-DGC_THREADS") ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property MESSAGE("Explicit GC_INIT() calls may be required.") ADD_DEFINITIONS("-D_REENTRANT") #TODO @@ -109,78 +99,19 @@ IF(CMAKE_USE_PTHREADS_INIT) ADD_DEFINITIONS("-DPARALLEL_MARK") ENDIF(enable_parallel_mark) ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) ENDIF() IF ( HOST MATCHES .*-.*-hpux10.*) MESSAGE("Only HP/UX 11 POSIX threads are supported.") ENDIF() - IF ( HOST MATCHES .*-.*-openbsd.*) - ADD_DEFINITIONS("-DGC_OPENBSD_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() - IF ( HOST MATCHES .*-.*-freebsd.*) - ADD_DEFINITIONS("-DGC_FREEBSD_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() - IF ( HOST MATCHES .*-.*-kfreebsd.*-gnu) - ADD_DEFINITIONS("-DGC_FREEBSD_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - ADD_DEFINITIONS("-DUSE_COMPILER_TLS") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() - IF ( HOST MATCHES .*-.*-gnu.*) - ADD_DEFINITIONS("-DGC_THREADS") - ADD_DEFINITIONS("-D_REENTRANT") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() IF ( HOST MATCHES .*-.*-netbsd.*) MESSAGE("Only on NetBSD 2.0 or later.") - ADD_DEFINITIONS("-DGC_NETBSD_THREADS") + ADD_DEFINITIONS("-DGC_THREADS") ADD_DEFINITIONS("-D_REENTRANT") ADD_DEFINITIONS("-D_PTHREADS") IF(enable_parallel_mark) ADD_DEFINITIONS("-DPARALLEL_MARK") ENDIF(enable_parallel_mark) ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF() - IF ( HOST MATCHES .*-.*-solaris.*) - ADD_DEFINITIONS("-DGC_SOLARIS_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) -#TODO -# if test "$GCC" != yes; then -# CFLAGS="$CFLAGS -O" -# need_atomic_ops_asm=true -# fi - - ENDIF() - IF ( HOST MATCHES .*-.*-irix.*) - ADD_DEFINITIONS("-DGC_IRIX_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) ENDIF() IF ( HOST MATCHES .*-.*-cygwin.*) ADD_DEFINITIONS("-DGC_THREADS") @@ -188,28 +119,19 @@ IF(CMAKE_USE_PTHREADS_INIT) ADD_DEFINITIONS("-DPARALLEL_MARK") ENDIF(enable_parallel_mark) ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c win32_threads.c) + SET(SRC ${SRC} win32_threads.c) ENDIF() IF ( HOST MATCHES .*-.*-darwin.*) - ADD_DEFINITIONS("-DGC_DARWIN_THREADS") + ADD_DEFINITIONS("-DGC_THREADS") IF(enable_parallel_mark) ADD_DEFINITIONS("-DPARALLEL_MARK") ENDIF(enable_parallel_mark) ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") MESSAGE("Explicit GC_INIT() calls may be required.") - SET(SRC ${SRC} darwin_stop_world.c thread_local_alloc.c) + SET(SRC ${SRC} darwin_stop_world.c) #TODO #darwin_threads=true ENDIF() - IF ( HOST MATCHES .*-.*-osf.*) - ADD_DEFINITIONS("-DGC_OSF1_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF() - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - MESSAGE("Explicit GC_INIT() calls may be required.") - ENDIF() ENDIF(CMAKE_USE_PTHREADS_INIT) IF(CMAKE_USE_WIN32_THREADS_INIT) diff --git a/Makefile.direct b/Makefile.direct index 579b888b..9eec9aaa 100644 --- a/Makefile.direct +++ b/Makefile.direct @@ -51,16 +51,8 @@ CFLAGS= -O -I$(srcdir)/include -I$(AO_SRC_DIR)/src \ # To build the collector with threads support, add to the above: # -DGC_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC # -# To build the thread-capable preload library that intercepts -# malloc, add -DGC_USE_DLOPEN_WRAP -DREDIRECT_MALLOC=GC_malloc -fpic -# -# To build the parallel collector in a static library on HP/UX, -# add to the above: -# -DGC_HPUX_THREADS -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L -mt -# FIXME: PARALLEL_MARK currently broken on HP/UX. -# -# To build the thread-safe collector on Tru64, add to the above: -# -pthread -DGC_OSF1_THREADS +# To build the preload library that intercepts malloc, add: +# -DGC_USE_DLOPEN_WRAP -DREDIRECT_MALLOC=GC_malloc -fpic # HOSTCC and HOSTCFLAGS are used to build executables that will be run as # part of the build process, i.e. on the build machine. These will usually diff --git a/README.QUICK b/README.QUICK index 7f4c9e21..d702817d 100644 --- a/README.QUICK +++ b/README.QUICK @@ -40,10 +40,9 @@ copy the appropriate makefile to MAKEFILE, read it, and type "nmake test". installed, and suitably configured.) Read the machine specific README.XXX in the doc directory if one exists. -If you need thread support, you will need to follow the special -platform-dependent instructions (win32), or define GC_THREADS -as described in doc/README.macros, or possibly use ---enable-threads=posix when running the configure script. +If you need thread support, you should define GC_THREADS as described in +doc/README.macros (configure defines this implicitly unless --disable-threads +option is given). If you wish to use the cord (structured string) library with the stand-alone Makefile.direct, type "make -f Makefile.direct cords". (You may need to diff --git a/configure.ac b/configure.ac index 7ea157d0..3d61cf97 100644 --- a/configure.ac +++ b/configure.ac @@ -136,20 +136,8 @@ AH_TEMPLATE([USE_COMPILER_TLS], dnl Thread selection macros. AH_TEMPLATE([GC_THREADS], [Define to support platform-specific threads.]) -AH_TEMPLATE([GC_AIX_THREADS], [Define to support IBM AIX threads.]) -AH_TEMPLATE([GC_DARWIN_THREADS], [Define to support Darwin pthreads.]) -AH_TEMPLATE([GC_FREEBSD_THREADS], [Define to support FreeBSD pthreads.]) -AH_TEMPLATE([GC_HPUX_THREADS], [Define to support HP/UX 11 pthreads.]) -AH_TEMPLATE([GC_IRIX_THREADS], [Define to support Irix pthreads.]) -AH_TEMPLATE([GC_LINUX_THREADS], [Define to support pthreads on Linux.]) -AH_TEMPLATE([GC_NETBSD_THREADS], [Define to support NetBSD pthreads.]) -AH_TEMPLATE([GC_OPENBSD_THREADS], [Define to support OpenBSD pthreads.]) -AH_TEMPLATE([GC_OSF1_THREADS], [Define to support Tru64 pthreads.]) -AH_TEMPLATE([GC_SOLARIS_THREADS], [Define to support Solaris pthreads.]) -AH_TEMPLATE([GC_WIN32_THREADS], [Define to support Win32 threads.]) AH_TEMPLATE([GC_WIN32_PTHREADS], [Define to support pthreads-win32 or winpthreads.]) -AH_TEMPLATE([GC_RTEMS_PTHREADS], [Define to support rtems-pthreads.]) dnl System header feature requests. AH_TEMPLATE([_POSIX_C_SOURCE], [The POSIX feature macro.]) @@ -182,8 +170,8 @@ case "$THREADS" in THREADS=posix AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,) case "$host" in - *-*-*linux* | *-*-nacl*) - AC_DEFINE(GC_LINUX_THREADS) + *-*-aix* | *-*-irix* | *-*-*linux* | *-*-nacl*) + AC_DEFINE(GC_THREADS) AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) @@ -191,17 +179,9 @@ case "$THREADS" in AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explicit GC_INIT() calls may be required."); ;; - *-*-aix*) - AC_DEFINE(GC_AIX_THREADS) - AC_DEFINE(_REENTRANT) - if test "${enable_parallel_mark}" != no; then - AC_DEFINE(PARALLEL_MARK) - fi - AC_DEFINE(THREAD_LOCAL_ALLOC) - ;; *-*-hpux11*) AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.") - AC_DEFINE(GC_HPUX_THREADS) + AC_DEFINE(GC_THREADS) AC_DEFINE(_POSIX_C_SOURCE,199506L) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) @@ -216,7 +196,7 @@ case "$THREADS" in AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.") ;; *-*-openbsd*) - AC_DEFINE(GC_OPENBSD_THREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi @@ -225,7 +205,7 @@ case "$THREADS" in AM_CFLAGS="$AM_CFLAGS -pthread" ;; *-*-freebsd*) - AC_DEFINE(GC_FREEBSD_THREADS) + AC_DEFINE(GC_THREADS) AM_CFLAGS="$AM_CFLAGS -pthread" if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) @@ -233,7 +213,7 @@ case "$THREADS" in AC_DEFINE(THREAD_LOCAL_ALLOC) ;; *-*-kfreebsd*-gnu) - AC_DEFINE(GC_FREEBSD_THREADS) + AC_DEFINE(GC_THREADS) AM_CFLAGS="$AM_CFLAGS -pthread" THREADDLLIBS=-pthread AC_DEFINE(_REENTRANT) @@ -243,7 +223,7 @@ case "$THREADS" in AC_DEFINE(THREAD_LOCAL_ALLOC) AC_DEFINE(USE_COMPILER_TLS) ;; - *-*-gnu*) + *-*-gnu*) # Excluding kfreebsd. AC_DEFINE(GC_THREADS) AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" != no; then @@ -253,7 +233,7 @@ case "$THREADS" in ;; *-*-netbsd*) AC_MSG_WARN("Only on NetBSD 2.0 or later.") - AC_DEFINE(GC_NETBSD_THREADS) + AC_DEFINE(GC_THREADS) AC_DEFINE(_REENTRANT) AC_DEFINE(_PTHREADS) if test "${enable_parallel_mark}" != no; then @@ -263,7 +243,7 @@ case "$THREADS" in THREADDLLIBS="-lpthread -lrt" ;; *-*-solaris*) - AC_DEFINE(GC_SOLARIS_THREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi @@ -274,15 +254,8 @@ case "$THREADS" in THREADDLLIBS="-L/usr/lib/lwp/$multi_os_directory \ -R/usr/lib/lwp/$multi_os_directory -lpthread -lrt" ;; - *-*-irix*) - AC_DEFINE(GC_IRIX_THREADS) - if test "${enable_parallel_mark}" != no; then - AC_DEFINE(PARALLEL_MARK) - fi - AC_DEFINE(THREAD_LOCAL_ALLOC) - ;; *-*-cygwin*) - AC_DEFINE(GC_WIN32_THREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi @@ -303,7 +276,7 @@ case "$THREADS" in win32_threads=true ;; *-*-darwin*) - AC_DEFINE(GC_DARWIN_THREADS) + AC_DEFINE(GC_THREADS) AC_MSG_WARN("Explicit GC_INIT() calls may be required."); # Parallel-mark is not well-tested on Darwin if test "${enable_parallel_mark}" != no; then @@ -313,7 +286,7 @@ case "$THREADS" in darwin_threads=true ;; *-*-osf*) - AC_DEFINE(GC_OSF1_THREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi @@ -335,7 +308,7 @@ case "$THREADS" in esac ;; win32) - AC_DEFINE(GC_WIN32_THREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) AC_DEFINE(THREAD_LOCAL_ALLOC) @@ -354,6 +327,7 @@ case "$THREADS" in [Wine getenv may not return NULL for missing entry.]) ;; dgux386) + AC_DEFINE(GC_THREADS) THREADS=dgux386 AC_MSG_RESULT($THREADDLLIBS) # Use pthread GCC switch @@ -363,15 +337,12 @@ case "$THREADS" in fi AC_DEFINE(THREAD_LOCAL_ALLOC) AC_MSG_WARN("Explicit GC_INIT() calls may be required."); - AC_DEFINE([GC_DGUX386_THREADS], 1, - [Define to enable support for DB/UX threads on i386.]) - # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread AM_CFLAGS="-pthread $AM_CFLAGS" ;; aix) THREADS=posix THREADDLLIBS=-lpthread - AC_DEFINE(GC_AIX_THREADS) + AC_DEFINE(GC_THREADS) AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) @@ -380,7 +351,7 @@ case "$THREADS" in ;; rtems) THREADS=posix - AC_DEFINE(GC_RTEMS_PTHREADS) + AC_DEFINE(GC_THREADS) if test "${enable_parallel_mark}" != no; then AC_DEFINE(PARALLEL_MARK) fi diff --git a/doc/README.darwin b/doc/README.darwin index 11bb7e2e..2727d0b1 100644 --- a/doc/README.darwin +++ b/doc/README.darwin @@ -133,7 +133,7 @@ work and doesn't mess up the garbage collector's functionality). Feb 26, 2003 Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support. -GC_MACOSX_THREADS should be defined in the build and in clients. Real +GC_THREADS should be defined in the build and in clients. Real dynamic library support is still missing, i.e. dynamic library data segments are still not scanned. Code that stores pointers to the garbage collected heap in statically allocated variables should not reside in a dynamic diff --git a/doc/README.environment b/doc/README.environment index 7d4d96c4..9721bb6f 100644 --- a/doc/README.environment +++ b/doc/README.environment @@ -98,7 +98,7 @@ GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost thread suspend signals (Pthreads only). On by - default for GC_OSF1_THREADS, off otherwise. Note + default for OSF1, off otherwise. Note that this does not work around a possible loss of thread restart signals. This seems to be necessary for some versions of Tru64. Since we've previously seen diff --git a/doc/README.hp b/doc/README.hp index bb583bbc..83708ea0 100644 --- a/doc/README.hp +++ b/doc/README.hp @@ -11,7 +11,7 @@ correctly. Incremental collection support was added recently, and should now work. In spite of past claims, pthread support under HP/UX 11 should now work. -Define GC_HPUX_THREADS for the build. Incremental collection still does not +Define GC_THREADS macro for the build. Incremental collection still does not work in combination with it. The stack finding code can be confused by putenv calls before collector diff --git a/doc/README.linux b/doc/README.linux index f490365c..0d4bb6c3 100644 --- a/doc/README.linux +++ b/doc/README.linux @@ -26,13 +26,12 @@ To use threads, you need to abide by the following requirements: pthread implementations (in particular it will *not* work with MIT pthreads). -2) You must compile the collector with -DGC_LINUX_THREADS (or - just -DGC_THREADS) and -D_REENTRANT specified in the Makefile. +2) You must compile the collector with "-DGC_THREADS -D_REENTRANT" specified + in the Makefile. -3a) Every file that makes thread calls should define GC_LINUX_THREADS and - _REENTRANT and then include gc.h. Gc.h redefines some of the - pthread primitives as macros which also provide the collector with - information it requires. +3a) Every file that makes thread calls should define GC_THREADS, and then + include gc.h. Gc.h redefines some of the pthread primitives as macros + which also provide the collector with information it requires. 3b) A new alternative to (3a) is to build the collector and compile GC clients with -DGC_USE_LD_WRAP, and to link the final program with @@ -54,7 +53,7 @@ To use threads, you need to abide by the following requirements: user startup code may run as part of dlopen().) Under unusual conditions, this may cause unexpected heap growth. -5) The combination of GC_LINUX_THREADS, REDIRECT_MALLOC, and incremental +5) The combination of GC_THREADS, REDIRECT_MALLOC, and incremental collection is probably not fully reliable, though it now seems to work in simple cases. diff --git a/doc/README.macros b/doc/README.macros index 86533f24..3040f3e8 100644 --- a/doc/README.macros +++ b/doc/README.macros @@ -120,34 +120,44 @@ GC_THREADS Should set the appropriate one of the below macros, except GC_WIN32_PTHREADS, which must be set explicitly. Tested by gc.h. GC_SOLARIS_THREADS Enables support for Solaris pthreads. - Must also define _REENTRANT. + Must also define _REENTRANT. Deprecated, use GC_THREADS instead. GC_IRIX_THREADS Enables support for Irix pthreads. See README.sgi. + Deprecated, use GC_THREADS instead. GC_HPUX_THREADS Enables support for HP/UX 11 pthreads. Also requires _REENTRANT or _POSIX_C_SOURCE=199506L. See README.hp. + Deprecated, use GC_THREADS instead. GC_LINUX_THREADS Enables support for Xavier Leroy's Linux threads - or NPTL threads. See README.linux. _REENTRANT may also be required. + or NPTL threads. See README.linux. _REENTRANT may also be required. + Deprecated, use GC_THREADS instead. -GC_OSF1_THREADS Enables support for Tru64 pthreads. +GC_OSF1_THREADS Enables support for Tru64 pthreads. Deprecated, use + GC_THREADS instead. -GC_FREEBSD_THREADS Enables support for FreeBSD pthreads. - Appeared to run into some underlying thread problems. +GC_FREEBSD_THREADS Enables support for FreeBSD pthreads. Appeared to run + into some underlying thread problems. Deprecated, use GC_THREADS instead. -GC_NETBSD_THREADS Enables support for NetBSD pthreads. +GC_NETBSD_THREADS Enables support for NetBSD pthreads. Deprecated, use + GC_THREADS instead. -GC_OPENBSD_THREADS Enables support for OpenBSD pthreads. +GC_OPENBSD_THREADS Enables support for OpenBSD pthreads. Deprecated, + use GC_THREADS instead. -GC_DARWIN_THREADS Enables support for Mac OS X pthreads. +GC_DARWIN_THREADS Enables support for Mac OS X pthreads. Deprecated, + use GC_THREADS instead. -GC_AIX_THREADS Enables support for IBM AIX threads. +GC_AIX_THREADS Enables support for IBM AIX threads. Deprecated, use + GC_THREADS instead. GC_DGUX386_THREADS Enables support for DB/UX on I386 threads. - See README.DGUX386. (Probably has not been tested recently.) + See README.DGUX386. (Probably has not been tested recently.) Deprecated, + use GC_THREADS instead. GC_WIN32_THREADS Enables support for Win32 threads. That makes sense - for this Makefile only under Cygwin. + for Makefile (and Makefile.direct) only under Cygwin or MinGW. Deprecated, + use GC_THREADS instead. GC_WIN32_PTHREADS Enables support for pthreads-win32 (or other non-Cygwin pthreads library for Windows). This cannot be enabled diff --git a/doc/README.sgi b/doc/README.sgi index d9e98938..98c79011 100644 --- a/doc/README.sgi +++ b/doc/README.sgi @@ -13,7 +13,7 @@ ports. Pthreads support is provided. This requires that: -1) You compile the collector with -DGC_IRIX_THREADS specified in the Makefile. +1) You compile the collector with -DGC_THREADS specified in the Makefile. 2) You have the latest pthreads patches installed. @@ -22,7 +22,7 @@ it relies on signal/threads interactions working just right in ways that are not required by the standard. It is unlikely that this code will run on other pthreads platforms. But please tell me if it does.) -3) Every file that makes thread calls should define IRIX_THREADS and then +3) Every file that makes thread calls should define GC_THREADS and then include gc.h. Gc.h redefines some of the pthread primitives as macros which also provide the collector with information it requires. diff --git a/doc/README.solaris2 b/doc/README.solaris2 index 1a9d09f5..cd2d9f67 100644 --- a/doc/README.solaris2 +++ b/doc/README.solaris2 @@ -26,9 +26,8 @@ SOLARIS THREADS: Unless --disable-threads option is given, threads support is on by default in configure. This causes the collector to be compiled with -D GC_THREADS -(or -D GC_SOLARIS_THREADS) ensuring thread safety. -This assumes use of the pthread_ interface. Old style Solaris threads -are no longer supported. +ensuring thread safety. This assumes use of the pthread_ interface; old-style +Solaris threads are no longer supported. Thread-local allocation is now on by default. Parallel marking is on by default starting from GC v7.3 but it could be disabled manually by configure --disable-parallel-mark option. diff --git a/doc/gcinterface.html b/doc/gcinterface.html index 9d94541c..57729549 100644 --- a/doc/gcinterface.html +++ b/doc/gcinterface.html @@ -32,8 +32,7 @@ Clients should include gc.h.

In the case of multi-threaded code, gc.h should be included after the threads header file, and -after defining the appropriate GC_XXXX_THREADS macro. -(For 6.2alpha4 and later, simply defining GC_THREADS should suffice.) +after defining GC_THREADS macro. The header file gc.h must be included in files that use either GC or threads primitives, since threads primitives will be redefined to cooperate with the GC on many platforms. diff --git a/doc/scale.html b/doc/scale.html index 67928277..4d4fc7cb 100644 --- a/doc/scale.html +++ b/doc/scale.html @@ -132,7 +132,7 @@ under Linux 2.2.12.

Running with a thread-unsafe collector, the benchmark ran in 9 seconds. With the simple thread-safe collector, -built with -DLINUX_THREADS, the execution time +built with -DGC_THREADS, the execution time increased to 10.3 seconds, or 23.5 elapsed seconds with two clients. (The times for the malloc/ifree version with glibc malloc @@ -143,7 +143,7 @@ garbage collector, since most objects are small.)

The following table gives execution times for the collector built with parallel marking and thread-local allocation support -(-DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC). We tested +(-DGC_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC). We tested the client using either one or two marker threads, and running one or two client threads. Note that the client uses thread local allocation exclusively. With -DTHREAD_LOCAL_ALLOC the collector -- cgit v1.2.1