aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-06-12 17:26:40 -0700
committerPaul Eggert2012-06-12 17:26:40 -0700
commitbfe3e0a23e66d16bfcaae6890bdd764dec0525f2 (patch)
tree77a2c28772dffde4a5f0c8fc55d81701c29f11bb /src
parent1cce69208a638b9ce789e4c21df55b2315efd97c (diff)
downloademacs-bfe3e0a23e66d16bfcaae6890bdd764dec0525f2.tar.gz
emacs-bfe3e0a23e66d16bfcaae6890bdd764dec0525f2.zip
USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604)
* alloc.c (make_number) [!defined make_number]: Remove, as lisp.h always defines this now. (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now. (roundup_size): Verify that it is a power of 2. * data.c (Fmake_variable_buffer_local, Fmake_local_variable): * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO. * lisp.h (USE_LSB_TAG): Allow the builder to compile with -DUSE_LSB_TAG=0, to override the automatically-selected default. USE_LSB_TAG now is always defined to be either 0 or 1. All uses changed. (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the code works fine either way, and efficiency is not a concern here, as the union type is for debugging, not for production. (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]: Use an inline function on all platforms when using the union type, since this is simpler and 'static inline' can be used portably within Emacs now. (LISP_INITIALLY_ZERO): New macro. (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove. (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog24
-rw-r--r--src/alloc.c65
-rw-r--r--src/data.c4
-rw-r--r--src/emacs.c4
-rw-r--r--src/ftfont.c2
-rw-r--r--src/lisp.h108
-rw-r--r--src/mem-limits.h2
-rw-r--r--src/w32heap.c4
-rw-r--r--src/xfont.c2
9 files changed, 91 insertions, 124 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index cd5c96cf36e..8a32572907d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,27 @@
12012-06-13 Paul Eggert <eggert@cs.ucla.edu>
2
3 USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604)
4 * alloc.c (make_number) [!defined make_number]:
5 Remove, as lisp.h always defines this now.
6 (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now.
7 (roundup_size): Verify that it is a power of 2.
8 * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
9 * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO.
10 * lisp.h (USE_LSB_TAG): Allow the builder to compile with
11 -DUSE_LSB_TAG=0, to override the automatically-selected default.
12 USE_LSB_TAG now is always defined to be either 0 or 1.
13 All uses changed.
14 (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the
15 code works fine either way, and efficiency is not a concern here,
16 as the union type is for debugging, not for production.
17 (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]:
18 Use an inline function on all platforms when using the union type,
19 since this is simpler and 'static inline' can be used portably
20 within Emacs now.
21 (LISP_INITIALLY_ZERO): New macro.
22 (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove.
23 (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
24
12012-06-12 Glenn Morris <rgm@gnu.org> 252012-06-12 Glenn Morris <rgm@gnu.org>
2 26
3 * s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files. 27 * s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files.
diff --git a/src/alloc.c b/src/alloc.c
index 7051af9b99c..1223f0bc13d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -533,7 +533,7 @@ buffer_memory_full (ptrdiff_t nbytes)
533 }, \ 533 }, \
534 c) 534 c)
535 535
536#ifdef USE_LSB_TAG 536#if USE_LSB_TAG
537# define XMALLOC_HEADER_ALIGNMENT \ 537# define XMALLOC_HEADER_ALIGNMENT \
538 COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT) 538 COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT)
539#else 539#else
@@ -893,8 +893,8 @@ safe_alloca_unwind (Lisp_Object arg)
893 number of bytes to allocate, TYPE describes the intended use of the 893 number of bytes to allocate, TYPE describes the intended use of the
894 allocated memory block (for strings, for conses, ...). */ 894 allocated memory block (for strings, for conses, ...). */
895 895
896#ifndef USE_LSB_TAG 896#if ! USE_LSB_TAG
897static void *lisp_malloc_loser; 897void *lisp_malloc_loser EXTERNALLY_VISIBLE;
898#endif 898#endif
899 899
900static void * 900static void *
@@ -910,7 +910,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
910 910
911 val = (void *) malloc (nbytes); 911 val = (void *) malloc (nbytes);
912 912
913#ifndef USE_LSB_TAG 913#if ! USE_LSB_TAG
914 /* If the memory just allocated cannot be addressed thru a Lisp 914 /* If the memory just allocated cannot be addressed thru a Lisp
915 object's pointer, and it needs to be, 915 object's pointer, and it needs to be,
916 that's equivalent to running out of memory. */ 916 that's equivalent to running out of memory. */
@@ -1091,7 +1091,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1091 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 1091 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
1092#endif 1092#endif
1093 1093
1094#ifndef USE_LSB_TAG 1094#if ! USE_LSB_TAG
1095 /* If the memory just allocated cannot be addressed thru a Lisp 1095 /* If the memory just allocated cannot be addressed thru a Lisp
1096 object's pointer, and it needs to be, that's equivalent to 1096 object's pointer, and it needs to be, that's equivalent to
1097 running out of memory. */ 1097 running out of memory. */
@@ -1584,20 +1584,6 @@ mark_interval_tree (register INTERVAL tree)
1584 if (! NULL_INTERVAL_P (i)) \ 1584 if (! NULL_INTERVAL_P (i)) \
1585 (i) = balance_intervals (i); \ 1585 (i) = balance_intervals (i); \
1586 } while (0) 1586 } while (0)
1587
1588
1589/* Number support. If USE_LISP_UNION_TYPE is in effect, we
1590 can't create number objects in macros. */
1591#ifndef make_number
1592Lisp_Object
1593make_number (EMACS_INT n)
1594{
1595 Lisp_Object obj;
1596 obj.s.val = n;
1597 obj.s.type = Lisp_Int;
1598 return obj;
1599}
1600#endif
1601 1587
1602/* Convert the pointer-sized word P to EMACS_INT while preserving its 1588/* Convert the pointer-sized word P to EMACS_INT while preserving its
1603 type and ptr fields. */ 1589 type and ptr fields. */
@@ -2943,18 +2929,13 @@ enum
2943 header_size = offsetof (struct Lisp_Vector, contents), 2929 header_size = offsetof (struct Lisp_Vector, contents),
2944 word_size = sizeof (Lisp_Object), 2930 word_size = sizeof (Lisp_Object),
2945 roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object), 2931 roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object),
2946#ifdef USE_LSB_TAG 2932 USE_LSB_TAG ? 1 << GCTYPEBITS : 1)
2947 8 /* Helps to maintain alignment constraints imposed by
2948 assumption that least 3 bits of pointers are always 0. */
2949#else
2950 1 /* If alignment doesn't matter, should round up
2951 to sizeof (Lisp_Object) at least. */
2952#endif
2953 )
2954 }; 2933 };
2955 2934
2956/* Round up X to nearest mult-of-ROUNDUP_SIZE, 2935/* ROUNDUP_SIZE must be a power of 2. */
2957 assuming ROUNDUP_SIZE is a power of 2. */ 2936verify ((roundup_size & (roundup_size - 1)) == 0);
2937
2938/* Round up X to nearest mult-of-ROUNDUP_SIZE. */
2958 2939
2959#define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1)) 2940#define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1))
2960 2941
@@ -3171,7 +3152,7 @@ sweep_vectors (void)
3171 == VECTOR_FREE_LIST_FLAG) 3152 == VECTOR_FREE_LIST_FLAG)
3172 vector->header.next.nbytes = 3153 vector->header.next.nbytes =
3173 vector->header.size & (VECTOR_BLOCK_SIZE - 1); 3154 vector->header.size & (VECTOR_BLOCK_SIZE - 1);
3174 3155
3175 next = ADVANCE (vector, vector->header.next.nbytes); 3156 next = ADVANCE (vector, vector->header.next.nbytes);
3176 3157
3177 /* While NEXT is not marked, try to coalesce with VECTOR, 3158 /* While NEXT is not marked, try to coalesce with VECTOR,
@@ -3189,7 +3170,7 @@ sweep_vectors (void)
3189 vector->header.next.nbytes += nbytes; 3170 vector->header.next.nbytes += nbytes;
3190 next = ADVANCE (next, nbytes); 3171 next = ADVANCE (next, nbytes);
3191 } 3172 }
3192 3173
3193 eassert (vector->header.next.nbytes % roundup_size == 0); 3174 eassert (vector->header.next.nbytes % roundup_size == 0);
3194 3175
3195 if (vector == (struct Lisp_Vector *) block->data 3176 if (vector == (struct Lisp_Vector *) block->data
@@ -3468,7 +3449,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
3468union aligned_Lisp_Symbol 3449union aligned_Lisp_Symbol
3469{ 3450{
3470 struct Lisp_Symbol s; 3451 struct Lisp_Symbol s;
3471#ifdef USE_LSB_TAG 3452#if USE_LSB_TAG
3472 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1) 3453 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1)
3473 & -(1 << GCTYPEBITS)]; 3454 & -(1 << GCTYPEBITS)];
3474#endif 3455#endif
@@ -3574,7 +3555,7 @@ Its value and function definition are void, and its property list is nil. */)
3574union aligned_Lisp_Misc 3555union aligned_Lisp_Misc
3575{ 3556{
3576 union Lisp_Misc m; 3557 union Lisp_Misc m;
3577#ifdef USE_LSB_TAG 3558#if USE_LSB_TAG
3578 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1) 3559 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1)
3579 & -(1 << GCTYPEBITS)]; 3560 & -(1 << GCTYPEBITS)];
3580#endif 3561#endif
@@ -4556,14 +4537,10 @@ mark_maybe_pointer (void *p)
4556{ 4537{
4557 struct mem_node *m; 4538 struct mem_node *m;
4558 4539
4559 /* Quickly rule out some values which can't point to Lisp data. */ 4540 /* Quickly rule out some values which can't point to Lisp data.
4560 if ((intptr_t) p % 4541 USE_LSB_TAG needs Lisp data to be aligned on multiples of 1 << GCTYPEBITS.
4561#ifdef USE_LSB_TAG 4542 Otherwise, assume that Lisp data is aligned on even addresses. */
4562 8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */ 4543 if ((intptr_t) p % (USE_LSB_TAG ? 1 << GCTYPEBITS : 2))
4563#else
4564 2 /* We assume that Lisp data is aligned on even addresses. */
4565#endif
4566 )
4567 return; 4544 return;
4568 4545
4569 m = mem_find (p); 4546 m = mem_find (p);
@@ -4639,8 +4616,8 @@ mark_maybe_pointer (void *p)
4639 wider than a pointer might allocate a Lisp_Object in non-adjacent halves. 4616 wider than a pointer might allocate a Lisp_Object in non-adjacent halves.
4640 If USE_LSB_TAG, the bottom half is not a valid pointer, but it should 4617 If USE_LSB_TAG, the bottom half is not a valid pointer, but it should
4641 suffice to widen it to to a Lisp_Object and check it that way. */ 4618 suffice to widen it to to a Lisp_Object and check it that way. */
4642#if defined USE_LSB_TAG || VAL_MAX < UINTPTR_MAX 4619#if USE_LSB_TAG || VAL_MAX < UINTPTR_MAX
4643# if !defined USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS 4620# if !USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS
4644 /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer 4621 /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer
4645 nor mark_maybe_object can follow the pointers. This should not occur on 4622 nor mark_maybe_object can follow the pointers. This should not occur on
4646 any practical porting target. */ 4623 any practical porting target. */
@@ -5069,7 +5046,7 @@ static void *
5069pure_alloc (size_t size, int type) 5046pure_alloc (size_t size, int type)
5070{ 5047{
5071 void *result; 5048 void *result;
5072#ifdef USE_LSB_TAG 5049#if USE_LSB_TAG
5073 size_t alignment = (1 << GCTYPEBITS); 5050 size_t alignment = (1 << GCTYPEBITS);
5074#else 5051#else
5075 size_t alignment = sizeof (EMACS_INT); 5052 size_t alignment = sizeof (EMACS_INT);
diff --git a/src/data.c b/src/data.c
index defcd06a2ed..4449977dbe0 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1500,7 +1500,7 @@ The function `default-value' gets the default value and `set-default' sets it.
1500{ 1500{
1501 struct Lisp_Symbol *sym; 1501 struct Lisp_Symbol *sym;
1502 struct Lisp_Buffer_Local_Value *blv = NULL; 1502 struct Lisp_Buffer_Local_Value *blv = NULL;
1503 union Lisp_Val_Fwd valcontents IF_LINT (= {0}); 1503 union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
1504 int forwarded IF_LINT (= 0); 1504 int forwarded IF_LINT (= 0);
1505 1505
1506 CHECK_SYMBOL (variable); 1506 CHECK_SYMBOL (variable);
@@ -1577,7 +1577,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1577{ 1577{
1578 register Lisp_Object tem; 1578 register Lisp_Object tem;
1579 int forwarded IF_LINT (= 0); 1579 int forwarded IF_LINT (= 0);
1580 union Lisp_Val_Fwd valcontents IF_LINT (= {0}); 1580 union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
1581 struct Lisp_Symbol *sym; 1581 struct Lisp_Symbol *sym;
1582 struct Lisp_Buffer_Local_Value *blv = NULL; 1582 struct Lisp_Buffer_Local_Value *blv = NULL;
1583 1583
diff --git a/src/emacs.c b/src/emacs.c
index 8ffacdab1c6..bc3f918e2af 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -104,7 +104,7 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati
104 104
105/* Make these values available in GDB, which doesn't see macros. */ 105/* Make these values available in GDB, which doesn't see macros. */
106 106
107#ifdef USE_LSB_TAG 107#if USE_LSB_TAG
108int gdb_use_lsb EXTERNALLY_VISIBLE = 1; 108int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
109#else 109#else
110int gdb_use_lsb EXTERNALLY_VISIBLE = 0; 110int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
@@ -116,7 +116,7 @@ int gdb_use_union EXTERNALLY_VISIBLE = 1;
116#endif 116#endif
117int gdb_valbits EXTERNALLY_VISIBLE = VALBITS; 117int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
118int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; 118int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
119#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) 119#if defined DATA_SEG_BITS && !USE_LSB_TAG
120uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; 120uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
121#else 121#else
122uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; 122uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
diff --git a/src/ftfont.c b/src/ftfont.c
index 5545b4b4ae2..bfce7425af4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -525,7 +525,7 @@ static int ftfont_variation_glyphs (struct font *, int c,
525 525
526struct font_driver ftfont_driver = 526struct font_driver ftfont_driver =
527 { 527 {
528 0, /* Qfreetype */ 528 LISP_INITIALLY_ZERO, /* Qfreetype */
529 0, /* case insensitive */ 529 0, /* case insensitive */
530 ftfont_get_cache, 530 ftfont_get_cache,
531 ftfont_list, 531 ftfont_list,
diff --git a/src/lisp.h b/src/lisp.h
index 9e108d950d3..0e9b0c63c7f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -161,10 +161,8 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
161 always 0, and we can thus use them to hold tag bits, without 161 always 0, and we can thus use them to hold tag bits, without
162 restricting our addressing space. 162 restricting our addressing space.
163 163
164 If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus 164 If ! USE_LSB_TAG, then use the top 3 bits for tagging, thus
165 restricting our possible address range. Currently USE_LSB_TAG is not 165 restricting our possible address range.
166 allowed together with a union. This is not due to any fundamental
167 technical (or political ;-) problem: nobody wrote the code to do it yet.
168 166
169 USE_LSB_TAG not only requires the least 3 bits of pointers returned by 167 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
170 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment 168 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
@@ -201,25 +199,31 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
201# endif 199# endif
202#endif 200#endif
203 201
204/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ 202/* Unless otherwise specified, use USE_LSB_TAG on systems where: */
205#if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ 203#ifndef USE_LSB_TAG
206 || defined DARWIN_OS || defined __sun) 204/* 1. We know malloc returns a multiple of 8. */
207/* We also need to be able to specify mult-of-8 alignment on static vars. */ 205# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
208# if defined DECL_ALIGN 206 || defined DARWIN_OS || defined __sun)
209/* On hosts where pointers-as-ints do not exceed VAL_MAX, 207/* 2. We can specify multiple-of-8 alignment on static variables. */
210 USE_LSB_TAG is: 208# ifdef DECL_ALIGN
209/* 3. Pointers-as-ints exceed VAL_MAX.
210 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
211 a. unnecessary, because the top bits of an EMACS_INT are unused, and 211 a. unnecessary, because the top bits of an EMACS_INT are unused, and
212 b. slower, because it typically requires extra masking. 212 b. slower, because it typically requires extra masking.
213 So, define USE_LSB_TAG only on hosts where it might be useful. */ 213 So, default USE_LSB_TAG to 1 only on hosts where it might be useful. */
214# if VAL_MAX < UINTPTR_MAX 214# if VAL_MAX < UINTPTR_MAX
215# define USE_LSB_TAG 215# define USE_LSB_TAG 1
216# endif
216# endif 217# endif
217# endif 218# endif
218#endif 219#endif
220#ifndef USE_LSB_TAG
221# define USE_LSB_TAG 0
222#endif
219 223
220/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ 224/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */
221#ifndef DECL_ALIGN 225#ifndef DECL_ALIGN
222# ifdef USE_LSB_TAG 226# if USE_LSB_TAG
223# error "USE_LSB_TAG used without defining DECL_ALIGN" 227# error "USE_LSB_TAG used without defining DECL_ALIGN"
224# endif 228# endif
225# define DECL_ALIGN(type, var) type var 229# define DECL_ALIGN(type, var) type var
@@ -248,7 +252,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
248#else 252#else
249# define LISP_INT_TAG Lisp_Int0 253# define LISP_INT_TAG Lisp_Int0
250# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 254# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
251# ifdef USE_LSB_TAG 255# if USE_LSB_TAG
252# define LISP_INT1_TAG 4 256# define LISP_INT1_TAG 4
253# define LISP_STRING_TAG 1 257# define LISP_STRING_TAG 1
254# define LISP_INT_TAG_P(x) (((x) & 3) == 0) 258# define LISP_INT_TAG_P(x) (((x) & 3) == 0)
@@ -333,10 +337,6 @@ enum Lisp_Fwd_Type
333 337
334#ifdef USE_LISP_UNION_TYPE 338#ifdef USE_LISP_UNION_TYPE
335 339
336#ifndef WORDS_BIGENDIAN
337
338/* Definition of Lisp_Object for little-endian machines. */
339
340typedef 340typedef
341union Lisp_Object 341union Lisp_Object
342 { 342 {
@@ -359,44 +359,13 @@ union Lisp_Object
359 } 359 }
360Lisp_Object; 360Lisp_Object;
361 361
362#else /* If WORDS_BIGENDIAN */
363
364typedef
365union Lisp_Object
366 {
367 /* Used for comparing two Lisp_Objects;
368 also, positive integers can be accessed fast this way. */
369 EMACS_INT i;
370
371 struct
372 {
373 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
374 /* Use explicit signed, the signedness of a bit-field of type
375 int is implementation defined. */
376 signed EMACS_INT val : VALBITS;
377 } s;
378 struct
379 {
380 ENUM_BF (Lisp_Type) type : GCTYPEBITS;
381 EMACS_UINT val : VALBITS;
382 } u;
383 }
384Lisp_Object;
385
386#endif /* WORDS_BIGENDIAN */
387
388#ifdef __GNUC__
389static inline Lisp_Object 362static inline Lisp_Object
390LISP_MAKE_RVALUE (Lisp_Object o) 363LISP_MAKE_RVALUE (Lisp_Object o)
391{ 364{
392 return o; 365 return o;
393} 366}
394#else 367
395/* This is more portable to pre-C99 non-GCC compilers, but for 368#define LISP_INITIALLY_ZERO {0}
396 backwards compatibility GCC still accepts an old GNU extension
397 which caused this to only generate a warning. */
398#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o))
399#endif
400 369
401#else /* USE_LISP_UNION_TYPE */ 370#else /* USE_LISP_UNION_TYPE */
402 371
@@ -404,6 +373,7 @@ LISP_MAKE_RVALUE (Lisp_Object o)
404 373
405typedef EMACS_INT Lisp_Object; 374typedef EMACS_INT Lisp_Object;
406#define LISP_MAKE_RVALUE(o) (0+(o)) 375#define LISP_MAKE_RVALUE(o) (0+(o))
376#define LISP_INITIALLY_ZERO 0
407#endif /* USE_LISP_UNION_TYPE */ 377#endif /* USE_LISP_UNION_TYPE */
408 378
409/* In the size word of a vector, this bit means the vector has been marked. */ 379/* In the size word of a vector, this bit means the vector has been marked. */
@@ -467,7 +437,7 @@ enum pvec_type
467/* Return a perfect hash of the Lisp_Object representation. */ 437/* Return a perfect hash of the Lisp_Object representation. */
468#define XHASH(a) (a) 438#define XHASH(a) (a)
469 439
470#ifdef USE_LSB_TAG 440#if USE_LSB_TAG
471 441
472#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1) 442#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
473#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK)) 443#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK))
@@ -542,12 +512,12 @@ enum pvec_type
542#define XINT(a) ((EMACS_INT) (a).s.val) 512#define XINT(a) ((EMACS_INT) (a).s.val)
543#define XUINT(a) ((EMACS_UINT) (a).u.val) 513#define XUINT(a) ((EMACS_UINT) (a).u.val)
544 514
545#ifdef USE_LSB_TAG 515#if USE_LSB_TAG
546 516
547# define XSET(var, vartype, ptr) \ 517# define XSET(var, vartype, ptr) \
548 (eassert ((((uintptr_t) (ptr)) & ((1 << GCTYPEBITS) - 1)) == 0), \ 518 (eassert (((uintptr_t) (ptr) & ((1 << GCTYPEBITS) - 1)) == 0), \
549 (var).u.val = ((uintptr_t) (ptr)) >> GCTYPEBITS, \ 519 (var).u.val = (uintptr_t) (ptr) >> GCTYPEBITS, \
550 (var).u.type = ((char) (vartype))) 520 (var).u.type = (vartype))
551 521
552/* Some versions of gcc seem to consider the bitfield width when issuing 522/* Some versions of gcc seem to consider the bitfield width when issuing
553 the "cast to pointer from integer of different size" warning, so the 523 the "cast to pointer from integer of different size" warning, so the
@@ -556,14 +526,8 @@ enum pvec_type
556 526
557#else /* !USE_LSB_TAG */ 527#else /* !USE_LSB_TAG */
558 528
559/* For integers known to be positive, XFASTINT provides fast retrieval
560 and XSETFASTINT provides fast storage. This takes advantage of the
561 fact that Lisp_Int is 0. */
562# define XFASTINT(a) ((a).i + 0)
563# define XSETFASTINT(a, b) ((a).i = (b))
564
565# define XSET(var, vartype, ptr) \ 529# define XSET(var, vartype, ptr) \
566 (((var).s.val = ((intptr_t) (ptr))), ((var).s.type = ((char) (vartype)))) 530 ((var).s.val = (intptr_t) (ptr), (var).s.type = (vartype))
567 531
568#ifdef DATA_SEG_BITS 532#ifdef DATA_SEG_BITS
569/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers 533/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
@@ -575,12 +539,14 @@ enum pvec_type
575 539
576#endif /* !USE_LSB_TAG */ 540#endif /* !USE_LSB_TAG */
577 541
578#if __GNUC__ >= 2 && defined (__OPTIMIZE__) 542static inline Lisp_Object
579#define make_number(N) \ 543make_number (EMACS_INT n)
580 (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; })) 544{
581#else 545 Lisp_Object o;
582extern Lisp_Object make_number (EMACS_INT); 546 o.s.val = n;
583#endif 547 o.s.type = Lisp_Int;
548 return o;
549}
584 550
585#endif /* USE_LISP_UNION_TYPE */ 551#endif /* USE_LISP_UNION_TYPE */
586 552
diff --git a/src/mem-limits.h b/src/mem-limits.h
index 1fd53b472f3..01b0e6ebb2b 100644
--- a/src/mem-limits.h
+++ b/src/mem-limits.h
@@ -34,7 +34,7 @@ extern int etext;
34#endif 34#endif
35 35
36extern char *start_of_data (void); 36extern char *start_of_data (void);
37#if defined USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX 37#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
38#define EXCEEDS_LISP_PTR(ptr) 0 38#define EXCEEDS_LISP_PTR(ptr) 0
39#elif defined DATA_SEG_BITS 39#elif defined DATA_SEG_BITS
40#define EXCEEDS_LISP_PTR(ptr) \ 40#define EXCEEDS_LISP_PTR(ptr) \
diff --git a/src/w32heap.c b/src/w32heap.c
index da8579896f2..00572b20ae9 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -114,7 +114,7 @@ get_data_end (void)
114 return data_region_end; 114 return data_region_end;
115} 115}
116 116
117#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) 117#if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
118static char * 118static char *
119allocate_heap (void) 119allocate_heap (void)
120{ 120{
@@ -259,7 +259,7 @@ init_heap (void)
259 exit (1); 259 exit (1);
260 } 260 }
261 261
262#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) 262#if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
263 /* Ensure that the addresses don't use the upper tag bits since 263 /* Ensure that the addresses don't use the upper tag bits since
264 the Lisp type goes there. */ 264 the Lisp type goes there. */
265 if (((unsigned long) data_region_base & ~VALMASK) != 0) 265 if (((unsigned long) data_region_base & ~VALMASK) != 0)
diff --git a/src/xfont.c b/src/xfont.c
index bde76c0ba3c..cc06e27fe02 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -132,7 +132,7 @@ static int xfont_check (FRAME_PTR, struct font *);
132 132
133struct font_driver xfont_driver = 133struct font_driver xfont_driver =
134 { 134 {
135 0, /* Qx */ 135 LISP_INITIALLY_ZERO, /* Qx */
136 0, /* case insensitive */ 136 0, /* case insensitive */
137 xfont_get_cache, 137 xfont_get_cache,
138 xfont_list, 138 xfont_list,