[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 d703802: Do not under-align pseudovectors
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-26 d703802: Do not under-align pseudovectors |
Date: |
Sat, 14 Oct 2017 04:01:22 -0400 (EDT) |
branch: emacs-26
commit d7038020aa0a868c74cddaed5733ad6eeb73406b
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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).
---
src/alloc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 2e6399e..da0c3ad 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2923,9 +2923,13 @@ set_next_vector (struct Lisp_Vector *v, struct
Lisp_Vector *p)
enum
{
- /* Alignment of struct Lisp_Vector objects. */
- vector_alignment = COMMON_MULTIPLE (FLEXALIGNOF (struct Lisp_Vector),
- GCALIGNMENT),
+ /* Alignment of struct Lisp_Vector objects. Because pseudovectors
+ can contain any C type, align at least as strictly as
+ max_align_t. On x86 and x86-64 this can waste up to 8 bytes
+ for typical vectors, since alignof (max_align_t) is 16 but
+ typical vectors need only an alignment of 8. However, it is
+ not worth the hassle to avoid wasting those bytes. */
+ vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT),
/* Vector size requests are a multiple of this. */
roundup_size = COMMON_MULTIPLE (vector_alignment, word_size)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 d703802: Do not under-align pseudovectors,
Paul Eggert <=