From d93ce089a3c505d09a9b4d6fe53dd7ca1dbd14b7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 9 Aug 2013 06:36:55 -0600 Subject: [PATCH] fixes of OpenSolaris Make the GC always use the mmap() block cache, since mmap() on Solaris allocates much more than a page when a single page is requested. Enable places and threads by default on x86 and x86_64. Fix pthread-related compilation flags. --- racket/src/configure | 13 +++++++++++++ racket/src/racket/configure.ac | 13 +++++++++++++ racket/src/racket/gc2/vm.c | 4 ++-- racket/src/racket/sconfig.h | 9 ++++++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/racket/src/configure b/racket/src/configure index dc8d3ba112..317bf84a03 100755 --- a/racket/src/configure +++ b/racket/src/configure @@ -2512,6 +2512,7 @@ STRIP_DEBUG=":" enable_strip_by_default=yes use_flag_pthread=yes +use_flag_posix_pthread=no skip_iconv_check=no ###### OSKit stuff ####### @@ -4073,6 +4074,15 @@ case "$host_os" in need_gcc_static_libgcc="yes" check_gcc_dash_e="yes" try_poll_syscall="yes" + use_flag_pthread="no" + use_flag_posix_pthread="yes" + case "$host_cpu" in + x86_64|i386|i486|i586|i686) + enable_parallel_by_default=yes + ;; + *) + ;; + esac ;; aix*) enable_cgcdefault="yes" @@ -8803,6 +8813,9 @@ if test "${enable_pthread}" = "yes" ; then PREFLAGS="$PREFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi + if test "${use_flag_posix_pthread}" = "yes" ; then + PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS" + fi cat >>confdefs.h <<\_ACEOF #define USE_PTHREAD_INSTEAD_OF_ITIMER 1 diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index 219b1d58c1..32e8581218 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -408,6 +408,7 @@ STRIP_DEBUG=":" enable_strip_by_default=yes use_flag_pthread=yes +use_flag_posix_pthread=no skip_iconv_check=no ###### OSKit stuff ####### @@ -570,6 +571,15 @@ case "$host_os" in need_gcc_static_libgcc="yes" check_gcc_dash_e="yes" try_poll_syscall="yes" + use_flag_pthread="no" + use_flag_posix_pthread="yes" + case "$host_cpu" in + x86_64|i386|i486|i586|i686) + enable_parallel_by_default=yes + ;; + *) + ;; + esac ;; aix*) enable_cgcdefault="yes" @@ -1204,6 +1214,9 @@ if test "${enable_pthread}" = "yes" ; then PREFLAGS="$PREFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" fi + if test "${use_flag_posix_pthread}" = "yes" ; then + PREFLAGS="$PREFLAGS -D_POSIX_PTHREAD_SEMANTICS" + fi AC_DEFINE(USE_PTHREAD_INSTEAD_OF_ITIMER, 1, [Pthread timer enabled]) [ msg="whether pthread_rwlock is available" ] diff --git a/racket/src/racket/gc2/vm.c b/racket/src/racket/gc2/vm.c index 1a002c4aa7..d450b5aab3 100644 --- a/racket/src/racket/gc2/vm.c +++ b/racket/src/racket/gc2/vm.c @@ -16,8 +16,8 @@ enum { MMU_WRITABLE = 1, }; -#if defined(MZ_USE_PLACES) && !defined(_WIN32) -#define USE_BLOCK_CACHE +#if (defined(MZ_USE_PLACES) && !defined(_WIN32)) || defined(PREFER_MMAP_LARGE_BLOCKS) +# define USE_BLOCK_CACHE #endif struct BlockCache; diff --git a/racket/src/racket/sconfig.h b/racket/src/racket/sconfig.h index 8a3b9cb077..f475598431 100644 --- a/racket/src/racket/sconfig.h +++ b/racket/src/racket/sconfig.h @@ -114,6 +114,8 @@ # define USE_ON_EXIT_FOR_ATEXIT # endif +# define PREFER_MMAP_LARGE_BLOCKS + # define FMOD_CAN_RETURN_POS_ZERO # ifdef i386 @@ -1610,9 +1612,14 @@ /* Miscellaneous */ /***********************/ - /* USE_MAP_ANON indicates that mmap should use BSD's MAP_ANON flag + /* USE_MAP_ANON indicates that mmap() should use BSD's MAP_ANON flag rather than trying to open /dev/zero */ + /* PREFER_MMAP_LARGE_BLOCKS indicates that mmap() should be called with + large block sizes as much as possible, because the actual allocated + size for small requests (on the order of the page size) is much + larger than the request. */ + /* REGISTER_POOR_MACHINE guides a hand optimization that seems to be work best one way for Sparc machines, and better the other way for x86 machines. */