From ba59239378060823eba2205bd0daa8e27fd6aed4 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 7 Jul 2006 00:15:39 +0000 Subject: [PATCH] automate endian and 64-bit-ints configuration svn: r3641 --- src/configure | 239 +++++++++++++++++++++++++++++++++- src/mzscheme/configure.ac | 14 +- src/mzscheme/include/scheme.h | 11 ++ src/mzscheme/mzconfig.h.in | 9 +- src/mzscheme/sconfig.h | 40 +----- src/mzscheme/sgc/collect.inc | 14 ++ src/mzscheme/sgc/sgc.c | 107 ++++++++------- src/mzscheme/src/salloc.c | 14 +- src/wxmac/src/mac/wx_gdi.cc | 3 +- 9 files changed, 351 insertions(+), 100 deletions(-) diff --git a/src/configure b/src/configure index 0d8f713aa4..3bfed1f058 100755 --- a/src/configure +++ b/src/configure @@ -1529,7 +1529,7 @@ fi OS=`$UNAME -s` -###### Get data sizes ####### +###### Get data sizes and direction ####### ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -5070,7 +5070,7 @@ fi echo "$as_me:$LINENO: result: $stack_direction" >&5 echo "${ECHO_T}$stack_direction" >&6 -if test "${stack_direction}" = "uknown" ; then +if test "${stack_direction}" = "unknown" ; then echo configure: cannot determine stack direction exit 1 fi @@ -5090,6 +5090,241 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + endianness=big ;; + no) + endianness=little ;; + *) + endiannes=unknown ;; +esac + +if test "${endianness}" = "unknown" ; then + echo configure: cannot determine endianness + exit 1 +fi + +if test "${endianness}" = "big" ; then + +cat >>confdefs.h <<\_ACEOF +#define SCHEME_BIG_ENDIAN 1 +_ACEOF + +fi + ###### Some flags imply other flags ####### if test "${enable_smalloskit}" = "yes" ; then diff --git a/src/mzscheme/configure.ac b/src/mzscheme/configure.ac index d7c4746b66..cc83bca086 100644 --- a/src/mzscheme/configure.ac +++ b/src/mzscheme/configure.ac @@ -81,7 +81,7 @@ fi OS=`$UNAME -s` -###### Get data sizes ####### +###### Get data sizes and direction ####### AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) @@ -105,7 +105,7 @@ AC_TRY_RUN( }, stack_direction=up, stack_direction=down, stack_direction=unknown) AC_MSG_RESULT($stack_direction) -if test "${stack_direction}" = "uknown" ; then +if test "${stack_direction}" = "unknown" ; then echo configure: cannot determine stack direction exit 1 fi @@ -117,6 +117,16 @@ if test "${stack_direction}" = "down" ; then AC_DEFINE(STACK_DIRECTION,-1,[Stack direction down]) fi +AC_C_BIGENDIAN(endianness=big, endianness=little, endiannes=unknown) +if test "${endianness}" = "unknown" ; then + echo configure: cannot determine endianness + exit 1 +fi + +if test "${endianness}" = "big" ; then + AC_DEFINE(SCHEME_BIG_ENDIAN,1,[Big endian]) +fi + ###### Some flags imply other flags ####### if test "${enable_smalloskit}" = "yes" ; then diff --git a/src/mzscheme/include/scheme.h b/src/mzscheme/include/scheme.h index 139d882886..00c179697c 100644 --- a/src/mzscheme/include/scheme.h +++ b/src/mzscheme/include/scheme.h @@ -77,6 +77,16 @@ # define FUEL_AUTODECEREMENTS #endif +#ifdef SIZEOF_LONG +# if SIZEOF_LONG == 8 +# define SIXTY_FOUR_BIT_INTEGERS +# ifdef USE_LONG_LONG_FOR_BIGDIG + Don ot specify USE_LONG_LONG_FOR_BIGDIG on a platform with + 64-bit integers +# endif +# endif +#endif + #ifdef MZ_PRECISE_GC # define MZ_HASH_KEY_EX short keyex; # define MZ_OPT_HASH_KEY_EX /**/ @@ -1475,6 +1485,7 @@ void *scheme_malloc(size_t size); # ifdef USE_TAGGED_ALLOCATION extern void *scheme_malloc_tagged(size_t); # define scheme_malloc_array_tagged scheme_malloc +# define scheme_malloc_small_tagged scheme_malloc extern void *scheme_malloc_atomic_tagged(size_t); extern void *scheme_malloc_stubborn_tagged(size_t); extern void *scheme_malloc_eternal_tagged(size_t); diff --git a/src/mzscheme/mzconfig.h.in b/src/mzscheme/mzconfig.h.in index 85308ae2dd..2d7056aacd 100644 --- a/src/mzscheme/mzconfig.h.in +++ b/src/mzscheme/mzconfig.h.in @@ -20,13 +20,16 @@ /* The size of a `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG -/* Direction of stack growth: 1 = up, -1 = down, 0 = unknown */ +/* Endianness. */ +#undef SCHEME_BIG_ENDIAN + +/* Direction of stack growth: 1 = up, -1 = down, 0 = unknown. */ #undef STACK_DIRECTION -/* whether nl_langinfo works */ +/* Whether nl_langinfo works. */ #undef HAVE_CODESET -/* whether getaddrinfo works */ +/* Whether getaddrinfo works. */ #undef HAVE_GETADDRINFO diff --git a/src/mzscheme/sconfig.h b/src/mzscheme/sconfig.h index fc9779cbdd..ae255b6001 100644 --- a/src/mzscheme/sconfig.h +++ b/src/mzscheme/sconfig.h @@ -82,10 +82,6 @@ # include "uconfig.h" -# ifndef i386 -# define SCHEME_BIG_ENDIAN -# endif - # define USE_EXPLICT_FP_FORM_CHECK # define POW_HANDLES_INF_CORRECTLY @@ -136,7 +132,6 @@ # include "uconfig.h" # undef USE_FCHDIR -# define SCHEME_BIG_ENDIAN # define UNIX_LIMIT_STACK 33554944 # define SELECT_INCLUDE @@ -186,11 +181,6 @@ # define SCHEME_PLATFORM_LIBRARY_SUBPATH "unknown-linux" # endif -# include -# if __BYTE_ORDER == __BIG_ENDIAN -# define SCHEME_BIG_ENDIAN -# endif - # include "uconfig.h" # undef HAS_STANDARD_IOB # ifndef __ELF__ @@ -201,14 +191,6 @@ # define HAS_LINUX_IOB -# if defined(__alpha) || defined(__x86_64__) -# define SIXTY_FOUR_BIT_INTEGERS -# endif - -# if defined(__hppa__) -# define SIXTY_FOUR_BIT_INTEGERS -# endif - # define USE_IEEE_FP_PREDS # define USE_EXPLICT_FP_FORM_CHECK @@ -260,7 +242,6 @@ # define USE_TM_GMTOFF_FIELD #if defined(__alpha__) -# define SIXTY_FOUR_BIT_INTEGERS # define USE_DIVIDE_MAKE_INFINITY #endif @@ -355,8 +336,6 @@ # include "uconfig.h" -# define SCHEME_BIG_ENDIAN - # define DIRENT_NO_NAMLEN # define BSTRING_INCLUDE @@ -389,8 +368,6 @@ # define DIRENT_NO_NAMLEN -# define SCHEME_BIG_ENDIAN - # define NO_USLEEP # define USE_FCNTL_O_NONBLOCK @@ -406,8 +383,6 @@ # include "uconfig.h" -# define SIXTY_FOUR_BIT_INTEGERS - # define ALPHA_CONTROL_FP # define USE_OSF_FP_PREDS # define USE_DIVIDE_MAKE_INFINITY @@ -425,8 +400,6 @@ # include "uconfig.h" -# define SCHEME_BIG_ENDIAN - # define SOME_FDS_ARE_NOT_SELECTABLE # define USE_FCNTL_O_NONBLOCK @@ -649,9 +622,6 @@ # define SYSTEM_TYPE_NAME "macosx" #endif -#ifdef __POWERPC__ -# define SCHEME_BIG_ENDIAN -#endif # define USE_MAP_ANON # define USE_CARBON_FP_PREDS @@ -746,8 +716,6 @@ # define LINK_EXTENSIONS_BY_TABLE # endif -# define SCHEME_BIG_ENDIAN - # define DO_STACK_CHECK # define MACOS_FIND_STACK_BOUNDS # define STACK_SAFETY_MARGIN 10000 @@ -837,8 +805,6 @@ # define NO_USER_BREAK_HANDLER # define NO_USLEEP -# define SCHEME_BIG_ENDIAN - # define DO_STACK_CHECK # define PALM_FIND_STACK_BOUNDS # define STACK_SAFETY_MARGIN 1000 @@ -1207,8 +1173,6 @@ /* Byte Order and long long */ /****************************/ - /* SCHEME_BIG_ENDIAN indicates that the process is big-endian */ - /* INT64_AS_LONG_LONG indicates that long long is not supported, but _int64 is */ @@ -1345,10 +1309,8 @@ be work best one way for Sparc machines, and better the other way for x86 machines. */ - /* SIXTY_FOUR_BIT_INTEGERS indicates that 'long's are 64-bits wide. */ - /* USE_LONG_LONG_FOR_BIGDIG indicates that `long long' is available - and 64 bits wide (don't mix with SIXTY_FOUR_BIT_INTEGERS). */ + and 64 bits wide. (Don't use when `long' is 64 bits wide). */ /* MACOS_UNICODE_SUPPORT and WINDOWS_UNICODE_SUPPORT indicate that platform-native functions should be used for string comparisons diff --git a/src/mzscheme/sgc/collect.inc b/src/mzscheme/sgc/collect.inc index 639b169b5f..cb3709819f 100644 --- a/src/mzscheme/sgc/collect.inc +++ b/src/mzscheme/sgc/collect.inc @@ -46,7 +46,9 @@ static void COLLECT(OFFSET_ARG) { +#ifndef SIXTY_FOUR_BIT_INTEGERS SectorPage **local_sector_pagetables; +#endif unsigned local_low_plausible; unsigned local_high_plausible; int local_collect_stack_size; @@ -55,7 +57,9 @@ static void COLLECT(OFFSET_ARG) long local_mem_use; /* Download globals into locals so they can be put in registers: */ +#ifndef SIXTY_FOUR_BIT_INTEGERS local_sector_pagetables = sector_pagetables; +#endif local_low_plausible = low_plausible; local_high_plausible = high_plausible; local_collect_stack_size = collect_stack_size; @@ -130,7 +134,17 @@ static void COLLECT(OFFSET_ARG) MARK_STATISTIC(num_interior_checks_stat++); #endif if (p >= local_low_plausible && p < local_high_plausible && ALIGNED(p)) { +#ifdef SIXTY_FOUR_BIT_INTEGERS + SectorPage *pagetable; + DECL_SECTOR_PAGETABLES; + FIND_SECTOR_PAGETABLES(p); + if (sector_pagetables) + pagetable = sector_pagetables[SECTOR_LOOKUP_PAGETABLE(p)]; + else + pagetable = NULL; +#else SectorPage *pagetable = local_sector_pagetables[SECTOR_LOOKUP_PAGETABLE(p)]; +#endif MARK_STATISTIC(num_plausibles_stat++); diff --git a/src/mzscheme/sgc/sgc.c b/src/mzscheme/sgc/sgc.c index 9ae9774872..f3d325fcb5 100644 --- a/src/mzscheme/sgc/sgc.c +++ b/src/mzscheme/sgc/sgc.c @@ -31,8 +31,15 @@ #include #include #include "../sconfig.h" +#include "mzconfig.h" #include "sgc.h" +#ifdef SIZEOF_LONG +# if SIZEOF_LONG == 8 +# define SIXTY_FOUR_BIT_INTEGERS +# endif +#endif + /****************************************************************************/ /* Option bundles */ /****************************************************************************/ @@ -323,8 +330,7 @@ #define SECTOR_LOOKUP_PAGETABLE(x) (LOW_32_BITS(x) >> SECTOR_LOOKUP_SHIFT) #define SECTOR_LOOKUP_PAGEPOS(x) ((LOW_32_BITS(x) >> LOG_SECTOR_SEGMENT_SIZE) & SECTOR_LOOKUP_PAGEMASK) -#define LOG_SECTOR_PAGEREC_SIZE (LOG_MAP_PTR_SIZE + 1) - +#define LOG_SECTOR_PAGEREC_SIZE (LOG_PTR_SIZE + 1) /***************************************************************************/ @@ -569,46 +575,6 @@ typedef struct { is deallocated, but 0 => not in any sector */ } SectorPage; -#ifdef SIXTY_FOUR_BIT_INTEGERS -static SectorPage ***sector_pagetablesss[1 << 16]; -# define DECL_SECTOR_PAGETABLES SectorPage **sector_pagetables; -# define GET_SECTOR_PAGETABLES(p) sector_pagetables = create_sector_pagetables(p); -# define FIND_SECTOR_PAGETABLES(p) sector_pagetables = get_sector_pagetables(p); if (!sector_pagetables) return NULL -inline static SectorPage **create_sector_pagetables(unsigned long p) { - unsigned long pos; - SectorPage ***sector_pagetabless, **sector_pagetables; - pos = (unsigned long)p >> 48; - sector_pagetabless = sector_pagetablesss[pos]; - if (!sector_pagetabless) { - sector_pagetabless = (SectorPage ***)malloc_plain_sector(sizeof(SectorPage **) * (1 << 16)); - sector_pagetablesss[pos] = sector_pagetabless; - } - pos = ((unsigned long)p >> 32) & ((1 << 16) - 1); - sector_pagetables = sector_pagetabless[pos]; - if (!sector_pagetables) { - sector_pagetables = (SectorPage **)malloc_plain_sector(sizeof(SectorPage *) * (1 << USEFUL_ADDR_BITS)); - sector_pagetabless[pos] = sector_pagetables; - } - return sector_pagetables; -} -inline static SectorPage **get_sector_pagetables(unsigned long p) { - unsigned long pos; - SectorPage ***sector_pagetabless; - pos = (unsigned long)p >> 48; - sector_pagetabless = sector_pagetablesss[pos]; - if (!sector_pagetabless) - return NULL; - pos = ((unsigned long)p >> 32) & ((1 << 16) - 1); - return sector_pagetabless[pos]; -} -#else -static SectorPage **sector_pagetables; -# define DECL_SECTOR_PAGETABLES /**/ -# define GET_SECTOR_PAGETABLES(p) /**/ -# define FIND_SECTOR_PAGETABLES(p) /**/ -#endif - - #if !RELEASE_UNUSED_SECTORS # include "../utils/splay.c" @@ -844,6 +810,56 @@ static void free_error(const char *msg) } #endif +/*************************************************************/ +/* Page mapping: */ + +#ifdef SIXTY_FOUR_BIT_INTEGERS +static SectorPage ***sector_pagetablesss[1 << 16]; +# define DECL_SECTOR_PAGETABLES SectorPage **sector_pagetables; +# define GET_SECTOR_PAGETABLES(p) sector_pagetables = create_sector_pagetables(p) +# define FIND_SECTOR_PAGETABLES(p) sector_pagetables = get_sector_pagetables(p); +static void *malloc_plain_sector(int count); +inline static SectorPage **create_sector_pagetables(unsigned long p) { + unsigned long pos; + SectorPage ***sector_pagetabless, **sector_pagetables; + pos = (unsigned long)p >> 48; + sector_pagetabless = sector_pagetablesss[pos]; + if (!sector_pagetabless) { + int c = (sizeof(SectorPage **) << 16) >> LOG_SECTOR_SEGMENT_SIZE; + sector_pagetabless = (SectorPage ***)malloc_plain_sector(c); + sector_pagetablesss[pos] = sector_pagetabless; + sector_admin_mem_use += (c << LOG_SECTOR_SEGMENT_SIZE); + } + pos = ((unsigned long)p >> 32) & ((1 << 16) - 1); + sector_pagetables = sector_pagetabless[pos]; + if (!sector_pagetables) { + int c = (SECTOR_LOOKUP_PAGESETBITS + LOG_PTR_SIZE) - LOG_SECTOR_SEGMENT_SIZE; + if (c < 0) + c = 0; + c = 1 << c; + sector_pagetables = (SectorPage **)malloc_plain_sector(c); + sector_admin_mem_use += (c << LOG_SECTOR_SEGMENT_SIZE); + sector_pagetabless[pos] = sector_pagetables; + } + return sector_pagetables; +} +inline static SectorPage **get_sector_pagetables(unsigned long p) { + unsigned long pos; + SectorPage ***sector_pagetabless; + pos = (unsigned long)p >> 48; + sector_pagetabless = sector_pagetablesss[pos]; + if (!sector_pagetabless) + return NULL; + pos = ((unsigned long)p >> 32) & ((1 << 16) - 1); + return sector_pagetabless[pos]; +} +#else +static SectorPage **sector_pagetables; +# define DECL_SECTOR_PAGETABLES /**/ +# define GET_SECTOR_PAGETABLES(p) /**/ +# define FIND_SECTOR_PAGETABLES(p) /**/ +#endif + /*************************************************************/ /* @@ -1025,9 +1041,8 @@ static void register_sector(void *naya, int need, long kind) if (!pagetable) { int c = (LOG_SECTOR_LOOKUP_PAGESIZE + LOG_SECTOR_PAGEREC_SIZE) - LOG_SECTOR_SEGMENT_SIZE; int j; - if (c < 0) - c = 0; + c = 0; c = 1 << c; pagetable = (SectorPage *)malloc_plain_sector(c); sector_pagetables[pagetableindex] = pagetable; @@ -1046,7 +1061,7 @@ static void register_sector(void *naya, int need, long kind) static void *malloc_sector(long size, long kind, int no_new) { - long need, i; + long need; void *naya; #if !RELEASE_UNUSED_SECTORS SectorFreepage *fp; @@ -1063,7 +1078,7 @@ static void *malloc_sector(long size, long kind, int no_new) #ifndef SIXTY_FOUR_BIT_INTEGERS if (!sector_pagetables) { - int c = (SECTOR_LOOKUP_PAGESETBITS + LOG_PTR_SIZE) - LOG_SECTOR_SEGMENT_SIZE; + int i, c = (SECTOR_LOOKUP_PAGESETBITS + LOG_PTR_SIZE) - LOG_SECTOR_SEGMENT_SIZE; if (c < 0) c = 0; c = 1 << c; diff --git a/src/mzscheme/src/salloc.c b/src/mzscheme/src/salloc.c index 9a3108dfcf..924e82a3dc 100644 --- a/src/mzscheme/src/salloc.c +++ b/src/mzscheme/src/salloc.c @@ -1135,12 +1135,14 @@ Scheme_Object *scheme_dump_gc_stats(int c, Scheme_Object *p[]) int path_length_limit = 1000; GC_for_each_found_proc for_each_found = NULL; #else -# define flags 0 -# define trace_for_tag 0 -# define path_length_limit 1000 -# define for_each_found NULL -# define GC_get_xtagged_name NULL -# define print_tagged_value NULL +# ifndef USE_TAGGED_ALLOCATION +# define flags 0 +# define trace_for_tag 0 +# define path_length_limit 1000 +# define for_each_found NULL +# define GC_get_xtagged_name NULL +# define print_tagged_value NULL +# endif #endif scheme_start_atomic(); diff --git a/src/wxmac/src/mac/wx_gdi.cc b/src/wxmac/src/mac/wx_gdi.cc index 2051cd1a41..6cf06abd8f 100644 --- a/src/wxmac/src/mac/wx_gdi.cc +++ b/src/wxmac/src/mac/wx_gdi.cc @@ -314,7 +314,7 @@ long wxTextFontInfo(int font, int size, int face, FontInfo *finfo, char *str, if (str) { if (len < 0) - strlen(str XFORM_OK_PLUS d); + len = strlen(str XFORM_OK_PLUS d); result = TextWidth(str XFORM_OK_PLUS d, 0, len); } @@ -872,7 +872,6 @@ int wxDisplayDepth(void) void wxDisplaySize(int *width, int *height, int flags) { BitMap screenBits; - int mbh; if (!flags) { Rect r;