diff options
| author | Paul Eggert | 2017-10-14 00:55:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-10-14 01:01:16 -0700 |
| commit | d7038020aa0a868c74cddaed5733ad6eeb73406b (patch) | |
| tree | 31aac82bd20d4d0ceb17eba14723327facb9bccb /src | |
| parent | ff330530123a9e3f6fbb2d0fe52564e4e3d78369 (diff) | |
| download | emacs-d7038020aa0a868c74cddaed5733ad6eeb73406b.tar.gz emacs-d7038020aa0a868c74cddaed5733ad6eeb73406b.zip | |
Do not under-align pseudovectors
Problem reported by Fabrice Popineau in:
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00357.html
Also see diagnosis by Eli Zaretskii in:
https://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00476.html
* src/alloc.c (vector_alignment):
Now a multiple of alignof (max_align_t).
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c index 2e6399e7f8d..da0c3ad4b3e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2923,9 +2923,13 @@ set_next_vector (struct Lisp_Vector *v, struct Lisp_Vector *p) | |||
| 2923 | 2923 | ||
| 2924 | enum | 2924 | enum |
| 2925 | { | 2925 | { |
| 2926 | /* Alignment of struct Lisp_Vector objects. */ | 2926 | /* Alignment of struct Lisp_Vector objects. Because pseudovectors |
| 2927 | vector_alignment = COMMON_MULTIPLE (FLEXALIGNOF (struct Lisp_Vector), | 2927 | can contain any C type, align at least as strictly as |
| 2928 | GCALIGNMENT), | 2928 | max_align_t. On x86 and x86-64 this can waste up to 8 bytes |
| 2929 | for typical vectors, since alignof (max_align_t) is 16 but | ||
| 2930 | typical vectors need only an alignment of 8. However, it is | ||
| 2931 | not worth the hassle to avoid wasting those bytes. */ | ||
| 2932 | vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT), | ||
| 2929 | 2933 | ||
| 2930 | /* Vector size requests are a multiple of this. */ | 2934 | /* Vector size requests are a multiple of this. */ |
| 2931 | roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) | 2935 | roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) |