changeset 55570:9edbe481a40b

(USE_LSB_TAG): Make it the default when it is known to work.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 13 May 2004 17:12:21 +0000
parents 36845b719feb
children 402c0c610d46
files src/lisp.h
diffstat 1 files changed, 33 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lisp.h	Thu May 13 14:30:22 2004 +0000
+++ b/src/lisp.h	Thu May 13 17:12:21 2004 +0000
@@ -284,24 +284,51 @@
 #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