diff options
| author | Paul Eggert | 2014-04-16 08:16:35 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-04-16 08:16:35 -0700 |
| commit | 5403b2d3aa512341234700e0a7e3db042fe229fd (patch) | |
| tree | 828d075426fdf3e241c95ffacf57bbb3bbdcd0b6 /src | |
| parent | 9dcd90f7693f4eabdfae4f29cd1c40a4d3385529 (diff) | |
| download | emacs-5403b2d3aa512341234700e0a7e3db042fe229fd.tar.gz emacs-5403b2d3aa512341234700e0a7e3db042fe229fd.zip | |
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 | |||
| 49 | else | 49 | else |
| 50 | set $bugfix = $arg0 | 50 | set $bugfix = $arg0 |
| 51 | end | 51 | end |
| 52 | set $ptr = ($bugfix & VALMASK) | DATA_SEG_BITS | 52 | set $ptr = $bugfix & VALMASK |
| 53 | end | 53 | end |
| 54 | 54 | ||
| 55 | define xgetint | 55 | define xgetint |
| @@ -1093,8 +1093,8 @@ document xprintsym | |||
| 1093 | end | 1093 | end |
| 1094 | 1094 | ||
| 1095 | define xcoding | 1095 | define xcoding |
| 1096 | set $tmp = (struct Lisp_Hash_Table *) ((Vcoding_system_hash_table & VALMASK) | DATA_SEG_BITS) | 1096 | set $tmp = (struct Lisp_Hash_Table *) (Vcoding_system_hash_table & VALMASK) |
| 1097 | set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) | 1097 | set $tmp = (struct Lisp_Vector *) ($tmp->key_and_value & VALMASK) |
| 1098 | set $name = $tmp->contents[$arg0 * 2] | 1098 | set $name = $tmp->contents[$arg0 * 2] |
| 1099 | print $name | 1099 | print $name |
| 1100 | pr | 1100 | pr |
| @@ -1106,8 +1106,8 @@ document xcoding | |||
| 1106 | end | 1106 | end |
| 1107 | 1107 | ||
| 1108 | define xcharset | 1108 | define xcharset |
| 1109 | set $tmp = (struct Lisp_Hash_Table *) ((Vcharset_hash_table & VALMASK) | DATA_SEG_BITS) | 1109 | set $tmp = (struct Lisp_Hash_Table *) (Vcharset_hash_table & VALMASK) |
| 1110 | set $tmp = (struct Lisp_Vector *) (($tmp->key_and_value & VALMASK) | DATA_SEG_BITS) | 1110 | set $tmp = (struct Lisp_Vector *) ($tmp->key_and_value & VALMASK) |
| 1111 | p $tmp->contents[charset_table[$arg0].hash_index * 2] | 1111 | p $tmp->contents[charset_table[$arg0].hash_index * 2] |
| 1112 | pr | 1112 | pr |
| 1113 | end | 1113 | end |
diff --git a/src/ChangeLog b/src/ChangeLog index 30852b3ae56..118ca723a5d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2014-04-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Remove DATA_SEG_BITS. | ||
| 4 | The DATA_SEG_BITS hack was needed for older 32 bit platforms. | ||
| 5 | As a result of this change, Emacs won't work on IRIX 6.5 with IRIX | ||
| 6 | cc, but that platform is so old that SGI itself stopped supporting | ||
| 7 | it in December 2013. If you still need Emacs on IRIX, please | ||
| 8 | either compile with GCC and port the undumping code, or run | ||
| 9 | './configure --with-wide-int'. | ||
| 10 | * alloc.c (gdb_make_enums_visible): Update to match lisp.h. | ||
| 11 | * lisp.h (GCTYPEBITS): Move definition up, and switch to the | ||
| 12 | DEFINE_GDB_SYMBOL_START way to define it. | ||
| 13 | (NONPOINTER_BITS): New macro. | ||
| 14 | (EMACS_INT): Use it. | ||
| 15 | [!USE_LSB_TAG && !WIDE_EMACS_INT]: Fail, and suggest reporting | ||
| 16 | the problem and/or configuring --with-wide-int. | ||
| 17 | (USE_LSB_TAG): Simplify, based on above changes. | ||
| 18 | (gdb_DATA_SEG_BITS): Remove. All uses removed. | ||
| 19 | * vm-limit.c (exceeds_lisp_ptr): Remove. All uses removed. | ||
| 20 | |||
| 1 | 2014-04-12 Eli Zaretskii <eliz@gnu.org> | 21 | 2014-04-12 Eli Zaretskii <eliz@gnu.org> |
| 2 | 22 | ||
| 3 | * xdisp.c (move_it_by_lines): If a large portion of buffer text is | 23 | * 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 | |||
| 7130 | enum char_bits char_bits; | 7130 | enum char_bits char_bits; |
| 7131 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; | 7131 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; |
| 7132 | enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; | 7132 | enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; |
| 7133 | enum enum_USE_LSB_TAG enum_USE_LSB_TAG; | ||
| 7134 | enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE; | 7133 | enum FLOAT_TO_STRING_BUFSIZE FLOAT_TO_STRING_BUFSIZE; |
| 7135 | enum Lisp_Bits Lisp_Bits; | 7134 | enum Lisp_Bits Lisp_Bits; |
| 7136 | enum Lisp_Compiled Lisp_Compiled; | 7135 | 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 | |||
| 61 | /* Number of elements in an array. */ | 61 | /* Number of elements in an array. */ |
| 62 | #define ARRAYELTS(arr) (sizeof (arr) / sizeof (arr)[0]) | 62 | #define ARRAYELTS(arr) (sizeof (arr) / sizeof (arr)[0]) |
| 63 | 63 | ||
| 64 | /* Number of bits in a Lisp_Object tag. */ | ||
| 65 | DEFINE_GDB_SYMBOL_BEGIN (int, GCTYPEBITS) | ||
| 66 | #define GCTYPEBITS 3 | ||
| 67 | DEFINE_GDB_SYMBOL_END (GCTYPEBITS) | ||
| 68 | |||
| 69 | /* The number of bits needed in an EMACS_INT over and above the number | ||
| 70 | of bits in a pointer. This is 0 on systems where: | ||
| 71 | 1. We can specify multiple-of-8 alignment on static variables. | ||
| 72 | 2. We know malloc returns a multiple of 8. */ | ||
| 73 | #if (defined alignas \ | ||
| 74 | && (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ | ||
| 75 | || defined DARWIN_OS || defined __sun)) | ||
| 76 | # define NONPOINTER_BITS 0 | ||
| 77 | #else | ||
| 78 | # define NONPOINTER_BITS GCTYPEBITS | ||
| 79 | #endif | ||
| 80 | |||
| 64 | /* EMACS_INT - signed integer wide enough to hold an Emacs value | 81 | /* EMACS_INT - signed integer wide enough to hold an Emacs value |
| 65 | EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if | 82 | EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if |
| 66 | pI - printf length modifier for EMACS_INT | 83 | pI - printf length modifier for EMACS_INT |
| @@ -68,16 +85,18 @@ INLINE_HEADER_BEGIN | |||
| 68 | #ifndef EMACS_INT_MAX | 85 | #ifndef EMACS_INT_MAX |
| 69 | # if INTPTR_MAX <= 0 | 86 | # if INTPTR_MAX <= 0 |
| 70 | # error "INTPTR_MAX misconfigured" | 87 | # error "INTPTR_MAX misconfigured" |
| 71 | # elif INTPTR_MAX <= INT_MAX && !defined WIDE_EMACS_INT | 88 | # elif INTPTR_MAX <= INT_MAX >> NONPOINTER_BITS && !defined WIDE_EMACS_INT |
| 72 | typedef int EMACS_INT; | 89 | typedef int EMACS_INT; |
| 73 | typedef unsigned int EMACS_UINT; | 90 | typedef unsigned int EMACS_UINT; |
| 74 | # define EMACS_INT_MAX INT_MAX | 91 | # define EMACS_INT_MAX INT_MAX |
| 75 | # define pI "" | 92 | # define pI "" |
| 76 | # elif INTPTR_MAX <= LONG_MAX && !defined WIDE_EMACS_INT | 93 | # elif INTPTR_MAX <= LONG_MAX >> NONPOINTER_BITS && !defined WIDE_EMACS_INT |
| 77 | typedef long int EMACS_INT; | 94 | typedef long int EMACS_INT; |
| 78 | typedef unsigned long EMACS_UINT; | 95 | typedef unsigned long EMACS_UINT; |
| 79 | # define EMACS_INT_MAX LONG_MAX | 96 | # define EMACS_INT_MAX LONG_MAX |
| 80 | # define pI "l" | 97 | # define pI "l" |
| 98 | /* Check versus LLONG_MAX, not LLONG_MAX >> NONPOINTER_BITS. | ||
| 99 | In theory this is not safe, but in practice it seems to be OK. */ | ||
| 81 | # elif INTPTR_MAX <= LLONG_MAX | 100 | # elif INTPTR_MAX <= LLONG_MAX |
| 82 | typedef long long int EMACS_INT; | 101 | typedef long long int EMACS_INT; |
| 83 | typedef unsigned long long int EMACS_UINT; | 102 | typedef unsigned long long int EMACS_UINT; |
| @@ -218,12 +237,6 @@ extern bool suppress_checking EXTERNALLY_VISIBLE; | |||
| 218 | 237 | ||
| 219 | enum Lisp_Bits | 238 | enum Lisp_Bits |
| 220 | { | 239 | { |
| 221 | /* Number of bits in a Lisp_Object tag. This can be used in #if, | ||
| 222 | and for GDB's sake also as a regular symbol. */ | ||
| 223 | GCTYPEBITS = | ||
| 224 | #define GCTYPEBITS 3 | ||
| 225 | GCTYPEBITS, | ||
| 226 | |||
| 227 | /* 2**GCTYPEBITS. This must be a macro that expands to a literal | 240 | /* 2**GCTYPEBITS. This must be a macro that expands to a literal |
| 228 | integer constant, for MSVC. */ | 241 | integer constant, for MSVC. */ |
| 229 | #define GCALIGNMENT 8 | 242 | #define GCALIGNMENT 8 |
| @@ -247,31 +260,19 @@ enum Lisp_Bits | |||
| 247 | This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ | 260 | This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ |
| 248 | #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) | 261 | #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) |
| 249 | 262 | ||
| 250 | /* Unless otherwise specified, use USE_LSB_TAG on systems where: */ | 263 | /* Whether the least-significant bits of an EMACS_INT contain the tag. |
| 251 | #ifndef USE_LSB_TAG | ||
| 252 | /* 1. We know malloc returns a multiple of 8. */ | ||
| 253 | # if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ | ||
| 254 | || defined DARWIN_OS || defined __sun) | ||
| 255 | /* 2. We can specify multiple-of-8 alignment on static variables. */ | ||
| 256 | # ifdef alignas | ||
| 257 | /* 3. Pointers-as-ints exceed VAL_MAX. | ||
| 258 | On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: | 264 | On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: |
| 259 | a. unnecessary, because the top bits of an EMACS_INT are unused, and | 265 | a. unnecessary, because the top bits of an EMACS_INT are unused, and |
| 260 | b. slower, because it typically requires extra masking. | 266 | b. slower, because it typically requires extra masking. |
| 261 | So, default USE_LSB_TAG to true only on hosts where it might be useful. */ | 267 | So, USE_LSB_TAG is true only on hosts where it might be useful. */ |
| 262 | # if VAL_MAX < UINTPTR_MAX | 268 | DEFINE_GDB_SYMBOL_BEGIN (bool, USE_LSB_TAG) |
| 263 | # define USE_LSB_TAG true | 269 | #define USE_LSB_TAG (EMACS_INT_MAX >> GCTYPEBITS < INTPTR_MAX) |
| 264 | # endif | 270 | DEFINE_GDB_SYMBOL_END (USE_LSB_TAG) |
| 265 | # endif | 271 | |
| 266 | # endif | 272 | #if !USE_LSB_TAG && !defined WIDE_EMACS_INT |
| 267 | #endif | 273 | # error "USE_LSB_TAG not supported on this platform; please report this." \ |
| 268 | #ifdef USE_LSB_TAG | 274 | "Try 'configure --with-wide-int' to work around the problem." |
| 269 | # undef USE_LSB_TAG | 275 | error !; |
| 270 | enum enum_USE_LSB_TAG { USE_LSB_TAG = true }; | ||
| 271 | # define USE_LSB_TAG true | ||
| 272 | #else | ||
| 273 | enum enum_USE_LSB_TAG { USE_LSB_TAG = false }; | ||
| 274 | # define USE_LSB_TAG false | ||
| 275 | #endif | 276 | #endif |
| 276 | 277 | ||
| 277 | #ifndef alignas | 278 | #ifndef alignas |
| @@ -346,8 +347,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = false }; | |||
| 346 | #define lisp_h_XCONS(a) \ | 347 | #define lisp_h_XCONS(a) \ |
| 347 | (eassert (CONSP (a)), (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons)) | 348 | (eassert (CONSP (a)), (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons)) |
| 348 | #define lisp_h_XHASH(a) XUINT (a) | 349 | #define lisp_h_XHASH(a) XUINT (a) |
| 349 | #define lisp_h_XPNTR(a) \ | 350 | #define lisp_h_XPNTR(a) ((void *) (intptr_t) (XLI (a) & VALMASK)) |
| 350 | ((void *) (intptr_t) ((XLI (a) & VALMASK) | DATA_SEG_BITS)) | ||
| 351 | #define lisp_h_XSYMBOL(a) \ | 351 | #define lisp_h_XSYMBOL(a) \ |
| 352 | (eassert (SYMBOLP (a)), (struct Lisp_Symbol *) XUNTAG (a, Lisp_Symbol)) | 352 | (eassert (SYMBOLP (a)), (struct Lisp_Symbol *) XUNTAG (a, Lisp_Symbol)) |
| 353 | #ifndef GC_CHECK_CONS_LIST | 353 | #ifndef GC_CHECK_CONS_LIST |
| @@ -608,18 +608,8 @@ enum pvec_type | |||
| 608 | PVEC_FONT /* Should be last because it's used for range checking. */ | 608 | PVEC_FONT /* Should be last because it's used for range checking. */ |
| 609 | }; | 609 | }; |
| 610 | 610 | ||
| 611 | /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers | ||
| 612 | which were stored in a Lisp_Object. */ | ||
| 613 | #ifndef DATA_SEG_BITS | ||
| 614 | # define DATA_SEG_BITS 0 | ||
| 615 | #endif | ||
| 616 | enum { gdb_DATA_SEG_BITS = DATA_SEG_BITS }; | ||
| 617 | #undef DATA_SEG_BITS | ||
| 618 | |||
| 619 | enum More_Lisp_Bits | 611 | enum More_Lisp_Bits |
| 620 | { | 612 | { |
| 621 | DATA_SEG_BITS = gdb_DATA_SEG_BITS, | ||
| 622 | |||
| 623 | /* For convenience, we also store the number of elements in these bits. | 613 | /* For convenience, we also store the number of elements in these bits. |
| 624 | Note that this size is not necessarily the memory-footprint size, but | 614 | Note that this size is not necessarily the memory-footprint size, but |
| 625 | only the number of Lisp_Object fields (that need to be traced by GC). | 615 | 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; | |||
| 71 | /* Number of bytes of writable memory we can expect to be able to get. */ | 71 | /* Number of bytes of writable memory we can expect to be able to get. */ |
| 72 | static size_t lim_data; | 72 | static size_t lim_data; |
| 73 | 73 | ||
| 74 | /* Return true if PTR cannot be represented as an Emacs Lisp object. */ | ||
| 75 | static bool | ||
| 76 | exceeds_lisp_ptr (void *ptr) | ||
| 77 | { | ||
| 78 | return (! USE_LSB_TAG | ||
| 79 | && VAL_MAX < UINTPTR_MAX | ||
| 80 | && ((uintptr_t) ptr & ~DATA_SEG_BITS) >> VALBITS != 0); | ||
| 81 | } | ||
| 82 | |||
| 83 | #ifdef HAVE_GETRLIMIT | 74 | #ifdef HAVE_GETRLIMIT |
| 84 | 75 | ||
| 85 | # ifndef RLIMIT_AS | 76 | # ifndef RLIMIT_AS |
| @@ -222,9 +213,6 @@ check_memory_limits (void) | |||
| 222 | else if (warnlevel > warned_85 && data_size < five_percent * 18) | 213 | else if (warnlevel > warned_85 && data_size < five_percent * 18) |
| 223 | warnlevel = warned_85; | 214 | warnlevel = warned_85; |
| 224 | } | 215 | } |
| 225 | |||
| 226 | if (exceeds_lisp_ptr (cp)) | ||
| 227 | (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); | ||
| 228 | } | 216 | } |
| 229 | 217 | ||
| 230 | /* Enable memory usage warnings. | 218 | /* Enable memory usage warnings. |