emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master a04829d: Ensure no padding after union vectorlike_h


From: Andreas Schwab
Subject: [Emacs-diffs] master a04829d: Ensure no padding after union vectorlike_header
Date: Sun, 12 Aug 2018 06:07:31 -0400 (EDT)

branch: master
commit a04829d1b498fd63c534acae629580822ec66a7a
Author: Andreas Schwab <address@hidden>
Commit: Andreas Schwab <address@hidden>

    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)
---
 src/lisp.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/lisp.h b/src/lisp.h
index 9625638..b7ef8dc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -276,17 +276,15 @@ error !;
 
 /* Minimum alignment requirement for Lisp objects, imposed by the
    internal representation of tagged pointers.  It is 2**GCTYPEBITS if
-   USE_LSB_TAG, otherwise the alignment of Lisp_Object to avoid
-   padding after union vectorlike_header.  It must be a literal
-   integer constant, for older versions of GCC (through at least
-   4.9).  */
+   USE_LSB_TAG, 1 otherwise.  It must be a literal integer constant,
+   for older versions of GCC (through at least 4.9).  */
 #if USE_LSB_TAG
 # define GCALIGNMENT 8
 # if GCALIGNMENT != 1 << GCTYPEBITS
 #  error "GCALIGNMENT and GCTYPEBITS are inconsistent"
 # endif
 #else
-# define GCALIGNMENT alignof (Lisp_Object)
+# define GCALIGNMENT 1
 #endif
 
 #define GCALIGNED_UNION char alignas (GCALIGNMENT) gcaligned;
@@ -851,6 +849,8 @@ union vectorlike_header
         Current layout limits the pseudovectors to 63 PVEC_xxx subtypes,
         4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots.  */
     ptrdiff_t size;
+    /* Align the union so that there is no padding after it.  */
+    Lisp_Object align;
     GCALIGNED_UNION
   };
 verify (alignof (union vectorlike_header) % GCALIGNMENT == 0);
@@ -1577,6 +1577,7 @@ enum
     bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
     word_size = sizeof (Lisp_Object)
   };
+verify (header_size == sizeof (union vectorlike_header));
 
 /* The number of data words and bytes in a bool vector with SIZE bits.  */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]