diff options
| author | Andreas Schwab | 2018-08-12 12:05:46 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2018-08-12 12:07:00 +0200 |
| commit | a04829d1b498fd63c534acae629580822ec66a7a (patch) | |
| tree | d29c8a023df79a4d8dd41d9dfc450f09f613648c /src | |
| parent | 3d0a0ca7ca58cdb8f07be63df28ad30e4367167d (diff) | |
| download | emacs-a04829d1b498fd63c534acae629580822ec66a7a.tar.gz emacs-a04829d1b498fd63c534acae629580822ec66a7a.zip | |
Ensure no padding after union vectorlike_header
Instead of increasing GCALIGNMENT align union vectorlike_header by
adding a Lisp_Object member.
* src/lisp.h (GCALIGNMENT): Revert last change.
(union vectorlike_header): Add align member.
(header_size): Verify the same as sizeof (union
vectorlike_header)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lisp.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lisp.h b/src/lisp.h index 96256386218..b7ef8dc63a0 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -276,17 +276,15 @@ error !; | |||
| 276 | 276 | ||
| 277 | /* Minimum alignment requirement for Lisp objects, imposed by the | 277 | /* Minimum alignment requirement for Lisp objects, imposed by the |
| 278 | internal representation of tagged pointers. It is 2**GCTYPEBITS if | 278 | internal representation of tagged pointers. It is 2**GCTYPEBITS if |
| 279 | USE_LSB_TAG, otherwise the alignment of Lisp_Object to avoid | 279 | USE_LSB_TAG, 1 otherwise. It must be a literal integer constant, |
| 280 | padding after union vectorlike_header. It must be a literal | 280 | for older versions of GCC (through at least 4.9). */ |
| 281 | integer constant, for older versions of GCC (through at least | ||
| 282 | 4.9). */ | ||
| 283 | #if USE_LSB_TAG | 281 | #if USE_LSB_TAG |
| 284 | # define GCALIGNMENT 8 | 282 | # define GCALIGNMENT 8 |
| 285 | # if GCALIGNMENT != 1 << GCTYPEBITS | 283 | # if GCALIGNMENT != 1 << GCTYPEBITS |
| 286 | # error "GCALIGNMENT and GCTYPEBITS are inconsistent" | 284 | # error "GCALIGNMENT and GCTYPEBITS are inconsistent" |
| 287 | # endif | 285 | # endif |
| 288 | #else | 286 | #else |
| 289 | # define GCALIGNMENT alignof (Lisp_Object) | 287 | # define GCALIGNMENT 1 |
| 290 | #endif | 288 | #endif |
| 291 | 289 | ||
| 292 | #define GCALIGNED_UNION char alignas (GCALIGNMENT) gcaligned; | 290 | #define GCALIGNED_UNION char alignas (GCALIGNMENT) gcaligned; |
| @@ -851,6 +849,8 @@ union vectorlike_header | |||
| 851 | Current layout limits the pseudovectors to 63 PVEC_xxx subtypes, | 849 | Current layout limits the pseudovectors to 63 PVEC_xxx subtypes, |
| 852 | 4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */ | 850 | 4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */ |
| 853 | ptrdiff_t size; | 851 | ptrdiff_t size; |
| 852 | /* Align the union so that there is no padding after it. */ | ||
| 853 | Lisp_Object align; | ||
| 854 | GCALIGNED_UNION | 854 | GCALIGNED_UNION |
| 855 | }; | 855 | }; |
| 856 | verify (alignof (union vectorlike_header) % GCALIGNMENT == 0); | 856 | verify (alignof (union vectorlike_header) % GCALIGNMENT == 0); |
| @@ -1577,6 +1577,7 @@ enum | |||
| 1577 | bool_header_size = offsetof (struct Lisp_Bool_Vector, data), | 1577 | bool_header_size = offsetof (struct Lisp_Bool_Vector, data), |
| 1578 | word_size = sizeof (Lisp_Object) | 1578 | word_size = sizeof (Lisp_Object) |
| 1579 | }; | 1579 | }; |
| 1580 | verify (header_size == sizeof (union vectorlike_header)); | ||
| 1580 | 1581 | ||
| 1581 | /* The number of data words and bytes in a bool vector with SIZE bits. */ | 1582 | /* The number of data words and bytes in a bool vector with SIZE bits. */ |
| 1582 | 1583 | ||