diff options
| author | Paul Eggert | 2018-06-07 18:53:26 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-06-07 19:11:49 -0700 |
| commit | b76389f22070bb61811eeea41635640d31115fd9 (patch) | |
| tree | acb09efacd52a53d598430aaf65d176c4c0a69b5 /src | |
| parent | 7c16392ccae50fe09ca3cbb11cc2cd59e5c376cc (diff) | |
| download | emacs-b76389f22070bb61811eeea41635640d31115fd9.tar.gz emacs-b76389f22070bb61811eeea41635640d31115fd9.zip | |
Don’t over-align if WIDE_EMACS_INT
* src/lisp.h (GCALIGNED_UNION): New macro.
(struct Lisp_Symbol, union vectorlike_header)
(struct Lisp_Cons, struct Lisp_String):
Use it to avoid possible over-alignment if !USE_LSB_TAG.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lisp.h b/src/lisp.h index c5af4fa6c75..5b296cd04cd 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -229,7 +229,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE; | |||
| 229 | USE_LSB_TAG not only requires the least 3 bits of pointers returned by | 229 | USE_LSB_TAG not only requires the least 3 bits of pointers returned by |
| 230 | malloc to be 0 but also needs to be able to impose a mult-of-8 alignment | 230 | malloc to be 0 but also needs to be able to impose a mult-of-8 alignment |
| 231 | on some non-GC Lisp_Objects, all of which are aligned via | 231 | on some non-GC Lisp_Objects, all of which are aligned via |
| 232 | 'char alignas (GCALIGNMENT) gcaligned;' inside a union. */ | 232 | GCALIGNED_UNION at the end of a union. */ |
| 233 | 233 | ||
| 234 | enum Lisp_Bits | 234 | enum Lisp_Bits |
| 235 | { | 235 | { |
| @@ -277,6 +277,12 @@ DEFINE_GDB_SYMBOL_END (VALMASK) | |||
| 277 | error !; | 277 | error !; |
| 278 | #endif | 278 | #endif |
| 279 | 279 | ||
| 280 | #if USE_LSB_TAG | ||
| 281 | # define GCALIGNED_UNION char alignas (GCALIGNMENT) gcaligned; | ||
| 282 | #else | ||
| 283 | # define GCALIGNED_UNION | ||
| 284 | #endif | ||
| 285 | |||
| 280 | /* Lisp_Word is a scalar word suitable for holding a tagged pointer or | 286 | /* Lisp_Word is a scalar word suitable for holding a tagged pointer or |
| 281 | integer. Usually it is a pointer to a deliberately-incomplete type | 287 | integer. Usually it is a pointer to a deliberately-incomplete type |
| 282 | 'union Lisp_X'. However, it is EMACS_INT when Lisp_Objects and | 288 | 'union Lisp_X'. However, it is EMACS_INT when Lisp_Objects and |
| @@ -776,7 +782,7 @@ struct Lisp_Symbol | |||
| 776 | /* Next symbol in obarray bucket, if the symbol is interned. */ | 782 | /* Next symbol in obarray bucket, if the symbol is interned. */ |
| 777 | struct Lisp_Symbol *next; | 783 | struct Lisp_Symbol *next; |
| 778 | } s; | 784 | } s; |
| 779 | char alignas (GCALIGNMENT) gcaligned; | 785 | GCALIGNED_UNION |
| 780 | } u; | 786 | } u; |
| 781 | }; | 787 | }; |
| 782 | verify (alignof (struct Lisp_Symbol) % GCALIGNMENT == 0); | 788 | verify (alignof (struct Lisp_Symbol) % GCALIGNMENT == 0); |
| @@ -890,7 +896,7 @@ union vectorlike_header | |||
| 890 | Current layout limits the pseudovectors to 63 PVEC_xxx subtypes, | 896 | Current layout limits the pseudovectors to 63 PVEC_xxx subtypes, |
| 891 | 4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */ | 897 | 4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */ |
| 892 | ptrdiff_t size; | 898 | ptrdiff_t size; |
| 893 | char alignas (GCALIGNMENT) gcaligned; | 899 | GCALIGNED_UNION |
| 894 | }; | 900 | }; |
| 895 | verify (alignof (union vectorlike_header) % GCALIGNMENT == 0); | 901 | verify (alignof (union vectorlike_header) % GCALIGNMENT == 0); |
| 896 | 902 | ||
| @@ -1250,7 +1256,7 @@ struct Lisp_Cons | |||
| 1250 | struct Lisp_Cons *chain; | 1256 | struct Lisp_Cons *chain; |
| 1251 | } u; | 1257 | } u; |
| 1252 | } s; | 1258 | } s; |
| 1253 | char alignas (GCALIGNMENT) gcaligned; | 1259 | GCALIGNED_UNION |
| 1254 | } u; | 1260 | } u; |
| 1255 | }; | 1261 | }; |
| 1256 | verify (alignof (struct Lisp_Cons) % GCALIGNMENT == 0); | 1262 | verify (alignof (struct Lisp_Cons) % GCALIGNMENT == 0); |
| @@ -1372,7 +1378,7 @@ struct Lisp_String | |||
| 1372 | unsigned char *data; | 1378 | unsigned char *data; |
| 1373 | } s; | 1379 | } s; |
| 1374 | struct Lisp_String *next; | 1380 | struct Lisp_String *next; |
| 1375 | char alignas (GCALIGNMENT) gcaligned; | 1381 | GCALIGNED_UNION |
| 1376 | } u; | 1382 | } u; |
| 1377 | }; | 1383 | }; |
| 1378 | verify (alignof (struct Lisp_String) % GCALIGNMENT == 0); | 1384 | verify (alignof (struct Lisp_String) % GCALIGNMENT == 0); |