From: Stefan Monnier Date: Thu, 13 May 2004 17:12:21 +0000 (+0000) Subject: (USE_LSB_TAG): Make it the default when it is known to work. X-Git-Tag: ttn-vms-21-2-B4~6243 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6c741f9422833bed2fae805185754ec38b1030d;p=emacs.git (USE_LSB_TAG): Make it the default when it is known to work. --- diff --git a/src/lisp.h b/src/lisp.h index 9a9d48e79f3..bcd066360b3 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -284,24 +284,51 @@ enum pvec_type #define BOOL_VECTOR_BITS_PER_CHAR 8 /***** Select the tagging scheme. *****/ +/* There are basically two options that control the tagging scheme: + - NO_UNION_TYPE says that Lisp_Object should be an integer instead + of a union. + - USE_LSB_TAG means that we can assume the least 3 bits of pointers are + always 0, and we can thus use them to hold tag bits, without + restricting our addressing space. + + If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus + restricting our possible address range. Currently USE_LSB_TAG is not + allowed together with a union. This is not due to any fundamental + technical (or political ;-) problem: nobody wrote the code to do it yet. + + USE_LSB_TAG not only requires the least 3 bits of pointers returned by + malloc to be 0 but also needs to be able to impose a mult-of-8 alignment + on the few static Lisp_Objects used: all the defsubr as well + as the two special buffers buffer_defaults and buffer_local_symbols. */ /* First, try and define DECL_ALIGN(type,var) which declares a static variable VAR of type TYPE with the added requirement that it be TYPEBITS-aligned. */ -#if defined USE_LSB_TAG && !defined DECL_ALIGN +#ifndef DECL_ALIGN /* What compiler directive should we use for non-gcc compilers? -stef */ # if defined (__GNUC__) # define DECL_ALIGN(type, var) \ type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var -# else -# error "USE_LSB_TAG used without defining DECL_ALIGN" # endif #endif -#ifndef USE_LSB_TAG +/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ +#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX +/* We also need to be able to specify mult-of-8 alignment on static vars. */ +# if defined DECL_ALIGN +/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */ +# if defined NO_UNION_TYPE +# define USE_LSB_TAG +# endif +# endif +#endif + /* Just remove the alignment annotation if we don't use it. */ -#undef DECL_ALIGN -#define DECL_ALIGN(type, var) type var +#ifndef DECL_ALIGN +# ifdef USE_LSB_TAG +# error "USE_LSB_TAG used without defining DECL_ALIGN" +# endif +# define DECL_ALIGN(type, var) type var #endif