Turn on parallel marker by default for all multi-threaded builds
authorIvan Maidanski <ivmai@mail.ru>
Sat, 22 Apr 2017 15:21:09 +0000 (18:21 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sat, 22 Apr 2017 15:21:09 +0000 (18:21 +0300)
Note: if some target does not support PARALLEL_MARK, it should be
fixed (or a workaround should be added).

* CMakeLists.txt (enable_parallel_mark): Change default value to ON.
* CMakeLists.txt [enable_parallel_mark] (PARALLEL_MARK): Define only
along with GC_LINUX_THREADS, or GC_AIX_THREADS, or GC_HPUX_THREADS, or
GC_OPENBSD_THREADS, or GC_FREEBSD_THREADS, or GC_NETBSD_THREADS, or
GC_SOLARIS_THREADS, or GC_IRIX_THREADS, or GC_THREADS, or
GC_DARWIN_THREADS, or GC_OSF1_THREADS.
* configure.ac (PARALLEL_MARK): Always define unless threads are
disabled or enable_parallel_mark is "no".

CMakeLists.txt
configure.ac

index 049fb02..2d924b8 100644 (file)
@@ -61,7 +61,7 @@ IF(enable_threads)
         SET(LIBS ${LIBS} ${Threads_LIBRARIES})
 ENDIF(enable_threads)
 
-OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO)
+OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON)
 
 #IF(Threads_FOUND)
 #       ADD_DEFINITIONS("")
@@ -69,10 +69,6 @@ OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO)
 #       MESSAGE("Parallel mark requires enable_threads ON" )
 #ENDIF(Threads_FOUND)
 
-IF(enable_parallel_mark)
-        ADD_DEFINITIONS("-DPARALLEL_MARK")
-ENDIF(enable_parallel_mark)
-
 OPTION(enable_cplusplus "install C++ support" NO)
 
 SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field.Use lowercase
@@ -87,6 +83,9 @@ IF(CMAKE_USE_PTHREADS_INIT)
         IF( HOST MATCHES x86-.*-linux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86_64-.*-linux.*|alpha-.*-linux.*|sparc.*-.*-linux.*)
                 ADD_DEFINITIONS("-DGC_LINUX_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.")
@@ -94,10 +93,16 @@ IF(CMAKE_USE_PTHREADS_INIT)
         IF ( HOST MATCHES .*-.*-linux.*)
                 ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                 ADD_DEFINITIONS("-D_REENTRANT")
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         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)
         ENDIF()
         IF ( HOST MATCHES .*-.*-hpux11.*)
                 MESSAGE("Only HP/UX 11 POSIX threads are supported.")
@@ -105,20 +110,32 @@ IF(CMAKE_USE_PTHREADS_INIT)
                 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
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         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)
         ENDIF()
         IF ( HOST MATCHES .*-.*-freebsd.*)
                 MESSAGE("FreeBSD does not yet fully support threads with Boehm GC.")
                 ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         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)
@@ -126,6 +143,9 @@ IF(CMAKE_USE_PTHREADS_INIT)
         IF ( HOST MATCHES .*-.*-gnu.*)
                 ADD_DEFINITIONS("-DGC_GNU_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()
@@ -134,9 +154,15 @@ IF(CMAKE_USE_PTHREADS_INIT)
                 ADD_DEFINITIONS("-DGC_NETBSD_THREADS")
                 ADD_DEFINITIONS("-D_REENTRANT")
                 ADD_DEFINITIONS("-D_PTHREADS")
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         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
@@ -148,9 +174,15 @@ IF(CMAKE_USE_PTHREADS_INIT)
         ENDIF()
         IF ( HOST MATCHES .*-.*-irix.*)
                 ADD_DEFINITIONS("-DGC_IRIX_THREADS")
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         ENDIF()
         IF ( HOST MATCHES .*-.*-cygwin.*)
                 ADD_DEFINITIONS("-DGC_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
@@ -158,6 +190,9 @@ IF(CMAKE_USE_PTHREADS_INIT)
         ENDIF()
         IF ( HOST MATCHES .*-.*-darwin.*)
                 ADD_DEFINITIONS("-DGC_DARWIN_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)
@@ -167,6 +202,7 @@ IF(CMAKE_USE_PTHREADS_INIT)
         IF ( HOST MATCHES .*-.*-osf*)
                 ADD_DEFINITIONS("-DGC_OSF1_THREADS")
                 IF(enable_parallel_mark)
+                        ADD_DEFINITIONS("-DPARALLEL_MARK")
                         ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
                         SET(SRC ${SRC} thread_local_alloc.c)
                         MESSAGE("Explicit GC_INIT() calls may be required.")
@@ -177,6 +213,9 @@ IF(CMAKE_USE_PTHREADS_INIT)
         IF ( HOST MATCHES .*-.*-linux.*)
                 ADD_DEFINITIONS("-DGC_LINUX_THREADS")
                 ADD_DEFINITIONS("-D_REENTRANT")
+                IF(enable_parallel_mark)
+                    ADD_DEFINITIONS("-DPARALLEL_MARK")
+                ENDIF(enable_parallel_mark)
         ENDIF()
 ENDIF(CMAKE_USE_PTHREADS_INIT)
 
@@ -184,6 +223,7 @@ IF(CMAKE_USE_WIN32_THREADS_INIT)
         ADD_DEFINITIONS("-DGC_THREADS")
         #win32_threads=true   TODO
         IF(enable_parallel_mark)
+                ADD_DEFINITIONS("-DPARALLEL_MARK")
                 ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
                 SET(SRC ${SRC} thread_local_alloc.c)
         ENDIF()
index 94e6fbc..f96077d 100644 (file)
@@ -205,7 +205,7 @@ case "$THREADS" in
         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
+        if test "${enable_parallel_mark}" != no; then
           AC_DEFINE(PARALLEL_MARK)
         fi
         AC_DEFINE(THREAD_LOCAL_ALLOC)
@@ -226,7 +226,7 @@ case "$THREADS" in
         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
         AC_DEFINE(GC_FREEBSD_THREADS)
         AM_CFLAGS="$AM_CFLAGS -pthread"
-        if test "${enable_parallel_mark}" = yes; then
+        if test "${enable_parallel_mark}" != no; then
           AC_DEFINE(PARALLEL_MARK)
         fi
         AC_DEFINE(THREAD_LOCAL_ALLOC)
@@ -236,7 +236,7 @@ case "$THREADS" in
         AM_CFLAGS="$AM_CFLAGS -pthread"
         THREADDLLIBS=-pthread
         AC_DEFINE(_REENTRANT)
-        if test "${enable_parallel_mark}" = yes; then
+        if test "${enable_parallel_mark}" != no; then
           AC_DEFINE(PARALLEL_MARK)
         fi
         AC_DEFINE(THREAD_LOCAL_ALLOC)
@@ -302,12 +302,10 @@ case "$THREADS" in
         ;;
      *-*-osf*)
         AC_DEFINE(GC_OSF1_THREADS)
-        if test "${enable_parallel_mark}" = yes; then
+        if test "${enable_parallel_mark}" != no; then
           AC_DEFINE(PARALLEL_MARK)
           AC_DEFINE(THREAD_LOCAL_ALLOC)
           AC_MSG_WARN("Explicit GC_INIT() calls may be required.");
-          # May want to enable it in other cases, too.
-          # Measurements have not yet been done.
         fi
         AM_CFLAGS="$AM_CFLAGS -pthread"
         THREADDLLIBS="-lpthread -lrt"
@@ -348,7 +346,7 @@ case "$THREADS" in
     AC_MSG_RESULT($THREADDLLIBS)
     # Use pthread GCC switch
     THREADDLLIBS=-pthread
-    if test "${enable_parallel_mark}" = yes; then
+    if test "${enable_parallel_mark}" != no; then
         AC_DEFINE(PARALLEL_MARK)
     fi
     AC_DEFINE(THREAD_LOCAL_ALLOC)