changeset 105839:e0a471c09d45

Make USE_LSB_TAG work with USE_LISP_UNION_TYPE. (P_): Support for prototypes is now required.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 03 Nov 2009 15:30:39 +0000
parents 5a494d9d4e4f
children 0d3a156a5458
files src/ChangeLog src/lisp.h
diffstat 2 files changed, 34 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Tue Nov 03 15:28:13 2009 +0000
+++ b/src/ChangeLog	Tue Nov 03 15:30:39 2009 +0000
@@ -1,3 +1,8 @@
+2009-11-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* lisp.h: Make USE_LSB_TAG work with USE_LISP_UNION_TYPE.
+	(P_): Support for prototypes is now required.
+
 2009-10-31  Chong Yidong  <cyd@stupidchicken.com>
 
 	* frame.c (Fmake_frame_invisible, Fframe_visible_p): Doc fix
--- a/src/lisp.h	Tue Nov 03 15:28:13 2009 +0000
+++ b/src/lisp.h	Tue Nov 03 15:30:39 2009 +0000
@@ -22,11 +22,7 @@
 #define EMACS_LISP_H
 
 /* Declare the prototype for a general external function.  */
-#if defined (PROTOTYPES) || defined (WINDOWSNT)
 #define P_(proto) proto
-#else
-#define P_(proto) ()
-#endif
 
 /* Use the configure flag --enable-checking[=LIST] to enable various
    types of run time checks for Lisp objects.  */
@@ -139,10 +135,7 @@
 #if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined DARWIN_OS
 /* 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.  */
-#  ifndef USE_LISP_UNION_TYPE
-#   define USE_LSB_TAG
-#  endif
+#  define USE_LSB_TAG
 # endif
 #endif
 
@@ -367,12 +360,6 @@
      (var) = ((EMACS_INT) (type)) | ((EMACS_INT) (ptr)))
 #define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
 
-/* XFASTINT and XSETFASTINT are for use when the integer is known to be
-   positive, in which case the implementation can sometimes be faster
-   depending on the tagging scheme.  With USE_LSB_TAG, there's no benefit.  */
-#define XFASTINT(a) XINT (a)
-#define XSETFASTINT(a, b) ((a) = make_number (b))
-
 #define XPNTR(a) ((EMACS_INT) ((a) & ~TYPEMASK))
 
 #else  /* not USE_LSB_TAG */
@@ -423,12 +410,6 @@
 
 #define XTYPE(a) ((enum Lisp_Type) (a).u.type)
 
-/* For integers known to be positive, XFASTINT provides fast retrieval
-   and XSETFASTINT provides fast storage.  This takes advantage of the
-   fact that Lisp_Int is 0.  */
-#define XFASTINT(a) ((a).i + 0)
-#define XSETFASTINT(a, b) ((a).i = (b))
-
 #ifdef EXPLICIT_SIGN_EXTEND
 /* Make sure we sign-extend; compilers have been known to fail to do so.  */
 #define XINT(a) (((a).s.val << (BITS_PER_EMACS_INT - VALBITS)) \
@@ -439,9 +420,28 @@
 
 #define XUINT(a) ((a).u.val)
 
-#define XSET(var, vartype, ptr) \
+#ifdef USE_LSB_TAG
+
+# define XSET(var, vartype, ptr) \
+  (eassert ((((EMACS_UINT) (ptr)) & ((1 << GCTYPEBITS) - 1)) == 0),	\
+   (var).u.val = ((EMACS_UINT) (ptr)) >> GCTYPEBITS,			\
+   (var).u.type = ((char) (vartype)))
+
+# define XPNTR(v) (((v).s.val) << GCTYPEBITS)
+
+#else  /* !USE_LSB_TAG */
+
+/* For integers known to be positive, XFASTINT provides fast retrieval
+   and XSETFASTINT provides fast storage.  This takes advantage of the
+   fact that Lisp_Int is 0.  */
+# define XFASTINT(a) ((a).i + 0)
+# define XSETFASTINT(a, b) ((a).i = (b))
+
+# define XSET(var, vartype, ptr) \
    (((var).s.val = ((EMACS_INT) (ptr))), ((var).s.type = ((char) (vartype))))
 
+#endif	/* !USE_LSB_TAG */
+
 #if __GNUC__ >= 2 && defined (__OPTIMIZE__)
 #define make_number(N) \
   (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
@@ -451,6 +451,14 @@
 
 #endif /* USE_LISP_UNION_TYPE */
 
+/* For integers known to be positive, XFASTINT sometimes provides
+   faster retrieval and XSETFASTINT provides faster storage.
+   If not, fallback on the non-accelerated path.  */
+#ifndef XFASTINT
+# define XFASTINT(a) (XINT (a))
+# define XSETFASTINT(a, b) (XSETINT (a, b))
+#endif
+
 #define EQ(x, y) (XHASH (x) == XHASH (y))
 
 #ifndef XPNTR