aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index f8609398a3f..e241b9933a4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4687,16 +4687,33 @@ mark_maybe_objects (Lisp_Object const *array, ptrdiff_t nelts)
4687 mark_maybe_object (*array); 4687 mark_maybe_object (*array);
4688} 4688}
4689 4689
4690/* A lower bound on the alignment of Lisp objects that need marking.
4691 Although 1 is safe, higher values speed up mark_maybe_pointer.
4692 If USE_LSB_TAG, this value is typically GCALIGNMENT; otherwise,
4693 it's determined by the natural alignment of Lisp structs.
4694 All vectorlike objects have alignment at least that of union
4695 vectorlike_header and it's unlikely they all have alignment greater,
4696 so use the union as a safe and likely-accurate standin for
4697 vectorlike objects. */
4698
4699enum { GC_OBJECT_ALIGNMENT_MINIMUM
4700 = max (GCALIGNMENT,
4701 min (alignof (union vectorlike_header),
4702 min (min (alignof (struct Lisp_Cons),
4703 alignof (struct Lisp_Float)),
4704 min (alignof (struct Lisp_String),
4705 alignof (struct Lisp_Symbol))))) };
4706
4690/* Return true if P might point to Lisp data that can be garbage 4707/* Return true if P might point to Lisp data that can be garbage
4691 collected, and false otherwise (i.e., false if it is easy to see 4708 collected, and false otherwise (i.e., false if it is easy to see
4692 that P cannot point to Lisp data that can be garbage collected). 4709 that P cannot point to Lisp data that can be garbage collected).
4693 Symbols are implemented via offsets not pointers, but the offsets 4710 Symbols are implemented via offsets not pointers, but the offsets
4694 are also multiples of GCALIGNMENT. */ 4711 are also multiples of GC_OBJECT_ALIGNMENT_MINIMUM. */
4695 4712
4696static bool 4713static bool
4697maybe_lisp_pointer (void *p) 4714maybe_lisp_pointer (void *p)
4698{ 4715{
4699 return (uintptr_t) p % GCALIGNMENT == 0; 4716 return (uintptr_t) p % GC_OBJECT_ALIGNMENT_MINIMUM == 0;
4700} 4717}
4701 4718
4702/* If P points to Lisp data, mark that as live if it isn't already 4719/* If P points to Lisp data, mark that as live if it isn't already