emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108598: Use a simple struct to imple


From: Andreas Schwab
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108598: Use a simple struct to implement compile time checks for the Lisp_Object type
Date: Wed, 13 Jun 2012 15:40:48 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108598
committer: Andreas Schwab <address@hidden>
branch nick: emacs
timestamp: Wed 2012-06-13 15:40:48 +0200
message:
  Use a simple struct to implement compile time checks for the Lisp_Object type
  
  * configure.in: Rename --enable-use-lisp-union-type to
  --enable-check-lisp-object-type and define CHECK_LISP_OBJECT_TYPE
  instead of USE_LISP_UNION_TYPE.
  
  * admin/make-emacs: Rename --union-type to --check-lisp-type.  Define
  CHECK_LISP_OBJECT_TYPE insted of USE_LISP_UNION_TYPE.
  * admin/CPP-DEFINES (DEBUG_LISP_OBJECT_TYPE): Renamed from
  USE_LISP_UNION_TYPE.
  
  * src/lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
  instead of union.
  (XLI, XIL): Define.
  (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use
  them.
  * src/emacs.c (gdb_use_struct): Renamed from gdb_use_union.
  * src/.gdbinit: Check gdb_use_struct instead of gdb_use_union.
  * src/alloc.c (widen_to_Lisp_Object): Removed.
  (mark_memory): Use XIL instead of widen_to_Lisp_Object.
  * src/frame.c (delete_frame): Remove outdated comment.
  * src/w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
  USE_LISP_UNION_TYPE.
  (Fw32_unregister_hot_key): Likewise.
  (Fw32_toggle_lock_key): Likewise.
  * src/w32menu.c (add_menu_item): Likewise.
  (w32_menu_display_help): Use XIL instead of checking
  USE_LISP_UNION_TYPE.
  * src/w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE.
  (init_heap): Likewise.
  * src/w32term.c (w32_read_socket): Update comment.
modified:
  ChangeLog
  admin/CPP-DEFINES
  admin/ChangeLog
  admin/make-emacs
  configure.in
  etc/NEWS
  src/.gdbinit
  src/ChangeLog
  src/alloc.c
  src/emacs.c
  src/frame.c
  src/lisp.h
  src/w32fns.c
  src/w32heap.c
  src/w32menu.c
  src/w32term.c
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-06-12 19:03:32 +0000
+++ b/ChangeLog 2012-06-13 13:40:48 +0000
@@ -1,3 +1,9 @@
+2012-06-13  Andreas Schwab  <address@hidden>
+
+       * configure.in: Rename --enable-use-lisp-union-type to
+       --enable-check-lisp-object-type and define CHECK_LISP_OBJECT_TYPE
+       instead of USE_LISP_UNION_TYPE.
+
 2012-06-12  Glenn Morris  <address@hidden>
 
        * configure.in (HAVE_PROCFS, _STRUCTURED_PROC): New AC_DEFINEs.

=== modified file 'admin/CPP-DEFINES'
--- a/admin/CPP-DEFINES 2012-06-13 02:39:20 +0000
+++ b/admin/CPP-DEFINES 2012-06-13 13:40:48 +0000
@@ -46,7 +46,7 @@
 REL_ALLOC      Compile in the relocatable memory allocator ralloc.c.
 SYSTEM_MALLOC  Use the system library's malloc.
 subprocesses    System can use subprocesses (for M-x shell for example).  
Defined by default, only MSDOS undefines it.
-USE_LISP_UNION_TYPE Define it in lisp.h to make Lisp_Object be a union type 
instead of the default int.
+DEBUG_LISP_OBJECT_TYPE Define it in lisp.h enable compile time checks on 
Lisp_Object use.
 
 ** System specific macros, described in detail in src/s/template.h
 CLASH_DETECTION

=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2012-06-10 13:20:58 +0000
+++ b/admin/ChangeLog   2012-06-13 13:40:48 +0000
@@ -1,3 +1,10 @@
+2012-06-13  Andreas Schwab  <address@hidden>
+
+       * make-emacs: Rename --union-type to --check-lisp-type.  Define
+       CHECK_LISP_OBJECT_TYPE insted of USE_LISP_UNION_TYPE.
+       * CPP-DEFINES (DEBUG_LISP_OBJECT_TYPE): Renamed from
+       USE_LISP_UNION_TYPE.
+
 2012-06-03  Glenn Morris  <address@hidden>
 
        * quick-install-emacs (PUBLIC_LIBSRC_SCRIPTS): Remove rcs-checkin.

=== modified file 'admin/make-emacs'
--- a/admin/make-emacs  2012-01-19 07:21:25 +0000
+++ b/admin/make-emacs  2012-06-13 13:40:48 +0000
@@ -42,7 +42,7 @@
                  "check-marked" => \$check_marked,
                  "all" => \$all,
                  "no-optim" => \$no_optim,
-                 "union-type" => \$union_type,
+                 "check-lisp-type" => \$check_lisp_type,
                  "gprof" => \$profile,
                  "malloc-check" => \$malloc_check,
                  "no-mcheck" => \$no_mcheck,
@@ -70,7 +70,7 @@
  --check-marked                GC_CHECK_MARKED_OBJECTS=1
  --optim               no debug defines
  --gprof               make Emacs for profiling
- --union-type          define USE_LISP_UNION_TYPE (bad for GDB)
+ --check-lisp-type     define CHECK_LISP_OBJECT_TYPE
  --malloc-check                define GC_MALLOC_CHECK
  --no-mcheck           don't define GC_MCHECK
  --wall                        compile with -Wall
@@ -140,7 +140,7 @@
       }
   }
 
-$defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type;
+$defs = "$defs -DCHECK_LISP_OBJECT_TYPE" if $check_lisp_type;
 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if 
$malloc_check;
 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck;
 

=== modified file 'configure.in'
--- a/configure.in      2012-06-12 19:15:47 +0000
+++ b/configure.in      2012-06-13 13:40:48 +0000
@@ -309,13 +309,13 @@
 [Define this to check for errors in cons list.])
 fi
 
-AC_ARG_ENABLE(use-lisp-union-type,
-[AS_HELP_STRING([--enable-use-lisp-union-type],
-                [use a union for the Lisp_Object data type.
-               This is only useful for development for catching certain types 
of bugs.])],
+AC_ARG_ENABLE(check-lisp-object-type,
+[AS_HELP_STRING([--enable-check-lisp-object-type],
+                [enable compile time checks for the Lisp_Object data type.
+               This is useful for development for catching certain types of 
bugs.])],
 if test "${enableval}" != "no"; then
-   AC_DEFINE(USE_LISP_UNION_TYPE, 1,
-   [Define this to use a lisp union for the Lisp_Object data type.])
+   AC_DEFINE(CHECK_LISP_OBJECT_TYPE, 1,
+   [Define this to enable compile time checks for the Lisp_Object data type.])
 fi)
 
 

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2012-06-13 07:33:38 +0000
+++ b/etc/NEWS  2012-06-13 13:40:48 +0000
@@ -49,6 +49,11 @@
 (from the bin and libexec directories, respectively).  The former is
 no longer relevant, the latter is replaced by lisp (in vc-sccs.el).
 
+** The configuration option '--enable-use-lisp-union-type' has been
+renamed to '--enable-check-lisp-object-type', as the resulting
+Lisp_Object type no longer uses a union to implement the compile time
+check that this option enables.
+
 
 * Startup Changes in Emacs 24.2
 

=== modified file 'src/.gdbinit'
--- a/src/.gdbinit      2012-05-01 00:07:23 +0000
+++ b/src/.gdbinit      2012-06-13 13:40:48 +0000
@@ -49,17 +49,26 @@
 # Using a constant runs into GDB bugs sometimes.
 define xgetptr
   set $bugfix = $arg0
-  set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : 
$bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $ptr = $bugfix & $valmask | gdb_data_seg_bits
 end
 
 define xgetint
   set $bugfix = $arg0
-  set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix >> 
(gdb_gctypebits - 1) : $bugfix << gdb_gctypebits) >> gdb_gctypebits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $int = gdb_use_lsb ? $bugfix >> (gdb_gctypebits - 1) : $bugfix << 
gdb_gctypebits) >> gdb_gctypebits
 end
 
 define xgettype
   set $bugfix = $arg0
-  set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? 
$bugfix & $tagmask : $bugfix >> gdb_valbits)
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $type = (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> 
gdb_valbits)
 end
 
 # Set up something to print out s-expressions.
@@ -949,15 +958,8 @@
 
 define xpr
   xtype
-  if gdb_use_union
-    if $type == Lisp_Int
-      xint
-    end
-  end
-  if !gdb_use_union
-    if $type == Lisp_Int0 || $type == Lisp_Int1
-      xint
-    end
+  if $type == Lisp_Int0 || $type == Lisp_Int1
+    xint
   end
   if $type == Lisp_Symbol
     xsymbol

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-13 02:39:20 +0000
+++ b/src/ChangeLog     2012-06-13 13:40:48 +0000
@@ -1,3 +1,26 @@
+2012-06-13  Andreas Schwab  <address@hidden>
+
+       * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
+       instead of union.
+       (XLI, XIL): Define.
+       (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use
+       them.
+       * emacs.c (gdb_use_struct): Renamed from gdb_use_union.
+       * .gdbinit: Check gdb_use_struct instead of gdb_use_union.
+       * alloc.c (widen_to_Lisp_Object): Removed.
+       (mark_memory): Use XIL instead of widen_to_Lisp_Object.
+       * frame.c (delete_frame): Remove outdated comment.
+       * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
+       USE_LISP_UNION_TYPE.
+       (Fw32_unregister_hot_key): Likewise.
+       (Fw32_toggle_lock_key): Likewise.
+       * w32menu.c (add_menu_item): Likewise.
+       (w32_menu_display_help): Use XIL instead of checking
+       USE_LISP_UNION_TYPE.
+       * w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE.
+       (init_heap): Likewise.
+       * w32term.c (w32_read_socket): Update comment.
+
 2012-06-13  Glenn Morris  <address@hidden>
 
        * s/usg5-4-common.h, src/s/unixware.h:

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-06-13 00:26:40 +0000
+++ b/src/alloc.c       2012-06-13 13:40:48 +0000
@@ -1585,21 +1585,6 @@
      (i) = balance_intervals (i);                      \
   } while (0)
 
-/* Convert the pointer-sized word P to EMACS_INT while preserving its
-   type and ptr fields.  */
-static Lisp_Object
-widen_to_Lisp_Object (void *p)
-{
-  intptr_t i = (intptr_t) p;
-#ifdef USE_LISP_UNION_TYPE
-  Lisp_Object obj;
-  obj.i = i;
-  return obj;
-#else
-  return i;
-#endif
-}
-
 /***********************************************************************
                          String Allocation
  ***********************************************************************/
@@ -4678,7 +4663,7 @@
        void *p = *(void **) ((char *) pp + i);
        mark_maybe_pointer (p);
        if (POINTERS_MIGHT_HIDE_IN_OBJECTS)
-         mark_maybe_object (widen_to_Lisp_Object (p));
+         mark_maybe_object (XIL ((intptr_t) p));
       }
 }
 

=== modified file 'src/emacs.c'
--- a/src/emacs.c       2012-06-13 00:26:40 +0000
+++ b/src/emacs.c       2012-06-13 13:40:48 +0000
@@ -109,10 +109,10 @@
 #else
 int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
 #endif
-#ifndef USE_LISP_UNION_TYPE
-int gdb_use_union EXTERNALLY_VISIBLE  = 0;
+#ifndef CHECK_LISP_OBJECT_TYPE
+int gdb_use_struct EXTERNALLY_VISIBLE = 0;
 #else
-int gdb_use_union EXTERNALLY_VISIBLE = 1;
+int gdb_use_struct EXTERNALLY_VISIBLE = 1;
 #endif
 int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
 int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;

=== modified file 'src/frame.c'
--- a/src/frame.c       2012-06-01 03:41:03 +0000
+++ b/src/frame.c       2012-06-13 13:40:48 +0000
@@ -1152,10 +1152,6 @@
   described for Fdelete_frame.  */
 Lisp_Object
 delete_frame (Lisp_Object frame, Lisp_Object force)
-     /* If we use `register' here, gcc-4.0.2 on amd64 using
-       -DUSE_LISP_UNION_TYPE complains further down that we're getting the
-       address of `force'.  Go figure.  */
-
 {
   struct frame *f;
   struct frame *sf = SELECTED_FRAME ();

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-06-13 00:26:40 +0000
+++ b/src/lisp.h        2012-06-13 13:40:48 +0000
@@ -149,14 +149,12 @@
 #endif
 #endif /* ENABLE_CHECKING */
 
-/* Use the configure flag --enable-use-lisp-union-type to make
-   Lisp_Object use a union type instead of the default int.  The flag
-   causes USE_LISP_UNION_TYPE to be defined.  */
+/* Use the configure flag --enable-check-lisp-object-type to make
+   Lisp_Object use a struct type instead of the default int.  The flag
+   causes CHECK_LISP_OBJECT_TYPE to be defined.  */
 
 /***** Select the tagging scheme.  *****/
-/* There are basically two options that control the tagging scheme:
-   - USE_LISP_UNION_TYPE says that Lisp_Object should be a union instead
-     of an integer.
+/* The following option controls the tagging scheme:
    - 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.
@@ -237,11 +235,6 @@
    e.g -2^28..2^28-1 to -2^29..2^29-1.  */
 #define USE_2_TAGS_FOR_INTS
 
-/* Making it work for the union case is too much trouble.  */
-#ifdef USE_LISP_UNION_TYPE
-# undef USE_2_TAGS_FOR_INTS
-#endif
-
 /* This is the set of Lisp data types.  */
 
 #if !defined USE_2_TAGS_FOR_INTS
@@ -335,29 +328,17 @@
     Lisp_Fwd_Kboard_Obj,       /* Fwd to a Lisp_Object field of kboards.  */
   };
 
-#ifdef USE_LISP_UNION_TYPE
-
-typedef
-union Lisp_Object
-  {
-    /* Used for comparing two Lisp_Objects;
-       also, positive integers can be accessed fast this way.  */
-    EMACS_INT i;
-
-    struct
-      {
-       /* Use explicit signed, the signedness of a bit-field of type
-          int is implementation defined.  */
-       signed EMACS_INT val  : VALBITS;
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-      } s;
-    struct
-      {
-       EMACS_UINT val : VALBITS;
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-      } u;
-  }
-Lisp_Object;
+#ifdef CHECK_LISP_OBJECT_TYPE
+
+typedef struct { EMACS_INT i; } Lisp_Object;
+
+#define XLI(o) (o).i
+static inline Lisp_Object
+XIL (EMACS_INT i)
+{
+  Lisp_Object o = { i };
+  return o;
+}
 
 static inline Lisp_Object
 LISP_MAKE_RVALUE (Lisp_Object o)
@@ -367,14 +348,16 @@
 
 #define LISP_INITIALLY_ZERO {0}
 
-#else /* USE_LISP_UNION_TYPE */
+#else /* CHECK_LISP_OBJECT_TYPE */
 
-/* If union type is not wanted, define Lisp_Object as just a number.  */
+/* If a struct type is not wanted, define Lisp_Object as just a number.  */
 
 typedef EMACS_INT Lisp_Object;
+#define XLI(o) (o)
+#define XIL(i) (i)
 #define LISP_MAKE_RVALUE(o) (0+(o))
 #define LISP_INITIALLY_ZERO 0
-#endif /* USE_LISP_UNION_TYPE */
+#endif /* CHECK_LISP_OBJECT_TYPE */
 
 /* In the size word of a vector, this bit means the vector has been marked.  */
 
@@ -432,30 +415,28 @@
  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.  
*/
 
-#ifndef USE_LISP_UNION_TYPE
-
 /* Return a perfect hash of the Lisp_Object representation.  */
-#define XHASH(a) (a)
+#define XHASH(a) XLI(a)
 
 #if USE_LSB_TAG
 
 #define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
-#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK))
+#define XTYPE(a) ((enum Lisp_Type) (XLI(a) & TYPEMASK))
 #ifdef USE_2_TAGS_FOR_INTS
-# define XINT(a) (((EMACS_INT) (a)) >> (GCTYPEBITS - 1))
-# define XUINT(a) (((EMACS_UINT) (a)) >> (GCTYPEBITS - 1))
-# define make_number(N) (((EMACS_INT) (N)) << (GCTYPEBITS - 1))
+# define XINT(a) (((EMACS_INT) XLI(a)) >> (GCTYPEBITS - 1))
+# define XUINT(a) (((EMACS_UINT) XLI(a)) >> (GCTYPEBITS - 1))
+# define make_number(N) XIL(((EMACS_INT) (N)) << (GCTYPEBITS - 1))
 #else
-# define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS)
-# define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS)
-# define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
+# define XINT(a) (((EMACS_INT) XLI(a)) >> GCTYPEBITS)
+# define XUINT(a) (((EMACS_UINT) XLI(a)) >> GCTYPEBITS)
+# define make_number(N) XIL(((EMACS_INT) (N)) << GCTYPEBITS)
 #endif
-#define XSET(var, type, ptr)                                           \
-    (eassert (XTYPE ((intptr_t) (ptr)) == 0), /* Check alignment.  */ \
-     (var) = (type) | (intptr_t) (ptr))
+#define XSET(var, type, ptr)                                              \
+  (eassert (XTYPE (XIL((intptr_t) (ptr))) == 0), /* Check alignment.  */   \
+   (var) = XIL((type) | (intptr_t) (ptr)))
 
-#define XPNTR(a) ((intptr_t) ((a) & ~TYPEMASK))
-#define XUNTAG(a, type) ((intptr_t) ((a) - (type)))
+#define XPNTR(a) ((intptr_t) (XLI(a) & ~TYPEMASK))
+#define XUNTAG(a, type) ((intptr_t) (XLI(a) - (type)))
 
 #else  /* not USE_LSB_TAG */
 
@@ -465,91 +446,42 @@
    (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
     on all machines, but would penalize machines which don't need it)
  */
-#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS))
+#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) XLI(a)) >> VALBITS))
 
 /* 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) + 0)
-#define XSETFASTINT(a, b) ((a) = (b))
+#define XFASTINT(a) (XLI(a) + 0)
+#define XSETFASTINT(a, b) ((a) = XIL(b))
 
 /* Extract the value of a Lisp_Object as a (un)signed integer.  */
 
 #ifdef USE_2_TAGS_FOR_INTS
-# define XINT(a) ((((EMACS_INT) (a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 1))
-# define XUINT(a) ((EMACS_UINT) ((a) & (1 + (VALMASK << 1))))
-# define make_number(N) ((((EMACS_INT) (N)) & (1 + (VALMASK << 1))))
+# define XINT(a) ((((EMACS_INT) XLI(a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 
1))
+# define XUINT(a) ((EMACS_UINT) (XLI(a) & (1 + (VALMASK << 1))))
+# define make_number(N) XIL((((EMACS_INT) (N)) & (1 + (VALMASK << 1))))
 #else
-# define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS))        
\
-                >> (BITS_PER_EMACS_INT - VALBITS))
-# define XUINT(a) ((EMACS_UINT) ((a) & VALMASK))
+# define XINT(a) ((((EMACS_INT) XLI(a)) << (BITS_PER_EMACS_INT - VALBITS))    \
+                 >> (BITS_PER_EMACS_INT - VALBITS))
+# define XUINT(a) ((EMACS_UINT) (XLI(a) & VALMASK))
 # define make_number(N)                \
-  ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
+  XIL((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
 #endif
 
 #define XSET(var, type, ptr)                             \
-   ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
-            + ((intptr_t) (ptr) & VALMASK)))
+   ((var) = XIL((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
+               + ((intptr_t) (ptr) & VALMASK)))
 
 #ifdef DATA_SEG_BITS
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
    which were stored in a Lisp_Object */
-#define XPNTR(a) ((uintptr_t) (((a) & VALMASK)) | DATA_SEG_BITS))
+#define XPNTR(a) ((uintptr_t) ((XLI(a) & VALMASK)) | DATA_SEG_BITS))
 #else
-#define XPNTR(a) ((uintptr_t) ((a) & VALMASK))
+#define XPNTR(a) ((uintptr_t) (XLI(a) & VALMASK))
 #endif
 
 #endif /* not USE_LSB_TAG */
 
-#else /* USE_LISP_UNION_TYPE */
-
-#ifdef USE_2_TAGS_FOR_INTS
-# error "USE_2_TAGS_FOR_INTS is not supported with USE_LISP_UNION_TYPE"
-#endif
-
-#define XHASH(a) ((a).i)
-#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
-#define XINT(a) ((EMACS_INT) (a).s.val)
-#define XUINT(a) ((EMACS_UINT) (a).u.val)
-
-#if USE_LSB_TAG
-
-# define XSET(var, vartype, ptr) \
-  (eassert (((uintptr_t) (ptr) & ((1 << GCTYPEBITS) - 1)) == 0),       \
-   (var).u.val = (uintptr_t) (ptr) >> GCTYPEBITS,                      \
-   (var).u.type = (vartype))
-
-/* Some versions of gcc seem to consider the bitfield width when issuing
-   the "cast to pointer from integer of different size" warning, so the
-   cast is here to widen the value back to its natural size.  */
-# define XPNTR(v) ((intptr_t) (v).s.val << GCTYPEBITS)
-
-#else  /* !USE_LSB_TAG */
-
-# define XSET(var, vartype, ptr) \
-   ((var).s.val = (intptr_t) (ptr), (var).s.type = (vartype))
-
-#ifdef DATA_SEG_BITS
-/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
-   which were stored in a Lisp_Object */
-#define XPNTR(a) ((intptr_t) (XUINT (a) | DATA_SEG_BITS))
-#else
-#define XPNTR(a) ((intptr_t) XUINT (a))
-#endif
-
-#endif /* !USE_LSB_TAG */
-
-static inline Lisp_Object
-make_number (EMACS_INT n)
-{
-  Lisp_Object o;
-  o.s.val = n;
-  o.s.type = Lisp_Int;
-  return o;
-}
-
-#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.  */

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2012-05-28 17:22:40 +0000
+++ b/src/w32fns.c      2012-06-13 13:40:48 +0000
@@ -6326,13 +6326,8 @@
 
       /* Notify input thread about new hot-key definition, so that it
         takes effect without needing to switch focus.  */
-#ifdef USE_LISP_UNION_TYPE
-      PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
-                        (WPARAM) key.i, 0);
-#else
-      PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
-                        (WPARAM) key, 0);
-#endif
+      PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
+                        (WPARAM) XLI (key), 0);
     }
 
   return key;
@@ -6354,13 +6349,8 @@
     {
       /* Notify input thread about hot-key definition being removed, so
         that it takes effect without needing focus switch.  */
-#ifdef USE_LISP_UNION_TYPE
-      if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
-                            (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
-#else
-      if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
-                            (WPARAM) XINT (XCAR (item)), (LPARAM) item))
-#endif
+      if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
+                            (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item)))
        {
          MSG msg;
          GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -6432,13 +6422,8 @@
   if (!dwWindowsThreadId)
     return make_number (w32_console_toggle_lock_key (vk_code, new_state));
 
-#ifdef USE_LISP_UNION_TYPE
-  if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
-                        (WPARAM) vk_code, (LPARAM) new_state.i))
-#else
-  if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
-                        (WPARAM) vk_code, (LPARAM) new_state))
-#endif
+  if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
+                        (WPARAM) vk_code, (LPARAM) XLI (new_state)))
     {
       MSG msg;
       GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);

=== modified file 'src/w32heap.c'
--- a/src/w32heap.c     2012-06-13 00:26:40 +0000
+++ b/src/w32heap.c     2012-06-13 13:40:48 +0000
@@ -114,7 +114,7 @@
   return data_region_end;
 }
 
-#if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
+#if !USE_LSB_TAG
 static char *
 allocate_heap (void)
 {
@@ -141,7 +141,7 @@
 
   return ptr;
 }
-#else  /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
+#else  /* USE_LSB_TAG */
 static char *
 allocate_heap (void)
 {
@@ -160,7 +160,7 @@
 
   return ptr;
 }
-#endif /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
+#endif /* USE_LSB_TAG */
 
 
 /* Emulate Unix sbrk.  Note that ralloc.c expects the return value to
@@ -259,7 +259,7 @@
          exit (1);
        }
 
-#if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
+#if !USE_LSB_TAG
       /* Ensure that the addresses don't use the upper tag bits since
         the Lisp type goes there.  */
       if (((unsigned long) data_region_base & ~VALMASK) != 0)

=== modified file 'src/w32menu.c'
--- a/src/w32menu.c     2012-05-25 18:19:24 +0000
+++ b/src/w32menu.c     2012-06-13 13:40:48 +0000
@@ -1533,11 +1533,7 @@
             until it is ready to be displayed, since GC can happen while
             menus are active.  */
          if (!NILP (wv->help))
-#ifdef USE_LISP_UNION_TYPE
-           info.dwItemData = (DWORD) (wv->help).i;
-#else
-           info.dwItemData = (DWORD) (wv->help);
-#endif
+           info.dwItemData = (DWORD) XLI (wv->help);
          if (wv->button_type == BUTTON_TYPE_RADIO)
            {
              /* CheckMenuRadioItem allows us to differentiate TOGGLE and
@@ -1612,12 +1608,7 @@
          info.fMask = MIIM_DATA;
          get_menu_item_info (menu, item, FALSE, &info);
 
-#ifdef USE_LISP_UNION_TYPE
-         help = info.dwItemData ? (Lisp_Object) ((EMACS_INT) info.dwItemData)
-                                : Qnil;
-#else
-         help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
-#endif
+         help = info.dwItemData ? XIL (info.dwItemData) : Qnil;
        }
 
       /* Store the help echo in the keyboard buffer as the X toolkit

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2012-05-28 17:22:40 +0000
+++ b/src/w32term.c     2012-06-13 13:40:48 +0000
@@ -4342,7 +4342,7 @@
 
           /* If the contents of the global variable help_echo_string
              has changed, generate a HELP_EVENT.  */
-#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE.
+#if 0 /* The below is an invalid comparison when CHECK_LISP_OBJECT_TYPE.
         But it was originally changed to this to fix a bug, so I have
         not removed it completely in case the bug is still there.  */
           if (help_echo_string != previous_help_echo_string ||


reply via email to

[Prev in Thread] Current Thread [Next in Thread]