aboutsummaryrefslogtreecommitdiffstats
path: root/src/emacs-module.c
diff options
context:
space:
mode:
authorPaul Eggert2018-06-13 13:30:29 -0700
committerPaul Eggert2018-06-13 13:31:34 -0700
commit967d2c55ef3908fd378e05b2a0070663ae45f6de (patch)
treeb49c5abdec3a63b16cf339268afdc8db729d6fe7 /src/emacs-module.c
parentb8478b2ab7ad19c629da9c6b0dfd9a6544a6acee (diff)
downloademacs-967d2c55ef3908fd378e05b2a0070663ae45f6de.tar.gz
emacs-967d2c55ef3908fd378e05b2a0070663ae45f6de.zip
Remove some wrong 8-byte alignment assumptions
Do not assume that 8-byte alignment suffices for all C objects, as some platforms require 16-byte alignment for some objects, and this will start to bite us as time goes on (e.g., if an Emacs module ever uses an object containing a long double, which requires 16-byte alignment on x86-64). Conversely, on !USE_LSB_TAG platforms, do not insist on aligning Lisp objects to a multiple of 8, as this is not needed for high-order tag bits. * src/alloc.c (LISP_ALIGNMENT, MALLOC_IS_LISP_ALIGNED): New constants. (XMALLOC_BASE_ALIGNMENT, XMALLOC_HEADER_ALIGNMENT): Removed. All uses replaced by LISP_ALIGNMENT. (aligned_alloc, laligned, lmalloc, lrealloc, union aligned_Lisp_Misc) (maybe_lisp_pointer, pure_alloc): Use LISP_ALIGNMENT rather than GCALIGNMENT. (aligned_alloc): Do not worry about an alignment of LISP_ALIGNMENT when MALLOC_IS_LISP_ALIGNED, as the code never uses aligned_alloc with alignment == LISP_ALIGNMENT in that case. (__alignof__): Remove. All uses removed. (MALLOC_IS_GC_ALIGNED): Remove. All uses replaced with MALLOC_IS_LISP_ALIGNED. (vector_alignment): Remove. All uses replaced with LISP_ALIGNMENT. * src/alloc.c (mark_maybe_pointer): * src/emacs-module.c (value_to_lisp_bits): Do not assume GCALIGNMENT == 1 << GCTYPEBITS, as GCALIGNMENT is 1 on !USE_LSB_TAG platforms now. * src/lisp.h (GCALIGNMENT) [!USE_LSB_TAG]: Now 1. (struct Lisp_Symbol, union vectorlike_header, struct Lisp_Cons) (struct Lisp_String): Simplify test for verifying alignment.
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 956706cf9f5..c18c7ab308b 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -924,7 +924,7 @@ value_to_lisp_bits (emacs_value v)
924 makes TAG_PTR faster. */ 924 makes TAG_PTR faster. */
925 925
926 intptr_t i = (intptr_t) v; 926 intptr_t i = (intptr_t) v;
927 EMACS_UINT tag = i & (GCALIGNMENT - 1); 927 EMACS_UINT tag = i & ((1 << GCTYPEBITS) - 1);
928 EMACS_UINT untagged = i - tag; 928 EMACS_UINT untagged = i - tag;
929 switch (tag) 929 switch (tag)
930 { 930 {