diff options
| author | Stefan Monnier | 2009-11-06 18:47:48 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-11-06 18:47:48 +0000 |
| commit | 2de9f71c22f9def6adaa6782eea25bc569cb8561 (patch) | |
| tree | 399507700b025f007803c590ef825f5eea3f989d | |
| parent | 7ac65b38938cdee2916350bc0b16f21a00dca444 (diff) | |
| download | emacs-2de9f71c22f9def6adaa6782eea25bc569cb8561.tar.gz emacs-2de9f71c22f9def6adaa6782eea25bc569cb8561.zip | |
Let integers use up 2 tags to give them one extra bit and double their range.
* lisp.h (USE_2_TAGS_FOR_INTS): New macro.
(LISP_INT_TAG, case_Lisp_Int, LISP_STRING_TAG, LISP_INT_TAG_P): New macros.
(enum Lisp_Type): Use them. Give explicit values.
(Lisp_Type_Limit): Remove.
(XINT, XUINT, make_number) [!USE_LISP_UNION_TYPE]:
(MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK):
Pay attention to USE_2_TAGS_FOR_INTS.
(INTEGERP): Use LISP_INT_TAG_P.
* fns.c (internal_equal): Simplify the default case.
(sxhash): Use case_Lisp_Int.
* data.c (wrong_type_argument): Don't check against Lisp_Type_Limit any more.
(Ftype_of): Use case_Lisp_Int.
(store_symval_forwarding): Take into account the fact that Ints can
now have more than one tag.
* buffer.c (syms_of_buffer): Use LISP_INT_TAG.
buffer_slot_type_mismatch):
* xfaces.c (face_attr_equal_p):
* print.c (print_object):
* alloc.c (mark_maybe_object, mark_object, survives_gc_p): Use case_Lisp_Int.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/alloc.c | 7 | ||||
| -rw-r--r-- | src/buffer.c | 10 | ||||
| -rw-r--r-- | src/data.c | 18 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/lisp.h | 117 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/xfaces.c | 2 |
9 files changed, 136 insertions, 57 deletions
| @@ -49,6 +49,9 @@ were loaded. | |||
| 49 | 49 | ||
| 50 | * Changes in Emacs 23.2 | 50 | * Changes in Emacs 23.2 |
| 51 | 51 | ||
| 52 | ** The maximum size of buffers (as well as the largest fixnum) is doubled. | ||
| 53 | On typical 32bit systems, buffers can now be up to 512MB. | ||
| 54 | |||
| 52 | ** Function arguments in *Help* buffers are now in uppercase by default. | 55 | ** Function arguments in *Help* buffers are now in uppercase by default. |
| 53 | You can customize the new variable `help-downcase-arguments' to change it. | 56 | You can customize the new variable `help-downcase-arguments' to change it. |
| 54 | 57 | ||
diff --git a/src/ChangeLog b/src/ChangeLog index 80e772d9424..0bd5d838c58 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,31 @@ | |||
| 1 | 2009-11-06 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Let integers use up 2 tags to give them one extra bit and thus double | ||
| 4 | their range. | ||
| 5 | * lisp.h (USE_2_TAGS_FOR_INTS): New macro. | ||
| 6 | (LISP_INT_TAG, case_Lisp_Int, LISP_STRING_TAG, LISP_INT_TAG_P): | ||
| 7 | New macros. | ||
| 8 | (enum Lisp_Type): Use them. Give explicit values. | ||
| 9 | (Lisp_Type_Limit): Remove. | ||
| 10 | (XINT, XUINT, make_number) [!USE_LISP_UNION_TYPE]: | ||
| 11 | (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK): | ||
| 12 | Pay attention to USE_2_TAGS_FOR_INTS. | ||
| 13 | (INTEGERP): Use LISP_INT_TAG_P. | ||
| 14 | * fns.c (internal_equal): Simplify the default case. | ||
| 15 | (sxhash): Use case_Lisp_Int. | ||
| 16 | * data.c (wrong_type_argument): Don't check against Lisp_Type_Limit | ||
| 17 | any more. | ||
| 18 | (Ftype_of): Use case_Lisp_Int. | ||
| 19 | (store_symval_forwarding): Take into account the fact that Ints can | ||
| 20 | now have more than one tag. | ||
| 21 | * buffer.c (syms_of_buffer): Use LISP_INT_TAG. | ||
| 22 | buffer_slot_type_mismatch): | ||
| 23 | * xfaces.c (face_attr_equal_p): | ||
| 24 | * print.c (print_object): | ||
| 25 | * alloc.c (mark_maybe_object, mark_object, survives_gc_p): | ||
| 26 | Use case_Lisp_Int. | ||
| 27 | |||
| 28 | |||
| 1 | 2009-11-06 Eli Zaretskii <eliz@gnu.org> | 29 | 2009-11-06 Eli Zaretskii <eliz@gnu.org> |
| 2 | 30 | ||
| 3 | * s/msdos.h (SYSTEM_PURESIZE_EXTRA): Reduce by further 30K. | 31 | * s/msdos.h (SYSTEM_PURESIZE_EXTRA): Reduce by further 30K. |
diff --git a/src/alloc.c b/src/alloc.c index bb148b37ba3..6241cde424b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -4149,8 +4149,7 @@ mark_maybe_object (obj) | |||
| 4149 | mark_p = (live_misc_p (m, po) && !XMISCANY (obj)->gcmarkbit); | 4149 | mark_p = (live_misc_p (m, po) && !XMISCANY (obj)->gcmarkbit); |
| 4150 | break; | 4150 | break; |
| 4151 | 4151 | ||
| 4152 | case Lisp_Int: | 4152 | default: |
| 4153 | case Lisp_Type_Limit: | ||
| 4154 | break; | 4153 | break; |
| 4155 | } | 4154 | } |
| 4156 | 4155 | ||
| @@ -5713,7 +5712,7 @@ mark_object (arg) | |||
| 5713 | FLOAT_MARK (XFLOAT (obj)); | 5712 | FLOAT_MARK (XFLOAT (obj)); |
| 5714 | break; | 5713 | break; |
| 5715 | 5714 | ||
| 5716 | case Lisp_Int: | 5715 | case_Lisp_Int: |
| 5717 | break; | 5716 | break; |
| 5718 | 5717 | ||
| 5719 | default: | 5718 | default: |
| @@ -5799,7 +5798,7 @@ survives_gc_p (obj) | |||
| 5799 | 5798 | ||
| 5800 | switch (XTYPE (obj)) | 5799 | switch (XTYPE (obj)) |
| 5801 | { | 5800 | { |
| 5802 | case Lisp_Int: | 5801 | case_Lisp_Int: |
| 5803 | survives_p = 1; | 5802 | survives_p = 1; |
| 5804 | break; | 5803 | break; |
| 5805 | 5804 | ||
diff --git a/src/buffer.c b/src/buffer.c index 5359c7cf69c..c4e90363c6a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4573,7 +4573,7 @@ buffer_slot_type_mismatch (newval, type) | |||
| 4573 | 4573 | ||
| 4574 | switch (type) | 4574 | switch (type) |
| 4575 | { | 4575 | { |
| 4576 | case Lisp_Int: predicate = Qintegerp; break; | 4576 | case_Lisp_Int: predicate = Qintegerp; break; |
| 4577 | case Lisp_String: predicate = Qstringp; break; | 4577 | case Lisp_String: predicate = Qstringp; break; |
| 4578 | case Lisp_Symbol: predicate = Qsymbolp; break; | 4578 | case Lisp_Symbol: predicate = Qsymbolp; break; |
| 4579 | default: abort (); | 4579 | default: abort (); |
| @@ -5738,17 +5738,17 @@ Format with `format-mode-line' to produce a string value. */); | |||
| 5738 | doc: /* *Non-nil if searches and matches should ignore case. */); | 5738 | doc: /* *Non-nil if searches and matches should ignore case. */); |
| 5739 | 5739 | ||
| 5740 | DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column, | 5740 | DEFVAR_PER_BUFFER ("fill-column", ¤t_buffer->fill_column, |
| 5741 | make_number (Lisp_Int), | 5741 | make_number (LISP_INT_TAG), |
| 5742 | doc: /* *Column beyond which automatic line-wrapping should happen. | 5742 | doc: /* *Column beyond which automatic line-wrapping should happen. |
| 5743 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); | 5743 | Interactively, you can set the buffer local value using \\[set-fill-column]. */); |
| 5744 | 5744 | ||
| 5745 | DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin, | 5745 | DEFVAR_PER_BUFFER ("left-margin", ¤t_buffer->left_margin, |
| 5746 | make_number (Lisp_Int), | 5746 | make_number (LISP_INT_TAG), |
| 5747 | doc: /* *Column for the default `indent-line-function' to indent to. | 5747 | doc: /* *Column for the default `indent-line-function' to indent to. |
| 5748 | Linefeed indents to this column in Fundamental mode. */); | 5748 | Linefeed indents to this column in Fundamental mode. */); |
| 5749 | 5749 | ||
| 5750 | DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, | 5750 | DEFVAR_PER_BUFFER ("tab-width", ¤t_buffer->tab_width, |
| 5751 | make_number (Lisp_Int), | 5751 | make_number (LISP_INT_TAG), |
| 5752 | doc: /* *Distance between tab stops (for display of tab characters), in columns. */); | 5752 | doc: /* *Distance between tab stops (for display of tab characters), in columns. */); |
| 5753 | 5753 | ||
| 5754 | DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, | 5754 | DEFVAR_PER_BUFFER ("ctl-arrow", ¤t_buffer->ctl_arrow, Qnil, |
| @@ -5859,7 +5859,7 @@ If it is nil, that means don't auto-save this buffer. */); | |||
| 5859 | Backing up is done before the first time the file is saved. */); | 5859 | Backing up is done before the first time the file is saved. */); |
| 5860 | 5860 | ||
| 5861 | DEFVAR_PER_BUFFER ("buffer-saved-size", ¤t_buffer->save_length, | 5861 | DEFVAR_PER_BUFFER ("buffer-saved-size", ¤t_buffer->save_length, |
| 5862 | make_number (Lisp_Int), | 5862 | make_number (LISP_INT_TAG), |
| 5863 | doc: /* Length of current buffer when last read in, saved or auto-saved. | 5863 | doc: /* Length of current buffer when last read in, saved or auto-saved. |
| 5864 | 0 initially. | 5864 | 0 initially. |
| 5865 | -1 means auto-saving turned off until next real save. | 5865 | -1 means auto-saving turned off until next real save. |
diff --git a/src/data.c b/src/data.c index fc50658dd7c..7110fb7eae7 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -108,10 +108,12 @@ Lisp_Object | |||
| 108 | wrong_type_argument (predicate, value) | 108 | wrong_type_argument (predicate, value) |
| 109 | register Lisp_Object predicate, value; | 109 | register Lisp_Object predicate, value; |
| 110 | { | 110 | { |
| 111 | /* If VALUE is not even a valid Lisp object, abort here | 111 | /* If VALUE is not even a valid Lisp object, we'd want to abort here |
| 112 | where we can get a backtrace showing where it came from. */ | 112 | where we can get a backtrace showing where it came from. We used |
| 113 | if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit) | 113 | to try and do that by checking the tagbits, but nowadays all |
| 114 | abort (); | 114 | tagbits are potentially valid. */ |
| 115 | /* if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit) | ||
| 116 | * abort (); */ | ||
| 115 | 117 | ||
| 116 | xsignal2 (Qwrong_type_argument, predicate, value); | 118 | xsignal2 (Qwrong_type_argument, predicate, value); |
| 117 | } | 119 | } |
| @@ -184,7 +186,7 @@ for example, (type-of 1) returns `integer'. */) | |||
| 184 | { | 186 | { |
| 185 | switch (XTYPE (object)) | 187 | switch (XTYPE (object)) |
| 186 | { | 188 | { |
| 187 | case Lisp_Int: | 189 | case_Lisp_Int: |
| 188 | return Qinteger; | 190 | return Qinteger; |
| 189 | 191 | ||
| 190 | case Lisp_Symbol: | 192 | case Lisp_Symbol: |
| @@ -975,8 +977,10 @@ store_symval_forwarding (symbol, valcontents, newval, buf) | |||
| 975 | int offset = XBUFFER_OBJFWD (valcontents)->offset; | 977 | int offset = XBUFFER_OBJFWD (valcontents)->offset; |
| 976 | Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; | 978 | Lisp_Object type = XBUFFER_OBJFWD (valcontents)->slottype; |
| 977 | 979 | ||
| 978 | if (! NILP (type) && ! NILP (newval) | 980 | if (!(NILP (type) || NILP (newval) |
| 979 | && XTYPE (newval) != XINT (type)) | 981 | || (XINT (type) == LISP_INT_TAG |
| 982 | ? INTEGERP (newval) | ||
| 983 | : XTYPE (newval) == XINT (type)))) | ||
| 980 | buffer_slot_type_mismatch (newval, XINT (type)); | 984 | buffer_slot_type_mismatch (newval, XINT (type)); |
| 981 | 985 | ||
| 982 | if (buf == NULL) | 986 | if (buf == NULL) |
| @@ -2267,9 +2267,7 @@ internal_equal (o1, o2, depth, props) | |||
| 2267 | return 0; | 2267 | return 0; |
| 2268 | return 1; | 2268 | return 1; |
| 2269 | 2269 | ||
| 2270 | case Lisp_Int: | 2270 | default: |
| 2271 | case Lisp_Symbol: | ||
| 2272 | case Lisp_Type_Limit: | ||
| 2273 | break; | 2271 | break; |
| 2274 | } | 2272 | } |
| 2275 | 2273 | ||
| @@ -4565,7 +4563,7 @@ sxhash (obj, depth) | |||
| 4565 | 4563 | ||
| 4566 | switch (XTYPE (obj)) | 4564 | switch (XTYPE (obj)) |
| 4567 | { | 4565 | { |
| 4568 | case Lisp_Int: | 4566 | case_Lisp_Int: |
| 4569 | hash = XUINT (obj); | 4567 | hash = XUINT (obj); |
| 4570 | break; | 4568 | break; |
| 4571 | 4569 | ||
diff --git a/src/lisp.h b/src/lisp.h index 95759c18f51..65c88dcfab7 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -150,37 +150,68 @@ extern void die P_((const char *, const char *, int)) NO_RETURN; | |||
| 150 | 150 | ||
| 151 | /* Define the fundamental Lisp data structures. */ | 151 | /* Define the fundamental Lisp data structures. */ |
| 152 | 152 | ||
| 153 | /* If USE_2_TAGBITS_FOR_INTS is defined, then Lisp integers use | ||
| 154 | 2 tags, to give them one extra bit, thus extending their range from | ||
| 155 | e.g -2^28..2^28-1 to -2^29..2^29-1. */ | ||
| 156 | #define USE_2_TAGS_FOR_INTS | ||
| 157 | |||
| 158 | /* Making it work for the union case is too much trouble. */ | ||
| 159 | #ifdef USE_LISP_UNION_TYPE | ||
| 160 | # undef USE_2_TAGS_FOR_INTS | ||
| 161 | #endif | ||
| 162 | |||
| 153 | /* This is the set of Lisp data types. */ | 163 | /* This is the set of Lisp data types. */ |
| 154 | 164 | ||
| 165 | #if !defined USE_2_TAGS_FOR_INTS | ||
| 166 | # define LISP_INT_TAG Lisp_Int | ||
| 167 | # define case_Lisp_Int case Lisp_Int | ||
| 168 | # define LISP_STRING_TAG 4 | ||
| 169 | # define LISP_INT_TAG_P(x) ((x) == Lisp_Int) | ||
| 170 | #else | ||
| 171 | # define LISP_INT_TAG Lisp_Int0 | ||
| 172 | # define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 | ||
| 173 | # ifdef USE_LSB_TAG | ||
| 174 | # define LISP_INT1_TAG 4 | ||
| 175 | # define LISP_STRING_TAG 1 | ||
| 176 | # define LISP_INT_TAG_P(x) (((x) & 3) == 0) | ||
| 177 | # else | ||
| 178 | # define LISP_INT1_TAG 1 | ||
| 179 | # define LISP_STRING_TAG 4 | ||
| 180 | # define LISP_INT_TAG_P(x) (((x) & 6) == 0) | ||
| 181 | # endif | ||
| 182 | #endif | ||
| 183 | |||
| 155 | enum Lisp_Type | 184 | enum Lisp_Type |
| 156 | { | 185 | { |
| 157 | /* Integer. XINT (obj) is the integer value. */ | 186 | /* Integer. XINT (obj) is the integer value. */ |
| 158 | Lisp_Int, | 187 | #ifdef USE_2_TAGS_FOR_INTS |
| 188 | Lisp_Int0 = 0, | ||
| 189 | Lisp_Int1 = LISP_INT1_TAG, | ||
| 190 | #else | ||
| 191 | Lisp_Int = 0, | ||
| 192 | #endif | ||
| 159 | 193 | ||
| 160 | /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */ | 194 | /* Symbol. XSYMBOL (object) points to a struct Lisp_Symbol. */ |
| 161 | Lisp_Symbol, | 195 | Lisp_Symbol = 2, |
| 162 | 196 | ||
| 163 | /* Miscellaneous. XMISC (object) points to a union Lisp_Misc, | 197 | /* Miscellaneous. XMISC (object) points to a union Lisp_Misc, |
| 164 | whose first member indicates the subtype. */ | 198 | whose first member indicates the subtype. */ |
| 165 | Lisp_Misc, | 199 | Lisp_Misc = 3, |
| 166 | 200 | ||
| 167 | /* String. XSTRING (object) points to a struct Lisp_String. | 201 | /* String. XSTRING (object) points to a struct Lisp_String. |
| 168 | The length of the string, and its contents, are stored therein. */ | 202 | The length of the string, and its contents, are stored therein. */ |
| 169 | Lisp_String, | 203 | Lisp_String = LISP_STRING_TAG, |
| 170 | 204 | ||
| 171 | /* Vector of Lisp objects, or something resembling it. | 205 | /* Vector of Lisp objects, or something resembling it. |
| 172 | XVECTOR (object) points to a struct Lisp_Vector, which contains | 206 | XVECTOR (object) points to a struct Lisp_Vector, which contains |
| 173 | the size and contents. The size field also contains the type | 207 | the size and contents. The size field also contains the type |
| 174 | information, if it's not a real vector object. */ | 208 | information, if it's not a real vector object. */ |
| 175 | Lisp_Vectorlike, | 209 | Lisp_Vectorlike = 5, |
| 176 | 210 | ||
| 177 | /* Cons. XCONS (object) points to a struct Lisp_Cons. */ | 211 | /* Cons. XCONS (object) points to a struct Lisp_Cons. */ |
| 178 | Lisp_Cons, | 212 | Lisp_Cons = 6, |
| 179 | |||
| 180 | Lisp_Float, | ||
| 181 | 213 | ||
| 182 | /* This is not a type code. It is for range checking. */ | 214 | Lisp_Float = 7, |
| 183 | Lisp_Type_Limit | ||
| 184 | }; | 215 | }; |
| 185 | 216 | ||
| 186 | /* This is the set of data types that share a common structure. | 217 | /* This is the set of data types that share a common structure. |
| @@ -353,12 +384,18 @@ enum pvec_type | |||
| 353 | 384 | ||
| 354 | #define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1) | 385 | #define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1) |
| 355 | #define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) & TYPEMASK)) | 386 | #define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) & TYPEMASK)) |
| 356 | #define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS) | 387 | #ifdef USE_2_TAGS_FOR_INTS |
| 357 | #define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS) | 388 | # define XINT(a) (((EMACS_INT) (a)) >> (GCTYPEBITS - 1)) |
| 389 | # define XUINT(a) (((EMACS_UINT) (a)) >> (GCTYPEBITS - 1)) | ||
| 390 | # define make_number(N) (((EMACS_INT) (N)) << (GCTYPEBITS - 1)) | ||
| 391 | #else | ||
| 392 | # define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS) | ||
| 393 | # define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS) | ||
| 394 | # define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS) | ||
| 395 | #endif | ||
| 358 | #define XSET(var, type, ptr) \ | 396 | #define XSET(var, type, ptr) \ |
| 359 | (eassert (XTYPE (ptr) == 0), /* Check alignment. */ \ | 397 | (eassert (XTYPE (ptr) == 0), /* Check alignment. */ \ |
| 360 | (var) = ((EMACS_INT) (type)) | ((EMACS_INT) (ptr))) | 398 | (var) = ((EMACS_INT) (type)) | ((EMACS_INT) (ptr))) |
| 361 | #define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS) | ||
| 362 | 399 | ||
| 363 | #define XPNTR(a) ((EMACS_INT) ((a) & ~TYPEMASK)) | 400 | #define XPNTR(a) ((EMACS_INT) ((a) & ~TYPEMASK)) |
| 364 | 401 | ||
| @@ -378,41 +415,43 @@ enum pvec_type | |||
| 378 | #define XFASTINT(a) ((a) + 0) | 415 | #define XFASTINT(a) ((a) + 0) |
| 379 | #define XSETFASTINT(a, b) ((a) = (b)) | 416 | #define XSETFASTINT(a, b) ((a) = (b)) |
| 380 | 417 | ||
| 381 | /* Extract the value of a Lisp_Object as a signed integer. */ | 418 | /* Extract the value of a Lisp_Object as a (un)signed integer. */ |
| 382 | 419 | ||
| 383 | #ifndef XINT /* Some machines need to do this differently. */ | 420 | #ifdef USE_2_TAGS_FOR_INTS |
| 384 | #define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS)) \ | 421 | # define XINT(a) ((((EMACS_INT) (a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 1)) |
| 422 | # define XUINT(a) ((EMACS_UINT) ((a) & (1 + (VALMASK << 1)))) | ||
| 423 | # define make_number(N) ((((EMACS_INT) (N)) & (1 + (VALMASK << 1)))) | ||
| 424 | #else | ||
| 425 | # define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS)) \ | ||
| 385 | >> (BITS_PER_EMACS_INT - VALBITS)) | 426 | >> (BITS_PER_EMACS_INT - VALBITS)) |
| 427 | # define XUINT(a) ((EMACS_UINT) ((a) & VALMASK)) | ||
| 428 | # define make_number(N) \ | ||
| 429 | ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) | ||
| 386 | #endif | 430 | #endif |
| 387 | 431 | ||
| 388 | /* Extract the value as an unsigned integer. This is a basis | ||
| 389 | for extracting it as a pointer to a structure in storage. */ | ||
| 390 | |||
| 391 | #ifndef XUINT | ||
| 392 | #define XUINT(a) ((EMACS_UINT) ((a) & VALMASK)) | ||
| 393 | #endif | ||
| 394 | |||
| 395 | #ifndef XSET | ||
| 396 | #define XSET(var, type, ptr) \ | 432 | #define XSET(var, type, ptr) \ |
| 397 | ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK)) | 433 | ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK)) |
| 398 | #endif | ||
| 399 | |||
| 400 | /* Convert a C integer into a Lisp_Object integer. */ | ||
| 401 | 434 | ||
| 402 | #define make_number(N) \ | 435 | #define XPNTR(a) ((EMACS_UINT) ((a) & VALMASK)) |
| 403 | ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) | ||
| 404 | 436 | ||
| 405 | #endif /* not USE_LSB_TAG */ | 437 | #endif /* not USE_LSB_TAG */ |
| 406 | 438 | ||
| 407 | #else /* USE_LISP_UNION_TYPE */ | 439 | #else /* USE_LISP_UNION_TYPE */ |
| 408 | 440 | ||
| 441 | #ifdef USE_2_TAGS_FOR_INTS | ||
| 442 | # error "USE_2_TAGS_FOR_INTS is not supported with USE_LISP_UNION_TYPE" | ||
| 443 | #endif | ||
| 444 | |||
| 409 | #define XHASH(a) ((a).i) | 445 | #define XHASH(a) ((a).i) |
| 410 | 446 | ||
| 411 | #define XTYPE(a) ((enum Lisp_Type) (a).u.type) | 447 | #define XTYPE(a) ((enum Lisp_Type) (a).u.type) |
| 412 | 448 | ||
| 413 | #ifdef EXPLICIT_SIGN_EXTEND | 449 | #ifdef EXPLICIT_SIGN_EXTEND |
| 414 | /* Make sure we sign-extend; compilers have been known to fail to do so. */ | 450 | /* Make sure we sign-extend; compilers have been known to fail to do so. |
| 415 | #define XINT(a) (((a).s.val << (BITS_PER_EMACS_INT - VALBITS)) \ | 451 | We additionally cast to EMACS_INT since it seems that some compilers |
| 452 | have been known to fail to do so, even though the bitfield is declared | ||
| 453 | as EMACS_INT already. */ | ||
| 454 | #define XINT(a) ((((EMACS_INT) (a).s.val) << (BITS_PER_EMACS_INT - VALBITS)) \ | ||
| 416 | >> (BITS_PER_EMACS_INT - VALBITS)) | 455 | >> (BITS_PER_EMACS_INT - VALBITS)) |
| 417 | #else | 456 | #else |
| 418 | #define XINT(a) ((a).s.val) | 457 | #define XINT(a) ((a).s.val) |
| @@ -491,11 +530,19 @@ extern size_t pure_size; | |||
| 491 | /* Largest and smallest representable fixnum values. These are the C | 530 | /* Largest and smallest representable fixnum values. These are the C |
| 492 | values. */ | 531 | values. */ |
| 493 | 532 | ||
| 494 | #define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1)) | 533 | #ifdef USE_2_TAGS_FOR_INTS |
| 495 | #define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1) | 534 | # define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << VALBITS) |
| 535 | # define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << VALBITS) - 1) | ||
| 496 | /* Mask indicating the significant bits of a Lisp_Int. | 536 | /* Mask indicating the significant bits of a Lisp_Int. |
| 497 | I.e. (x & INTMASK) == XUINT (make_number (x)). */ | 537 | I.e. (x & INTMASK) == XUINT (make_number (x)). */ |
| 498 | #define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1) | 538 | # define INTMASK ((((EMACS_INT) 1) << (VALBITS + 1)) - 1) |
| 539 | #else | ||
| 540 | # define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1)) | ||
| 541 | # define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1) | ||
| 542 | /* Mask indicating the significant bits of a Lisp_Int. | ||
| 543 | I.e. (x & INTMASK) == XUINT (make_number (x)). */ | ||
| 544 | # define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1) | ||
| 545 | #endif | ||
| 499 | 546 | ||
| 500 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is | 547 | /* Value is non-zero if I doesn't fit into a Lisp fixnum. It is |
| 501 | written this way so that it also works if I is of unsigned | 548 | written this way so that it also works if I is of unsigned |
| @@ -1506,7 +1553,7 @@ typedef struct { | |||
| 1506 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) | 1553 | #define NUMBERP(x) (INTEGERP (x) || FLOATP (x)) |
| 1507 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) | 1554 | #define NATNUMP(x) (INTEGERP (x) && XINT (x) >= 0) |
| 1508 | 1555 | ||
| 1509 | #define INTEGERP(x) (XTYPE ((x)) == Lisp_Int) | 1556 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) |
| 1510 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) | 1557 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) |
| 1511 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) | 1558 | #define MISCP(x) (XTYPE ((x)) == Lisp_Misc) |
| 1512 | #define VECTORLIKEP(x) (XTYPE ((x)) == Lisp_Vectorlike) | 1559 | #define VECTORLIKEP(x) (XTYPE ((x)) == Lisp_Vectorlike) |
diff --git a/src/print.c b/src/print.c index 14fed114325..24d497ed365 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1588,7 +1588,7 @@ print_object (obj, printcharfun, escapeflag) | |||
| 1588 | 1588 | ||
| 1589 | switch (XTYPE (obj)) | 1589 | switch (XTYPE (obj)) |
| 1590 | { | 1590 | { |
| 1591 | case Lisp_Int: | 1591 | case_Lisp_Int: |
| 1592 | if (sizeof (int) == sizeof (EMACS_INT)) | 1592 | if (sizeof (int) == sizeof (EMACS_INT)) |
| 1593 | sprintf (buf, "%d", (int) XINT (obj)); | 1593 | sprintf (buf, "%d", (int) XINT (obj)); |
| 1594 | else if (sizeof (long) == sizeof (EMACS_INT)) | 1594 | else if (sizeof (long) == sizeof (EMACS_INT)) |
diff --git a/src/xfaces.c b/src/xfaces.c index 2b6df6406f5..9da3cc7f325 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -4085,7 +4085,7 @@ face_attr_equal_p (v1, v2) | |||
| 4085 | 4085 | ||
| 4086 | return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; | 4086 | return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; |
| 4087 | 4087 | ||
| 4088 | case Lisp_Int: | 4088 | case_Lisp_Int: |
| 4089 | case Lisp_Symbol: | 4089 | case Lisp_Symbol: |
| 4090 | return 0; | 4090 | return 0; |
| 4091 | 4091 | ||