[m-rev.] for review: don't hardcode the value of HBLKSIZE
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Dec 17 16:55:42 AEDT 2010
For review by Paul.
Branches: main
Only modify the value of Boehm GC HBLKSIZE macro on Linux.
Attempting this modification on other system, e.g. Mac OS X and
MinGW, results in a system that doesn't work.
configure.in:
Define a new configure variable, BOEHM_MISC_CFLAGS_FOR_THREADS,
that can be used to pass C compiler flags to the Boehm collector
in parallel grades on a system specific basis.
On Linux, modify the value of HBLKSIZE when building the collector
in parallel grades.
Mmake.common.in:
Delete the hardcoded setting of HBLKSIZE and use the new configure
variable.
Fix a comment.
Julien.
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.102
diff -u -r1.102 Mmake.common.in
--- Mmake.common.in 17 Dec 2010 00:28:08 -0000 1.102
+++ Mmake.common.in 17 Dec 2010 05:46:46 -0000
@@ -87,7 +87,7 @@
ERROR_UNDEFINED = $(ALLOW_UNDEFINED)
endif
-# The following variables specify how to pass options to the # $(CC) or
+# The following variables specify how to pass options to the $(CC) or
# $(LINK_SHARED_OBJ) command to specify directories to be searched at
# runtime for shared libraries.
# Normally RPATH_OPT is either "-R" or "-rpath ", but you may need to
@@ -161,13 +161,9 @@
# Additional options to pass to the C compiler when building Boehm-GC for
# threads.
#
-# HBLKSIZE and CPP_LOG_HBLKSIZE control a poorly-documented parameter in the
-# Boehm-GC, this parameter indirectly controls the size of thread-local free
-# lists among other things.
-# CPP_LOG_HBLKSIZE must always be the base-2 log of HBLKSIZE
BOEHM_CFLAGS_FOR_THREADS = @ENABLE_BOEHM_THREAD_LOCAL_ALLOC@ \
@ENABLE_BOEHM_PARALLEL_MARK@ \
- -DHBLKSIZE=32768 -DCPP_LOG_HBLKSIZE=15
+ @BOEHM_MISC_CFLAGS_FOR_THREADS@
# Do we want to deal with intermodule information when building the library?
# By default yes, since this way we note immediately when intermodule
Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.572
diff -u -r1.572 configure.in
--- configure.in 13 Dec 2010 05:59:41 -0000 1.572
+++ configure.in 17 Dec 2010 05:46:46 -0000
@@ -2907,11 +2907,10 @@
AC_DEFINE(MR_DIGITAL_UNIX_PTHREADS)
fi
-# Figure out what options we need to pass to the C compiler
-# for multithreading. We may need to pass different
-# options to tell (a) the Mercury runtime & library
-# (b) the boehm collector and (c) the C library
-# that they need to be thread-safe.
+# Figure out what options we need to pass to the C compiler for multithreading.
+# We may need to pass different options to tell (a) the Mercury runtime and
+# library (b) the Boehm collector and (c) the C library that they need to be
+# thread-safe.
#
# For Linux, Irix, Solaris, and HPUX,
# the thread-enabled version of the Boehm
@@ -2923,10 +2922,17 @@
# is enabled.
#
# Note that changes here may require changes in scripts/ml.in.
+#
LDFLAGS_FOR_THREADS=
LD_LIBFLAGS_FOR_THREADS=
ENABLE_BOEHM_THREAD_LOCAL_ALLOC=
ENABLE_BOEHM_PARALLEL_MARK=
+
+# This following variable is used for passing any other C compiler
+# flags to the version of the Boehm GC built in parallel grades.
+#
+BOEHM_MISC_CFLAGS_FOR_THREADS=
+
case "$host" in
*solaris*)
CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE \
@@ -2944,6 +2950,13 @@
THREAD_LIBS="-lpthread -ldl"
ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
+ # HBLKSIZE and CPP_LOG_HBLKSIZE control a poorly-documented parameter
+ # in the Boehm GC, this parameter indirectly controls the size of
+ # thread-local free lists among other things.
+ # CPP_LOG_HBLKSIZE must always be the base-2 log of HBLKSIZE.
+ # (With the current collector these settings only appear to work
+ # correctly on Linux.)
+ BOEHM_MISC_CFLAGS_FOR_THREADS="-DHBLKSIZE=32768 -DCPP_LOG_HBLKSIZE=15"
;;
*cygwin*)
@@ -3019,6 +3032,7 @@
AC_SUBST(LD_LIBFLAGS_FOR_THREADS)
AC_SUBST(ENABLE_BOEHM_THREAD_LOCAL_ALLOC)
AC_SUBST(ENABLE_BOEHM_PARALLEL_MARK)
+AC_SUBST(BOEHM_MISC_CFLAGS_FOR_THREADS)
save_LIBS="$LIBS"
LIBS="$THREAD_LIBS"
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list