aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2018-09-06 19:17:14 -0700
committerPaul Eggert2018-09-06 23:56:13 -0700
commit2c8520e19c0fe72d046033e39953b7a0a87be24e (patch)
tree2ea12495ed8184e87108e17632ecd8c2ab02c8cf /src/alloc.c
parentbca35315e16cb53415649e5c0ac2ec0cc1368679 (diff)
downloademacs-2c8520e19c0fe72d046033e39953b7a0a87be24e.tar.gz
emacs-2c8520e19c0fe72d046033e39953b7a0a87be24e.zip
Shrink pseudovectors a bit
sizeof (struct Lisp_Marker) was 32 on x86, where 24 would do. Problem noted by Stefan Monnier in: https://lists.gnu.org/r/emacs-devel/2018-09/msg00165.html * src/bignum.h (struct Lisp_Bignum): * src/frame.h (struct frame): * src/lisp.h (struct Lisp_Vector, struct Lisp_Bool_Vector) (struct Lisp_Char_Table, struct Lisp_Hash_Table) (struct Lisp_Marker, struct Lisp_Overlay) (struct Lisp_Misc_Ptr, struct Lisp_User_Ptr) (struct Lisp_Finalizer, struct Lisp_Float) (struct Lisp_Module_Function): * src/process.h (struct Lisp_Process): * src/termhooks.h (struct terminal): * src/thread.h (struct thread_state, struct Lisp_Mutex) (struct Lisp_CondVar): * src/window.c (struct save_window_data): * src/window.h (struct window): * src/xterm.h (struct scroll_bar): * src/xwidget.h (struct xwidget, struct xwidget_view): Add GCALIGNED_STRUCT attribute. * src/lisp.h (GCALIGNED_UNION_MEMBER): Renamed from GCALIGNED_UNION. All uses changed. (GCALIGNED_STRUCT_MEMBER, GCALIGNED_STRUCT, GCALIGNED): New macros. All uses of open-coded GCALIGNED changed to use GCALIGNED. (union vectorlike_header): No longer GC-aligned. (PSEUDOVECSIZE): Yield 0 for pseudovectors without Lisp objects that place a member before where the first Lisp object member would be.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 28ca7804ee9..abb98a9eb68 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -641,9 +641,11 @@ buffer_memory_full (ptrdiff_t nbytes)
641 implement Lisp objects; since pseudovectors can contain any C type, 641 implement Lisp objects; since pseudovectors can contain any C type,
642 this is max_align_t. On recent GNU/Linux x86 and x86-64 this can 642 this is max_align_t. On recent GNU/Linux x86 and x86-64 this can
643 often waste up to 8 bytes, since alignof (max_align_t) is 16 but 643 often waste up to 8 bytes, since alignof (max_align_t) is 16 but
644 typical vectors need only an alignment of 8. However, it is not 644 typical vectors need only an alignment of 8. Although shrinking
645 worth the hassle to avoid this waste. */ 645 the alignment to 8 would save memory, it cost a 20% hit to Emacs
646enum { LISP_ALIGNMENT = alignof (union { max_align_t x; GCALIGNED_UNION }) }; 646 CPU performance on Fedora 28 x86-64 when compiled with gcc -m32. */
647enum { LISP_ALIGNMENT = alignof (union { max_align_t x;
648 GCALIGNED_UNION_MEMBER }) };
647verify (LISP_ALIGNMENT % GCALIGNMENT == 0); 649verify (LISP_ALIGNMENT % GCALIGNMENT == 0);
648 650
649/* True if malloc (N) is known to return storage suitably aligned for 651/* True if malloc (N) is known to return storage suitably aligned for