diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2014-04-16 08:16:35 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-04-16 08:16:35 -0700 |
commit | 5403b2d3aa512341234700e0a7e3db042fe229fd (patch) | |
tree | 828d075426fdf3e241c95ffacf57bbb3bbdcd0b6 /src | |
parent | 9dcd90f7693f4eabdfae4f29cd1c40a4d3385529 (diff) | |
download | emacs-5403b2d3aa512341234700e0a7e3db042fe229fd.tar.gz |
Remove DATA_SEG_BITS.
The DATA_SEG_BITS hack was needed for older 32 bit platforms.
As a result of this change, Emacs won't work on IRIX 6.5 with IRIX
cc, but that platform is so old that SGI itself stopped supporting
it in December 2013. If you still need Emacs on IRIX, please
either compile with GCC and port the undumping code, or run
'./configure --with-wide-int'.
* configure.ac (DATA_SEG_BITS): Remove. All uses removed.
* src/alloc.c (gdb_make_enums_visible): Update to match lisp.h.
* src/lisp.h (GCTYPEBITS): Move definition up, and switch to the
DEFINE_GDB_SYMBOL_START way to define it.
(NONPOINTER_BITS): New macro.
(EMACS_INT): Use it.
[!USE_LSB_TAG && !WIDE_EMACS_INT]: Fail, and suggest reporting
the problem and/or configuring --with-wide-int.
(USE_LSB_TAG): Simplify, based on above changes.
(gdb_DATA_SEG_BITS): Remove. All uses removed.
* src/vm-limit.c (exceeds_lisp_ptr): Remove. All uses removed.
Diffstat (limited to 'src')
-rw-r--r-- | src/.gdbinit | 10 | ||||
-rw-r--r-- | src/ChangeLog | 20 | ||||
-rw-r--r-- | src/alloc.c | 1 | ||||
-rw-r--r-- | src/lisp.h | 74 | ||||
-rw-r--r-- | src/vm-limit.c | 12 |
5 files changed, 57 insertions, 60 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index 715744bc18e..fd2e871ff3d 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -49,7 +49,7 @@ define xgetptr else set $bugfix = $arg0 end - set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS + set $ptr = $bugfix & VALMASK end define xgetint @@ -1093,8 +1093,8 @@ document xprintsym end define xcoding - set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & VALMASK) | DATA_SEG_BITS) - set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) + set $tmp = (struct Lisp_Hash_Table *) (Vcoding_system_hash_table & VALMASK) + set $tmp = (struct Lisp_Vector *) ($tmp->key_and_value & VALMASK) set $name = $tmp->contents[$arg0 * 2] print $name pr @@ -1106,8 +1106,8 @@ document xcoding end define xcharset - set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & VALMASK) | DATA_SEG_BITS) - set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) + set $tmp = (struct Lisp_Hash_Table *) (Vcharset_hash_table & VALMASK) + set $tmp = (struct Lisp_Vector *) ($tmp->key_and_value & VALMASK) p $tmp->contents[charset_table[$arg0].hash_index * 2] pr end diff --git a/src/ChangeLog b/src/ChangeLog index 30852b3ae56..118ca723a5d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2014-04-15 Paul Eggert <eggert@cs.ucla.edu> + + Remove DATA_SEG_BITS. + The DATA_SEG_BITS hack was needed for older 32 bit platforms. + As a result of this change, Emacs won't work on IRIX 6.5 with IRIX + cc, but that platform is so old that SGI itself stopped supporting + it in December 2013. If you still need Emacs on IRIX, please + either compile with GCC and port the undumping code, or run + './configure --with-wide-int'. + * alloc.c (gdb_make_enums_visible): Update to match lisp.h. + * lisp.h (GCTYPEBITS): Move definition up, and switch to the + DEFINE_GDB_SYMBOL_START way to define it. + (NONPOINTER_BITS): New macro. + (EMACS_INT): Use it. + [!USE_LSB_TAG && !WIDE_EMACS_INT]: Fail, and suggest reporting + the problem and/or configuring --with-wide-int. + (USE_LSB_TAG): Simplify, based on above changes. + (gdb_DATA_SEG_BITS): Remove. All uses removed. + * vm-limit.c (exceeds_lisp_ptr): Remove. All uses removed. + 2014-04-12 Eli Zaretskii <eliz@gnu.org> * xdisp.c (move_it_by_lines): If a large portion of buffer text is diff --git a/src/alloc.c b/src/alloc.c index b2b159a7952..8b7c8aab535 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -7130,7 +7130,6 @@ union enum char_bits char_bits; enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; - enum enum_USE_LSB_TAG enum_USE_LSB_TAG; enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE; enum Lisp_Bits Lisp_Bits; enum Lisp_Compiled Lisp_Compiled; diff --git a/src/lisp.h b/src/lisp.h index 264b8832092..3e4ab174546 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -61,6 +61,23 @@ INLINE_HEADER_BEGIN /* Number of elements in an array. */ #define ARRAYELTS(arr) (sizeof (arr) / sizeof (arr)[0]) +/* Number of bits in a Lisp_Object tag. */ +DEFINE_GDB_SYMBOL_BEGIN (int, GCTYPEBITS) +#define GCTYPEBITS 3 +DEFINE_GDB_SYMBOL_END (GCTYPEBITS) + +/* The number of bits needed in an EMACS_INT over and above the number + of bits in a pointer. This is 0 on systems where: + 1. We can specify multiple-of-8 alignment on static variables. + 2. We know malloc returns a multiple of 8. */ +#if (defined alignas \ + && (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ + || defined DARWIN_OS || defined __sun)) +# define NONPOINTER_BITS 0 +#else +# define NONPOINTER_BITS GCTYPEBITS +#endif + /* EMACS_INT - signed integer wide enough to hold an Emacs value EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if pI - printf length modifier for EMACS_INT @@ -68,16 +85,18 @@ INLINE_HEADER_BEGIN #ifndef EMACS_INT_MAX # if INTPTR_MAX <= 0 # error "INTPTR_MAX misconfigured" -# elif INTPTR_MAX <= INT_MAX && !defined WIDE_EMACS_INT +# elif INTPTR_MAX <= INT_MAX >> NONPOINTER_BITS && !defined WIDE_EMACS_INT typedef int EMACS_INT; typedef unsigned int EMACS_UINT; # define EMACS_INT_MAX INT_MAX # define pI "" -# elif INTPTR_MAX <= LONG_MAX && !defined WIDE_EMACS_INT +# elif INTPTR_MAX <= LONG_MAX >> NONPOINTER_BITS && !defined WIDE_EMACS_INT typedef long int EMACS_INT; typedef unsigned long EMACS_UINT; # define EMACS_INT_MAX LONG_MAX # define pI "l" +/* Check versus LLONG_MAX, not LLONG_MAX >> NONPOINTER_BITS. + In theory this is not safe, but in practice it seems to be OK. */ # elif INTPTR_MAX <= LLONG_MAX typedef long long int EMACS_INT; typedef unsigned long long int EMACS_UINT; @@ -218,12 +237,6 @@ extern bool suppress_checking EXTERNALLY_VISIBLE; enum Lisp_Bits { - /* Number of bits in a Lisp_Object tag. This can be used in #if, - and for GDB's sake also as a regular symbol. */ - GCTYPEBITS = -#define GCTYPEBITS 3 - GCTYPEBITS, - /* 2**GCTYPEBITS. This must be a macro that expands to a literal integer constant, for MSVC. */ #define GCALIGNMENT 8 @@ -247,31 +260,19 @@ enum Lisp_Bits This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) -/* Unless otherwise specified, use USE_LSB_TAG on systems where: */ -#ifndef USE_LSB_TAG -/* 1. We know malloc returns a multiple of 8. */ -# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ - || defined DARWIN_OS || defined __sun) -/* 2. We can specify multiple-of-8 alignment on static variables. */ -# ifdef alignas -/* 3. Pointers-as-ints exceed VAL_MAX. +/* Whether the least-significant bits of an EMACS_INT contain the tag. 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 b. slower, because it typically requires extra masking. - So, default USE_LSB_TAG to true only on hosts where it might be useful. */ -# if VAL_MAX < UINTPTR_MAX -# define USE_LSB_TAG true -# endif -# endif -# endif -#endif -#ifdef USE_LSB_TAG -# undef USE_LSB_TAG -enum enum_USE_LSB_TAG { USE_LSB_TAG = true }; -# define USE_LSB_TAG true -#else -enum enum_USE_LSB_TAG { USE_LSB_TAG = false }; -# define USE_LSB_TAG false + So, USE_LSB_TAG is true only on hosts where it might be useful. */ +DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) +#define USE_LSB_TAG (EMACS_INT_MAX >> GCTYPEBITS < INTPTR_MAX) +DEFINE_GDB_SYMBOL_END (USE_LSB_TAG) + +#if !USE_LSB_TAG && !defined WIDE_EMACS_INT +# error "USE_LSB_TAG not supported on this platform; please report this." \ + "Try 'configure --with-wide-int' to work around the problem." +error !; #endif #ifndef alignas @@ -346,8 +347,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = false }; #define lisp_h_XCONS(a) \ (eassert (CONSP (a)), (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons)) #define lisp_h_XHASH(a) XUINT (a) -#define lisp_h_XPNTR(a) \ - ((void *) (intptr_t) ((XLI (a) & VALMASK) | DATA_SEG_BITS)) +#define lisp_h_XPNTR(a) ((void *) (intptr_t) (XLI (a) & VALMASK)) #define lisp_h_XSYMBOL(a) \ (eassert (SYMBOLP (a)), (struct Lisp_Symbol *) XUNTAG (a, Lisp_Symbol)) #ifndef GC_CHECK_CONS_LIST @@ -608,18 +608,8 @@ enum pvec_type PVEC_FONT /* Should be last because it's used for range checking. */ }; -/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers - which were stored in a Lisp_Object. */ -#ifndef DATA_SEG_BITS -# define DATA_SEG_BITS 0 -#endif -enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS }; -#undef DATA_SEG_BITS - enum More_Lisp_Bits { - DATA_SEG_BITS = gdb_DATA_SEG_BITS, - /* For convenience, we also store the number of elements in these bits. Note that this size is not necessarily the memory-footprint size, but only the number of Lisp_Object fields (that need to be traced by GC). diff --git a/src/vm-limit.c b/src/vm-limit.c index bad1d61e611..f138dc28b2e 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c @@ -71,15 +71,6 @@ static char *data_space_start; /* Number of bytes of writable memory we can expect to be able to get. */ static size_t lim_data; -/* Return true if PTR cannot be represented as an Emacs Lisp object. */ -static bool -exceeds_lisp_ptr (void *ptr) -{ - return (! USE_LSB_TAG - && VAL_MAX < UINTPTR_MAX - && ((uintptr_t) ptr & ~DATA_SEG_BITS) >> VALBITS != 0); -} - #ifdef HAVE_GETRLIMIT # ifndef RLIMIT_AS @@ -222,9 +213,6 @@ check_memory_limits (void) else if (warnlevel > warned_85 && data_size < five_percent * 18) warnlevel = warned_85; } - - if (exceeds_lisp_ptr (cp)) - (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); } /* Enable memory usage warnings. |