From c9af454e51a926245a3ee19c04ae5ed058fcd215 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 6 Oct 2011 01:06:24 -0700 Subject: [PATCH] [ChangeLog] * configure.in (GC_LISP_OBJECT_ALIGNMENT): Remove. This is now done by src/alloc.c. [src/ChangeLog] * alloc.c: (GC_LISP_OBJECT_ARGUMENT): Use offsetof, not __alignof__ or sizeof. __alignof__ gives the wrong answer on the x86 with GCC. --- ChangeLog | 5 +++++ configure.in | 3 --- src/ChangeLog | 3 +++ src/alloc.c | 12 +++--------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e76c91b196..3d0286e6faf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-10-06 Paul Eggert + + * configure.in (GC_LISP_OBJECT_ALIGNMENT): Remove. + This is now done by src/alloc.c. + 2011-09-29 Eli Zaretskii * .bzrignore: Add ./GNUmakefile.unix, lib/SYS, lib/alloca.in-h, diff --git a/configure.in b/configure.in index d2ffdd5a19e..d5d34d5ce5b 100644 --- a/configure.in +++ b/configure.in @@ -3663,9 +3663,6 @@ AH_BOTTOM([ /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */ # define GC_SETJMP_WORKS 1 # endif -# ifndef GC_LISP_OBJECT_ALIGNMENT -# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object)) -# endif #endif #endif /* EMACS_CONFIG_H */ diff --git a/src/ChangeLog b/src/ChangeLog index 3432652dbe5..c3e03c211f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -14,6 +14,9 @@ Use int, not EMACS_INT, where int is wide enough. (inhibit_garbage_collection, Fgarbage_collect): Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. + (GC_LISP_OBJECT_ARGUMENT): + Use offsetof, not __alignof__ or sizeof. __alignof__ gives + the wrong answer on the x86 with GCC. * bidi.c (bidi_mirror_char): Use EMACS_INT, not int, where int might not be wide enough. (bidi_cache_search, bidi_cache_find, bidi_init_it) diff --git a/src/alloc.c b/src/alloc.c index bfb40e6c09a..100a5e593fa 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4455,10 +4455,7 @@ dump_zombies (void) pass starting at the start of the stack + 2. Likewise, if the minimal alignment of Lisp_Objects on the stack is 1, four passes would be necessary, each one starting with one byte more offset - from the stack start. - - The current code assumes by default that Lisp_Objects are aligned - equally on the stack. */ + from the stack start. */ static void mark_stack (void) @@ -4522,11 +4519,8 @@ mark_stack (void) that's not the case, something has to be done here to iterate over the stack segments. */ #ifndef GC_LISP_OBJECT_ALIGNMENT -#ifdef __GNUC__ -#define GC_LISP_OBJECT_ALIGNMENT __alignof__ (Lisp_Object) -#else -#define GC_LISP_OBJECT_ALIGNMENT sizeof (Lisp_Object) -#endif +# define GC_LISP_OBJECT_ALIGNMENT \ + offsetof (struct {char a; Lisp_Object b;}, b) #endif for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT) mark_memory (stack_base, end, i); -- 2.39.2