From: ivmai Date: Mon, 4 Jul 2011 13:29:55 +0000 (+0000) Subject: 2011-07-04 Ivan Maidanski (mostly really Andy Wingo) X-Git-Tag: gc7_3alpha2~416 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06c1e2cf3859e4f9cf26dfd93c4c707293754aca;p=gc 2011-07-04 Ivan Maidanski (mostly really Andy Wingo) * configure.ac (GC_THREADS): Refine the comment. * configure.ac (GC_WIN32_PTHREADS): Add template. * configure.ac (cygwin, win32): Define GC_WIN32_THREADS instead of GC_THREADS. * configure.ac (pthreads): Add mingw target (GC_WIN32_PTHREADS). * configure: Regenerate. * include/private/config.h.in: Ditto. * include/private/gc_locks.h (GC_WIN32_PTHREADS): Remove nested test for the macro; add comment. --- diff --git a/ChangeLog b/ChangeLog index c85fb3b0..d0c9bab8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-07-04 Ivan Maidanski (mostly really Andy Wingo) + + * configure.ac (GC_THREADS): Refine the comment. + * configure.ac (GC_WIN32_PTHREADS): Add template. + * configure.ac (cygwin, win32): Define GC_WIN32_THREADS instead of + GC_THREADS. + * configure.ac (pthreads): Add mingw target (GC_WIN32_PTHREADS). + * configure: Regenerate. + * include/private/config.h.in: Ditto. + * include/private/gc_locks.h (GC_WIN32_PTHREADS): Remove nested + test for the macro; add comment. + 2011-07-01 Ivan Maidanski * win32_threads.c (CHECK_LOOKUP_MY_THREAD): New macro definition. diff --git a/configure b/configure index 102c4e93..486a8e71 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 1.67 . +# From configure.ac Revision: 1.68 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for gc 7.2alpha7. # @@ -4967,6 +4967,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 @@ -5062,7 +5063,8 @@ if test "x$ac_cv_lib_pthread_pthread_self" = xyes; then : fi case "$host" in - x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*) + x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* \ + | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*) $as_echo "#define GC_LINUX_THREADS 1" >>confdefs.h $as_echo "#define _REENTRANT 1" >>confdefs.h @@ -5178,7 +5180,7 @@ $as_echo "$as_me: WARNING: \"Only on NetBSD 2.0 or later.\"" >&2;} ;; *-*-cygwin*) - $as_echo "#define GC_THREADS 1" >>confdefs.h + $as_echo "#define GC_WIN32_THREADS 1" >>confdefs.h if test "${enable_parallel_mark}" = yes; then $as_echo "#define PARALLEL_MARK 1" >>confdefs.h @@ -5191,6 +5193,18 @@ $as_echo "$as_me: WARNING: \"Only on NetBSD 2.0 or later.\"" >&2;} THREADDLLIBS="" win32_threads=true ;; + *-*-mingw*) + $as_echo "#define GC_WIN32_PTHREADS 1" >>confdefs.h + + # Using win32-pthreads + if test "${enable_parallel_mark}" = yes; then + $as_echo "#define PARALLEL_MARK 1" >>confdefs.h + + fi + $as_echo "#define THREAD_LOCAL_ALLOC 1" >>confdefs.h + + THREADDLLIBS="-lpthread" + ;; *-*-darwin*) $as_echo "#define GC_DARWIN_THREADS 1" >>confdefs.h @@ -5235,7 +5249,7 @@ $as_echo "$as_me: WARNING: \"Explicit GC_INIT() calls may be required.\"" >&2;}; esac ;; win32) - $as_echo "#define GC_THREADS 1" >>confdefs.h + $as_echo "#define GC_WIN32_THREADS 1" >>confdefs.h if test "${enable_parallel_mark}" = yes; then $as_echo "#define PARALLEL_MARK 1" >>confdefs.h @@ -5252,7 +5266,7 @@ $as_echo "#define EMPTY_GETENV_RESULTS 1" >>confdefs.h THREADS=dgux386 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $THREADDLLIBS" >&5 $as_echo "$THREADDLLIBS" >&6; } - # Use pthread GCC switch + # Use pthread GCC switch THREADDLLIBS=-pthread if test "${enable_parallel_mark}" = yes; then $as_echo "#define PARALLEL_MARK 1" >>confdefs.h diff --git a/configure.ac b/configure.ac index 567926b2..f25d0216 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_CONFIG_SRCDIR(gcj_mlc.c) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_TARGET AC_PREREQ(2.64) -AC_REVISION($Revision: 1.68 $) +AC_REVISION($Revision: 1.69 $) GC_SET_VERSION AM_INIT_AUTOMAKE([foreign dist-bzip2 nostdinc]) AM_CONFIG_HEADER([include/private/config.h]) @@ -78,7 +78,8 @@ AH_TEMPLATE([USE_COMPILER_TLS], [Define to use of compiler-support for thread-local variables.]) dnl Thread selection macros. -AH_TEMPLATE([GC_THREADS], [Define to support threads.]) +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.]) @@ -90,7 +91,8 @@ 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_THREADS], [Define to support Win32 threads.]) +AH_TEMPLATE([GC_WIN32_PTHREADS], [Define to support win32-pthreads.]) dnl System header feature requests. AH_TEMPLATE([_POSIX_C_SOURCE], [The POSIX feature macro.]) @@ -110,7 +112,8 @@ case "$THREADS" in THREADS=posix AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,) case "$host" in - x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*) + x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* \ + | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*) AC_DEFINE(GC_LINUX_THREADS) AC_DEFINE(_REENTRANT) if test "${enable_parallel_mark}" = yes; then @@ -190,7 +193,7 @@ case "$THREADS" in AC_DEFINE(GC_IRIX_THREADS) ;; *-*-cygwin*) - AC_DEFINE(GC_THREADS) + AC_DEFINE(GC_WIN32_THREADS) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) fi @@ -200,6 +203,15 @@ case "$THREADS" in THREADDLLIBS="" win32_threads=true ;; + *-*-mingw*) + AC_DEFINE(GC_WIN32_PTHREADS) + # Using win32-pthreads + if test "${enable_parallel_mark}" = yes; then + AC_DEFINE(PARALLEL_MARK) + fi + AC_DEFINE(THREAD_LOCAL_ALLOC) + THREADDLLIBS="-lpthread" + ;; *-*-darwin*) AC_DEFINE(GC_DARWIN_THREADS) AC_DEFINE(THREAD_LOCAL_ALLOC) @@ -236,7 +248,7 @@ case "$THREADS" in esac ;; win32) - AC_DEFINE(GC_THREADS) + AC_DEFINE(GC_WIN32_THREADS) if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) AC_DEFINE(THREAD_LOCAL_ALLOC) @@ -248,7 +260,7 @@ case "$THREADS" in dgux386) THREADS=dgux386 AC_MSG_RESULT($THREADDLLIBS) - # Use pthread GCC switch + # Use pthread GCC switch THREADDLLIBS=-pthread if test "${enable_parallel_mark}" = yes; then AC_DEFINE(PARALLEL_MARK) diff --git a/include/private/config.h.in b/include/private/config.h.in index 6af87d14..a14c0f34 100644 --- a/include/private/config.h.in +++ b/include/private/config.h.in @@ -69,7 +69,7 @@ /* Define to support Solaris pthreads. */ #undef GC_SOLARIS_THREADS -/* Define to support threads. */ +/* Define to support platform-specific threads. */ #undef GC_THREADS /* See doc/README.macros. */ @@ -81,7 +81,10 @@ /* The minor version number of this GC release. */ #undef GC_VERSION_MINOR -/* Define to support win32 threads. */ +/* Define to support win32-pthreads. */ +#undef GC_WIN32_PTHREADS + +/* Define to support Win32 threads. */ #undef GC_WIN32_THREADS /* Define to 1 if you have the header file. */ diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index b38384cf..113b4aea 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -99,20 +99,15 @@ # define THREAD_EQUAL(id1, id2) ((id1) == (id2)) # define NUMERIC_THREAD_ID_UNIQUE # else -# if defined(GC_WIN32_PTHREADS) -# define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p)) - /* Using documented internal details of win32_pthread library. */ - /* Faster than pthread_equal(). Should not change with */ - /* future versions of win32_pthread library. */ -# define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) -# undef NUMERIC_THREAD_ID_UNIQUE -# else - /* Generic definitions that always work, but will result in */ - /* poor performance and weak assertion checking. */ -# define NUMERIC_THREAD_ID(id) 1l -# define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2) -# undef NUMERIC_THREAD_ID_UNIQUE -# endif +# define NUMERIC_THREAD_ID(id) ((unsigned long)(id.p)) + /* Using documented internal details of win32-pthread library. */ + /* Faster than pthread_equal(). Should not change with */ + /* future versions of win32-pthread library. */ +# define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) +# undef NUMERIC_THREAD_ID_UNIQUE + /* Generic definitions based on pthread_equal() always work but */ + /* will result in poor performance (as NUMERIC_THREAD_ID is */ + /* defined to just a constant) and weak assertion checking. */ # endif # define NO_THREAD ((unsigned long)(-1l)) /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */