Commit bfe3e0a2 authored by Paul Eggert's avatar Paul Eggert
Browse files

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.
parent 1cce6920
2012-06-13 Paul Eggert <eggert@cs.ucla.edu>
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.
2012-06-12 Glenn Morris <rgm@gnu.org> 2012-06-12 Glenn Morris <rgm@gnu.org>
* s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files. * s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files.
......
...@@ -533,7 +533,7 @@ buffer_memory_full (ptrdiff_t nbytes) ...@@ -533,7 +533,7 @@ buffer_memory_full (ptrdiff_t nbytes)
}, \ }, \
c) c)
#ifdef USE_LSB_TAG #if USE_LSB_TAG
# define XMALLOC_HEADER_ALIGNMENT \ # define XMALLOC_HEADER_ALIGNMENT \
COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT) COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT)
#else #else
...@@ -893,8 +893,8 @@ safe_alloca_unwind (Lisp_Object arg) ...@@ -893,8 +893,8 @@ safe_alloca_unwind (Lisp_Object arg)
number of bytes to allocate, TYPE describes the intended use of the number of bytes to allocate, TYPE describes the intended use of the
allocated memory block (for strings, for conses, ...). */ allocated memory block (for strings, for conses, ...). */
#ifndef USE_LSB_TAG #if ! USE_LSB_TAG
static void *lisp_malloc_loser; void *lisp_malloc_loser EXTERNALLY_VISIBLE;
#endif #endif
static void * static void *
...@@ -910,7 +910,7 @@ lisp_malloc (size_t nbytes, enum mem_type type) ...@@ -910,7 +910,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
val = (void *) malloc (nbytes); val = (void *) malloc (nbytes);
#ifndef USE_LSB_TAG #if ! USE_LSB_TAG
/* If the memory just allocated cannot be addressed thru a Lisp /* If the memory just allocated cannot be addressed thru a Lisp
object's pointer, and it needs to be, object's pointer, and it needs to be,
that's equivalent to running out of memory. */ that's equivalent to running out of memory. */
...@@ -1091,7 +1091,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type) ...@@ -1091,7 +1091,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
#endif #endif
#ifndef USE_LSB_TAG #if ! USE_LSB_TAG
/* If the memory just allocated cannot be addressed thru a Lisp /* If the memory just allocated cannot be addressed thru a Lisp
object's pointer, and it needs to be, that's equivalent to object's pointer, and it needs to be, that's equivalent to
running out of memory. */ running out of memory. */
...@@ -1584,20 +1584,6 @@ mark_interval_tree (register INTERVAL tree) ...@@ -1584,20 +1584,6 @@ mark_interval_tree (register INTERVAL tree)
if (! NULL_INTERVAL_P (i)) \ if (! NULL_INTERVAL_P (i)) \
(i) = balance_intervals (i); \ (i) = balance_intervals (i); \
} while (0) } while (0)
/* Number support. If USE_LISP_UNION_TYPE is in effect, we
can't create number objects in macros. */
#ifndef make_number
Lisp_Object
make_number (EMACS_INT n)
{
Lisp_Object obj;
obj.s.val = n;
obj.s.type = Lisp_Int;
return obj;
}
#endif
/* Convert the pointer-sized word P to EMACS_INT while preserving its /* Convert the pointer-sized word P to EMACS_INT while preserving its
type and ptr fields. */ type and ptr fields. */
...@@ -2943,18 +2929,13 @@ enum ...@@ -2943,18 +2929,13 @@ enum
header_size = offsetof (struct Lisp_Vector, contents), header_size = offsetof (struct Lisp_Vector, contents),
word_size = sizeof (Lisp_Object), word_size = sizeof (Lisp_Object),
roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object), roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object),
#ifdef USE_LSB_TAG USE_LSB_TAG ? 1 << GCTYPEBITS : 1)
8 /* Helps to maintain alignment constraints imposed by
assumption that least 3 bits of pointers are always 0. */
#else
1 /* If alignment doesn't matter, should round up
to sizeof (Lisp_Object) at least. */
#endif
)
}; };
/* Round up X to nearest mult-of-ROUNDUP_SIZE, /* ROUNDUP_SIZE must be a power of 2. */
assuming ROUNDUP_SIZE is a power of 2. */ verify ((roundup_size & (roundup_size - 1)) == 0);
/* Round up X to nearest mult-of-ROUNDUP_SIZE. */
#define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1)) #define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1))
...@@ -3171,7 +3152,7 @@ sweep_vectors (void) ...@@ -3171,7 +3152,7 @@ sweep_vectors (void)
== VECTOR_FREE_LIST_FLAG) == VECTOR_FREE_LIST_FLAG)
vector->header.next.nbytes = vector->header.next.nbytes =
vector->header.size & (VECTOR_BLOCK_SIZE - 1); vector->header.size & (VECTOR_BLOCK_SIZE - 1);
next = ADVANCE (vector, vector->header.next.nbytes); next = ADVANCE (vector, vector->header.next.nbytes);
/* While NEXT is not marked, try to coalesce with VECTOR, /* While NEXT is not marked, try to coalesce with VECTOR,
...@@ -3189,7 +3170,7 @@ sweep_vectors (void) ...@@ -3189,7 +3170,7 @@ sweep_vectors (void)
vector->header.next.nbytes += nbytes; vector->header.next.nbytes += nbytes;
next = ADVANCE (next, nbytes); next = ADVANCE (next, nbytes);
} }
eassert (vector->header.next.nbytes % roundup_size == 0); eassert (vector->header.next.nbytes % roundup_size == 0);
if (vector == (struct Lisp_Vector *) block->data if (vector == (struct Lisp_Vector *) block->data
...@@ -3468,7 +3449,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT ...@@ -3468,7 +3449,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
union aligned_Lisp_Symbol union aligned_Lisp_Symbol
{ {
struct Lisp_Symbol s; struct Lisp_Symbol s;
#ifdef USE_LSB_TAG #if USE_LSB_TAG
unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1) unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1)
& -(1 << GCTYPEBITS)]; & -(1 << GCTYPEBITS)];
#endif #endif
...@@ -3574,7 +3555,7 @@ Its value and function definition are void, and its property list is nil. */) ...@@ -3574,7 +3555,7 @@ Its value and function definition are void, and its property list is nil. */)
union aligned_Lisp_Misc union aligned_Lisp_Misc
{ {
union Lisp_Misc m; union Lisp_Misc m;
#ifdef USE_LSB_TAG #if USE_LSB_TAG
unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1) unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1)
& -(1 << GCTYPEBITS)]; & -(1 << GCTYPEBITS)];
#endif #endif
...@@ -4556,14 +4537,10 @@ mark_maybe_pointer (void *p) ...@@ -4556,14 +4537,10 @@ mark_maybe_pointer (void *p)
{ {
struct mem_node *m; struct mem_node *m;
/* Quickly rule out some values which can't point to Lisp data. */ /* Quickly rule out some values which can't point to Lisp data.
if ((intptr_t) p % USE_LSB_TAG needs Lisp data to be aligned on multiples of 1 << GCTYPEBITS.
#ifdef USE_LSB_TAG Otherwise, assume that Lisp data is aligned on even addresses. */
8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8. */ if ((intptr_t) p % (USE_LSB_TAG ? 1 << GCTYPEBITS : 2))
#else
2 /* We assume that Lisp data is aligned on even addresses. */
#endif
)
return; return;
m = mem_find (p); m = mem_find (p);
...@@ -4639,8 +4616,8 @@ mark_maybe_pointer (void *p) ...@@ -4639,8 +4616,8 @@ mark_maybe_pointer (void *p)
wider than a pointer might allocate a Lisp_Object in non-adjacent halves. wider than a pointer might allocate a Lisp_Object in non-adjacent halves.
If USE_LSB_TAG, the bottom half is not a valid pointer, but it should If USE_LSB_TAG, the bottom half is not a valid pointer, but it should
suffice to widen it to to a Lisp_Object and check it that way. */ suffice to widen it to to a Lisp_Object and check it that way. */
#if defined USE_LSB_TAG || VAL_MAX < UINTPTR_MAX #if USE_LSB_TAG || VAL_MAX < UINTPTR_MAX
# if !defined USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS # if !USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS
/* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer
nor mark_maybe_object can follow the pointers. This should not occur on nor mark_maybe_object can follow the pointers. This should not occur on
any practical porting target. */ any practical porting target. */
...@@ -5069,7 +5046,7 @@ static void * ...@@ -5069,7 +5046,7 @@ static void *
pure_alloc (size_t size, int type) pure_alloc (size_t size, int type)
{ {
void *result; void *result;
#ifdef USE_LSB_TAG #if USE_LSB_TAG
size_t alignment = (1 << GCTYPEBITS); size_t alignment = (1 << GCTYPEBITS);
#else #else
size_t alignment = sizeof (EMACS_INT); size_t alignment = sizeof (EMACS_INT);
......
...@@ -1500,7 +1500,7 @@ The function `default-value' gets the default value and `set-default' sets it. ...@@ -1500,7 +1500,7 @@ The function `default-value' gets the default value and `set-default' sets it.
{ {
struct Lisp_Symbol *sym; struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL; struct Lisp_Buffer_Local_Value *blv = NULL;
union Lisp_Val_Fwd valcontents IF_LINT (= {0}); union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
int forwarded IF_LINT (= 0); int forwarded IF_LINT (= 0);
CHECK_SYMBOL (variable); CHECK_SYMBOL (variable);
...@@ -1577,7 +1577,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) ...@@ -1577,7 +1577,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
{ {
register Lisp_Object tem; register Lisp_Object tem;
int forwarded IF_LINT (= 0); int forwarded IF_LINT (= 0);
union Lisp_Val_Fwd valcontents IF_LINT (= {0}); union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
struct Lisp_Symbol *sym; struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL; struct Lisp_Buffer_Local_Value *blv = NULL;
......
...@@ -104,7 +104,7 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati ...@@ -104,7 +104,7 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati
/* Make these values available in GDB, which doesn't see macros. */ /* Make these values available in GDB, which doesn't see macros. */
#ifdef USE_LSB_TAG #if USE_LSB_TAG
int gdb_use_lsb EXTERNALLY_VISIBLE = 1; int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
#else #else
int gdb_use_lsb EXTERNALLY_VISIBLE = 0; int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
...@@ -116,7 +116,7 @@ int gdb_use_union EXTERNALLY_VISIBLE = 1; ...@@ -116,7 +116,7 @@ int gdb_use_union EXTERNALLY_VISIBLE = 1;
#endif #endif
int gdb_valbits EXTERNALLY_VISIBLE = VALBITS; int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) #if defined DATA_SEG_BITS && !USE_LSB_TAG
uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
#else #else
uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
......
...@@ -525,7 +525,7 @@ static int ftfont_variation_glyphs (struct font *, int c, ...@@ -525,7 +525,7 @@ static int ftfont_variation_glyphs (struct font *, int c,
struct font_driver ftfont_driver = struct font_driver ftfont_driver =
{ {
0, /* Qfreetype */ LISP_INITIALLY_ZERO, /* Qfreetype */
0, /* case insensitive */ 0, /* case insensitive */
ftfont_get_cache, ftfont_get_cache,
ftfont_list, ftfont_list,
......
...@@ -161,10 +161,8 @@ extern int suppress_checking EXTERNALLY_VISIBLE; ...@@ -161,10 +161,8 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
always 0, and we can thus use them to hold tag bits, without always 0, and we can thus use them to hold tag bits, without
restricting our addressing space. restricting our addressing space.
If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus If ! USE_LSB_TAG, then use the top 3 bits for tagging, thus
restricting our possible address range. Currently USE_LSB_TAG is not restricting our possible address range.
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 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 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,25 +199,31 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
# endif # endif
#endif #endif
/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ /* Unless otherwise specified, use USE_LSB_TAG on systems where: */
#if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ #ifndef USE_LSB_TAG
|| defined DARWIN_OS || defined __sun) /* 1. We know malloc returns a multiple of 8. */
/* We also need to be able to specify mult-of-8 alignment on static vars. */ # if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
# if defined DECL_ALIGN || defined DARWIN_OS || defined __sun)
/* On hosts where pointers-as-ints do not exceed VAL_MAX, /* 2. We can specify multiple-of-8 alignment on static variables. */
USE_LSB_TAG is: # ifdef DECL_ALIGN
/* 3. Pointers-as-ints exceed VAL_MAX.
On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
a. unnecessary, because the top bits of an EMACS_INT are unused, and a. unnecessary, because the top bits of an EMACS_INT are unused, and
b. slower, because it typically requires extra masking. b. slower, because it typically requires extra masking.
So, define USE_LSB_TAG only on hosts where it might be useful. */ So, default USE_LSB_TAG to 1 only on hosts where it might be useful. */
# if VAL_MAX < UINTPTR_MAX # if VAL_MAX < UINTPTR_MAX
# define USE_LSB_TAG # define USE_LSB_TAG 1
# endif
# endif # endif
# endif # endif
#endif #endif
#ifndef USE_LSB_TAG
# define USE_LSB_TAG 0
#endif
/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ /* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */
#ifndef DECL_ALIGN #ifndef DECL_ALIGN
# ifdef USE_LSB_TAG # if USE_LSB_TAG
# error "USE_LSB_TAG used without defining DECL_ALIGN" # error "USE_LSB_TAG used without defining DECL_ALIGN"
# endif # endif
# define DECL_ALIGN(type, var) type var # define DECL_ALIGN(type, var) type var
...@@ -248,7 +252,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE; ...@@ -248,7 +252,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
#else #else
# define LISP_INT_TAG Lisp_Int0 # define LISP_INT_TAG Lisp_Int0
# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 # define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
# ifdef USE_LSB_TAG # if USE_LSB_TAG
# define LISP_INT1_TAG 4 # define LISP_INT1_TAG 4
# define LISP_STRING_TAG 1 # define LISP_STRING_TAG 1
# define LISP_INT_TAG_P(x) (((x) & 3) == 0) # define LISP_INT_TAG_P(x) (((x) & 3) == 0)
...@@ -333,10 +337,6 @@ enum Lisp_Fwd_Type ...@@ -333,10 +337,6 @@ enum Lisp_Fwd_Type
#ifdef USE_LISP_UNION_TYPE #ifdef USE_LISP_UNION_TYPE
#ifndef WORDS_BIGENDIAN
/* Definition of Lisp_Object for little-endian machines. */
typedef typedef
union Lisp_Object union Lisp_Object
{ {
...@@ -359,44 +359,13 @@ union Lisp_Object ...@@ -359,44 +359,13 @@ union Lisp_Object
} }
Lisp_Object; Lisp_Object;
#else /* If WORDS_BIGENDIAN */
typedef
union Lisp_Object
{
/* Used for comparing two Lisp_Objects;
also, positive integers can be accessed fast this way. */
EMACS_INT i;
struct
{
ENUM_BF (Lisp_Type) type : GCTYPEBITS;
/* Use explicit signed, the signedness of a bit-field of type
int is implementation defined. */
signed EMACS_INT val : VALBITS;
} s;
struct
{
ENUM_BF (Lisp_Type) type : GCTYPEBITS;
EMACS_UINT val : VALBITS;
} u;
}
Lisp_Object;
#endif /* WORDS_BIGENDIAN */
#ifdef __GNUC__
static inline Lisp_Object static inline Lisp_Object
LISP_MAKE_RVALUE (Lisp_Object o) LISP_MAKE_RVALUE (Lisp_Object o)
{ {
return o; return o;
} }
#else
/* This is more portable to pre-C99 non-GCC compilers, but for #define LISP_INITIALLY_ZERO {0}
backwards compatibility GCC still accepts an old GNU extension
which caused this to only generate a warning. */
#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o))
#endif
#else /* USE_LISP_UNION_TYPE */ #else /* USE_LISP_UNION_TYPE */
...@@ -404,6 +373,7 @@ LISP_MAKE_RVALUE (Lisp_Object o) ...@@ -404,6 +373,7 @@ LISP_MAKE_RVALUE (Lisp_Object o)
typedef EMACS_INT Lisp_Object; typedef EMACS_INT Lisp_Object;
#define LISP_MAKE_RVALUE(o) (0+(o)) #define LISP_MAKE_RVALUE(o) (0+(o))
#define LISP_INITIALLY_ZERO 0
#endif /* USE_LISP_UNION_TYPE */ #endif /* USE_LISP_UNION_TYPE */
/* In the size word of a vector, this bit means the vector has been marked. */ /* In the size word of a vector, this bit means the vector has been marked. */
...@@ -467,7 +437,7 @@ enum pvec_type ...@@ -467,7 +437,7 @@ enum pvec_type
/* Return a perfect hash of the Lisp_Object representation. */ /* Return a perfect hash of the Lisp_Object representation. */
#define XHASH(a) (a) #define XHASH(a) (a)
#ifdef USE_LSB_TAG #if USE_LSB_TAG
#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1) #define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK)) #define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK))
...@@ -542,12 +512,12 @@ enum pvec_type ...@@ -542,12 +512,12 @@ enum pvec_type
#define XINT(a) ((EMACS_INT) (a).s.val) #define XINT(a) ((EMACS_INT) (a).s.val)
#define XUINT(a) ((EMACS_UINT) (a).u.val) #define XUINT(a) ((EMACS_UINT) (a).u.val)
#ifdef USE_LSB_TAG #if USE_LSB_TAG
# define XSET(var, vartype, ptr) \ # define XSET(var, vartype, ptr) \
(eassert ((((uintptr_t) (ptr)) & ((1 << GCTYPEBITS) - 1)) == 0), \ (eassert (((uintptr_t) (ptr) & ((1 << GCTYPEBITS) - 1)) == 0), \
(var).u.val = ((uintptr_t) (ptr)) >> GCTYPEBITS, \ (var).u.val = (uintptr_t) (ptr) >> GCTYPEBITS, \
(var).u.type = ((char) (vartype))) (var).u.type = (vartype))
/* Some versions of gcc seem to consider the bitfield width when issuing /* Some versions of gcc seem to consider the bitfield width when issuing
the "cast to pointer from integer of different size" warning, so the the "cast to pointer from integer of different size" warning, so the
...@@ -556,14 +526,8 @@ enum pvec_type ...@@ -556,14 +526,8 @@ enum pvec_type
#else /* !USE_LSB_TAG */ #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) \ # define XSET(var, vartype, ptr) \
(((var).s.val = ((intptr_t) (ptr))), ((var).s.type = ((char) (vartype)))) ((var).s.val = (intptr_t) (ptr), (var).s.type = (vartype))
#ifdef DATA_SEG_BITS #ifdef DATA_SEG_BITS
/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
...@@ -575,12 +539,14 @@ enum pvec_type ...@@ -575,12 +539,14 @@ enum pvec_type
#endif /* !USE_LSB_TAG */ #endif /* !USE_LSB_TAG */
#if __GNUC__ >= 2 && defined (__OPTIMIZE__) static inline Lisp_Object
#define make_number(N) \ make_number (EMACS_INT n)
(__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; })) {
#else Lisp_Object o;
extern Lisp_Object make_number (EMACS_INT); o.s.val = n;
#endif o.s.type = Lisp_Int;
return o;
}
#endif /* USE_LISP_UNION_TYPE */ #endif /* USE_LISP_UNION_TYPE */
......
...@@ -34,7 +34,7 @@ extern int etext; ...@@ -34,7 +34,7 @@ extern int etext;
#endif #endif
extern char *start_of_data (void); extern char *start_of_data (void);
#if defined USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX #if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
#define EXCEEDS_LISP_PTR(ptr) 0 #define EXCEEDS_LISP_PTR(ptr) 0
#elif defined DATA_SEG_BITS #elif defined DATA_SEG_BITS
#define EXCEEDS_LISP_PTR(ptr) \ #define EXCEEDS_LISP_PTR(ptr) \
......
...@@ -114,7 +114,7 @@ get_data_end (void) ...@@ -114,7 +114,7 @@ get_data_end (void)
return data_region_end; return data_region_end;
} }
#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) #if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
static char * static char *
allocate_heap (void) allocate_heap (void)
{ {
...@@ -259,7 +259,7 @@ init_heap (void) ...@@ -259,7 +259,7 @@ init_heap (void)
exit (1); exit (1);
} }
#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG) #if !defined USE_LISP_UNION_TYPE && !USE_LSB_TAG
/* Ensure that the addresses don't use the upper tag bits since /* Ensure that the addresses don't use the upper tag bits since
the Lisp type goes there. */ the Lisp type goes there. */
if (((unsigned long) data_region_base & ~VALMASK) != 0) if (((unsigned long) data_region_base & ~VALMASK) != 0)
......
...@@ -132,7 +132,7 @@ static int xfont_check (FRAME_PTR, struct font *); ...@@ -132,7 +132,7 @@ static int xfont_check (FRAME_PTR, struct font *);
struct font_driver xfont_driver = struct font_driver xfont_driver =
{ {
0, /* Qx */ LISP_INITIALLY_ZERO, /* Qx */
0, /* case insensitive */ 0, /* case insensitive */
xfont_get_cache, xfont_get_cache,
xfont_list, xfont_list,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment