diff src/lisp.h @ 83019:82c3b4da43ca

Merged in changes from CVS HEAD Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-33 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-34 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-35 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-36 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-37 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-38 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-39 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-40 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-41 Make fringe-drawing stuff compile without a window-system * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-42 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-43 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-44 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-45 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-46 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-47 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-48 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-49 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-50 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-59
author Karoly Lorentey <lorentey@elte.hu>
date Thu, 22 Jan 2004 15:37:19 +0000
parents f3845715a5f6 2127bc33e972
children 03a73693678e
line wrap: on
line diff
--- a/src/lisp.h	Thu Jan 22 02:36:55 2004 +0000
+++ b/src/lisp.h	Thu Jan 22 15:37:19 2004 +0000
@@ -1,5 +1,5 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000, 2001, 2002, 2003
+   Copyright (C) 1985,86,87,93,94,95,97,98,1999,2000,01,02,03,2004
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -67,10 +67,6 @@
 			   ? (void) 0				\
 			   : die ((msg), __FILE__, __LINE__)),	\
 			  0)
-
-/* Let's get some compile-time checking too.  */
-#undef NO_UNION_TYPE
-
 #else
 
 /* Produce same side effects and result, but don't complain.  */
@@ -293,12 +289,55 @@
 /* For convenience, we also store the number of elements in these bits.  */
 #define PSEUDOVECTOR_SIZE_MASK 0x1ff
 
+/***** Select the tagging scheme.  *****/
+
+/* 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
+/* 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
+/* Just remove the alignment annotation if we don't use it.  */
+#undef DECL_ALIGN
+#define DECL_ALIGN(type, var) type var
+#endif
+
+
 /* These macros extract various sorts of values from a Lisp_Object.
  For example, if tem is a Lisp_Object whose type is Lisp_Cons,
  XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons.  */
 
 #ifdef NO_UNION_TYPE
 
+#ifdef USE_LSB_TAG
+
+#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
+#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) & TYPEMASK))
+#define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS)
+#define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS)
+#define XSET(var, type, ptr)					\
+    (eassert (XTYPE (ptr) == 0), /* Check alignment.  */	\
+     (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 */
+
 #define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1)
 
 /* One need to override this if there must be high bits set in data space
@@ -337,6 +376,8 @@
 #define make_number(N)		\
   ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
 
+#endif /* not USE_LSB_TAG */
+
 #define EQ(x, y) ((x) == (y))
 
 #else /* not NO_UNION_TYPE */
@@ -1150,6 +1191,13 @@
     unsigned gcmarkbit : 1;
     int spacer : 15;
     union Lisp_Misc *chain;
+#ifdef USE_LSB_TAG
+    /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
+       This assumes that Lisp_Marker is the largest of the alternatives and
+       that Lisp_Intfwd has the same size as "Lisp_Free w/o padding".  */
+    char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
+		  << GCTYPEBITS) - sizeof (struct Lisp_Intfwd)];
+#endif
   };
 
 /* To get the type field of a union Lisp_Misc, use XMISCTYPE.
@@ -1517,7 +1565,7 @@
 
 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)	\
   Lisp_Object fnname ();						\
-  struct Lisp_Subr sname =						\
+  DECL_ALIGN (struct Lisp_Subr, sname) =				\
     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),	\
       fnname, minargs, maxargs, lname, prompt, 0};			\
   Lisp_Object fnname
@@ -1528,7 +1576,7 @@
    arguments, so we can catch errors with maxargs at compile-time.  */
 #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc)	\
   Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;				\
-  struct Lisp_Subr sname =						\
+  DECL_ALIGN (struct Lisp_Subr, sname) =				\
     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),	\
       fnname, minargs, maxargs, lname, prompt, 0};			\
   Lisp_Object fnname
@@ -1675,6 +1723,22 @@
    This is a good thing to do around a loop that has no side effects
    and (in particular) cannot call arbitrary Lisp code.  */
 
+#ifdef SYNC_INPUT
+extern void handle_async_input P_ ((void));
+extern int interrupt_input_pending;
+#define QUIT						\
+  do {							\
+    if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
+      {							\
+	Vquit_flag = Qnil;				\
+	Fsignal (Qquit, Qnil);				\
+      }							\
+    else if (interrupt_input_pending)			\
+      handle_async_input ();				\
+  } while (0)
+
+#else  /* not SYNC_INPUT */
+
 #define QUIT						\
   do {							\
     if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))	\
@@ -1684,6 +1748,9 @@
       }							\
   } while (0)
 
+#endif	/* not SYNC_INPUT */
+
+
 /* Nonzero if ought to quit now.  */
 
 #define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))