SET(LIBS ${LIBS} ${Threads_LIBRARIES})
ENDIF(enable_threads)
+OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON)
+
OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON)
#IF(Threads_FOUND)
#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 thread_local_alloc.c)
+ SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c)
# Common defines for most POSIX platforms.
IF( HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*)
ADD_DEFINITIONS("-DGC_THREADS -D_REENTRANT")
IF(enable_parallel_mark)
ADD_DEFINITIONS("-DPARALLEL_MARK")
ENDIF(enable_parallel_mark)
- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
+ IF(enable_thread_local_alloc)
+ ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
+ SET(SRC ${SRC} thread_local_alloc.c)
+ ENDIF(enable_thread_local_alloc)
MESSAGE("Explicit GC_INIT() calls may be required.")
ENDIF()
IF ( HOST MATCHES .*-.*-hpux11.*)
ADD_DEFINITIONS("-DGC_THREADS")
IF(enable_parallel_mark)
ADD_DEFINITIONS("-DPARALLEL_MARK")
- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
- SET(SRC ${SRC} thread_local_alloc.c)
+ IF(enable_thread_local_alloc)
+ ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
+ SET(SRC ${SRC} thread_local_alloc.c)
+ ENDIF(enable_thread_local_alloc)
ENDIF()
ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test
SET(SRC ${SRC} win32_threads.c)
esac ]
)
+AC_ARG_ENABLE(thread-local-alloc,
+ [AC_HELP_STRING([--disable-thread-local-alloc],
+ [turn off thread-local allocation optimization])],
+ [case "$THREADS" in
+ no | none | single)
+ if test "${enable_thread_local_alloc}" = yes; then
+ AC_MSG_ERROR(
+ [Thread-local allocation requires --enable-threads=x spec])
+ fi
+ ;;
+ esac])
+
AC_ARG_ENABLE(cplusplus,
[AC_HELP_STRING([--enable-cplusplus], [install C++ support])])
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
fi
- AC_DEFINE(THREAD_LOCAL_ALLOC)
+ if test "${enable_thread_local_alloc}" != no; then
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ fi
AC_MSG_WARN("Explicit GC_INIT() calls may be required.")
;;
esac
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
fi
- AC_DEFINE(THREAD_LOCAL_ALLOC)
+ if test "${enable_thread_local_alloc}" != no; then
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ fi
THREADDLLIBS="-lpthread"
win32_threads=true
;;
AC_DEFINE(GC_THREADS)
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
- AC_DEFINE(THREAD_LOCAL_ALLOC)
- else
- if test "${enable_shared}" != yes || test "${enable_static}" != no; then
+ fi
+ if test "${enable_thread_local_alloc}" != no; then
+ if test "${enable_parallel_mark}" != no \
+ -o "${enable_shared}" != yes -o "${enable_static}" != no; then
# Imply THREAD_LOCAL_ALLOC unless GC_DLL.
AC_DEFINE(THREAD_LOCAL_ALLOC)
fi
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
fi
- AC_DEFINE(THREAD_LOCAL_ALLOC)
+ if test "${enable_thread_local_alloc}" != no; then
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ fi
AC_MSG_WARN("Explicit GC_INIT() calls may be required.")
AM_CFLAGS="-pthread $AM_CFLAGS"
;;
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
fi
- AC_DEFINE(THREAD_LOCAL_ALLOC)
+ if test "${enable_thread_local_alloc}" != no; then
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ fi
;;
rtems)
THREADS=posix
if test "${enable_parallel_mark}" != no; then
AC_DEFINE(PARALLEL_MARK)
fi
- AC_DEFINE(THREAD_LOCAL_ALLOC)
+ if test "${enable_thread_local_alloc}" != no; then
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ fi
;;
decosf1 | irix | mach | os2 | solaris | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
+AM_CONDITIONAL(THREAD_LOCAL_ALLOC,
+ test x$enable_thread_local_alloc != xno -a x$THREADS != xnone)
compiler_suncc=no
case "$host" in