aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-06 20:55:46 +0400
committerDmitry Antipov2012-08-06 20:55:46 +0400
commit2b90362b19f920bb7a64f7cf3039457a9b750d63 (patch)
treeb9746d231835073eb58427c1bef96f1603e830f8 /src/alloc.c
parent5f50daf249281ef6ffbd11b5e89c36c4b8235851 (diff)
downloademacs-2b90362b19f920bb7a64f7cf3039457a9b750d63.tar.gz
emacs-2b90362b19f920bb7a64f7cf3039457a9b750d63.zip
Use GCALIGNMENT where appropriate.
* alloc.c (XMALLOC_HEADER_ALIGNMENT, roundup_size): (union aligned_Lisp_Symbol, union aligned_Lisp_Misc): (mark_maybe_pointer, pure_alloc): Change to use GCALIGNMENT.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 0f425668a11..8d7980932cf 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -521,7 +521,7 @@ buffer_memory_full (ptrdiff_t nbytes)
521 521
522#if USE_LSB_TAG 522#if USE_LSB_TAG
523# define XMALLOC_HEADER_ALIGNMENT \ 523# define XMALLOC_HEADER_ALIGNMENT \
524 COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT) 524 COMMON_MULTIPLE (GCALIGNMENT, XMALLOC_BASE_ALIGNMENT)
525#else 525#else
526# define XMALLOC_HEADER_ALIGNMENT XMALLOC_BASE_ALIGNMENT 526# define XMALLOC_HEADER_ALIGNMENT XMALLOC_BASE_ALIGNMENT
527#endif 527#endif
@@ -2902,8 +2902,7 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
2902/* Align allocation request sizes to be a multiple of ROUNDUP_SIZE. */ 2902/* Align allocation request sizes to be a multiple of ROUNDUP_SIZE. */
2903enum 2903enum
2904 { 2904 {
2905 roundup_size = COMMON_MULTIPLE (word_size, 2905 roundup_size = COMMON_MULTIPLE (word_size, USE_LSB_TAG ? GCALIGNMENT : 1)
2906 USE_LSB_TAG ? 1 << GCTYPEBITS : 1)
2907 }; 2906 };
2908 2907
2909/* ROUNDUP_SIZE must be a power of 2. */ 2908/* ROUNDUP_SIZE must be a power of 2. */
@@ -3457,8 +3456,8 @@ union aligned_Lisp_Symbol
3457{ 3456{
3458 struct Lisp_Symbol s; 3457 struct Lisp_Symbol s;
3459#if USE_LSB_TAG 3458#if USE_LSB_TAG
3460 unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1) 3459 unsigned char c[(sizeof (struct Lisp_Symbol) + GCALIGNMENT - 1)
3461 & -(1 << GCTYPEBITS)]; 3460 & -GCALIGNMENT];
3462#endif 3461#endif
3463}; 3462};
3464 3463
@@ -3552,8 +3551,8 @@ union aligned_Lisp_Misc
3552{ 3551{
3553 union Lisp_Misc m; 3552 union Lisp_Misc m;
3554#if USE_LSB_TAG 3553#if USE_LSB_TAG
3555 unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1) 3554 unsigned char c[(sizeof (union Lisp_Misc) + GCALIGNMENT - 1)
3556 & -(1 << GCTYPEBITS)]; 3555 & -GCALIGNMENT];
3557#endif 3556#endif
3558}; 3557};
3559 3558
@@ -4563,9 +4562,9 @@ mark_maybe_pointer (void *p)
4563 struct mem_node *m; 4562 struct mem_node *m;
4564 4563
4565 /* Quickly rule out some values which can't point to Lisp data. 4564 /* Quickly rule out some values which can't point to Lisp data.
4566 USE_LSB_TAG needs Lisp data to be aligned on multiples of 1 << GCTYPEBITS. 4565 USE_LSB_TAG needs Lisp data to be aligned on multiples of GCALIGNMENT.
4567 Otherwise, assume that Lisp data is aligned on even addresses. */ 4566 Otherwise, assume that Lisp data is aligned on even addresses. */
4568 if ((intptr_t) p % (USE_LSB_TAG ? 1 << GCTYPEBITS : 2)) 4567 if ((intptr_t) p % (USE_LSB_TAG ? GCALIGNMENT : 2))
4569 return; 4568 return;
4570 4569
4571 m = mem_find (p); 4570 m = mem_find (p);
@@ -5080,7 +5079,7 @@ pure_alloc (size_t size, int type)
5080{ 5079{
5081 void *result; 5080 void *result;
5082#if USE_LSB_TAG 5081#if USE_LSB_TAG
5083 size_t alignment = (1 << GCTYPEBITS); 5082 size_t alignment = GCALIGNMENT;
5084#else 5083#else
5085 size_t alignment = alignof (EMACS_INT); 5084 size_t alignment = alignof (EMACS_INT);
5086 5085