aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2020-05-31 15:29:23 -0700
committerPaul Eggert2020-05-31 16:30:54 -0700
commit68b6dad1d8e22fe700871c9a5a18da3dd496cc8a (patch)
tree323955f9083678f74a4559d8a9f9c3040e41d964 /src
parent36f508f589597a399afd48550227cacc487abf30 (diff)
downloademacs-68b6dad1d8e22fe700871c9a5a18da3dd496cc8a.tar.gz
emacs-68b6dad1d8e22fe700871c9a5a18da3dd496cc8a.zip
Be more aggressive in marking objects during GC
Simplified version of a patch from Pip Cet (Bug#41321#299). * src/alloc.c (maybe_lisp_pointer): Remove. All uses removed. (mark_memory): Also look at the pointer offset by ‘lispsym’, for symbols.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 1c6b664b220..568fee666fe 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4585,18 +4585,6 @@ mark_maybe_objects (Lisp_Object const *array, ptrdiff_t nelts)
4585 mark_maybe_object (*array); 4585 mark_maybe_object (*array);
4586} 4586}
4587 4587
4588/* Return true if P might point to Lisp data that can be garbage
4589 collected, and false otherwise (i.e., false if it is easy to see
4590 that P cannot point to Lisp data that can be garbage collected).
4591 Symbols are implemented via offsets not pointers, but the offsets
4592 are also multiples of LISP_ALIGNMENT. */
4593
4594static bool
4595maybe_lisp_pointer (void *p)
4596{
4597 return (uintptr_t) p % LISP_ALIGNMENT == 0;
4598}
4599
4600/* If P points to Lisp data, mark that as live if it isn't already 4588/* If P points to Lisp data, mark that as live if it isn't already
4601 marked. */ 4589 marked. */
4602 4590
@@ -4609,9 +4597,6 @@ mark_maybe_pointer (void *p)
4609 VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p)); 4597 VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p));
4610#endif 4598#endif
4611 4599
4612 if (!maybe_lisp_pointer (p))
4613 return;
4614
4615 if (pdumper_object_p (p)) 4600 if (pdumper_object_p (p))
4616 { 4601 {
4617 int type = pdumper_find_object_type (p); 4602 int type = pdumper_find_object_type (p);
@@ -4715,7 +4700,16 @@ mark_memory (void const *start, void const *end)
4715 4700
4716 for (pp = start; (void const *) pp < end; pp += GC_POINTER_ALIGNMENT) 4701 for (pp = start; (void const *) pp < end; pp += GC_POINTER_ALIGNMENT)
4717 { 4702 {
4718 mark_maybe_pointer (*(void *const *) pp); 4703 char *p = *(char *const *) pp;
4704 mark_maybe_pointer (p);
4705
4706 /* Unmask any struct Lisp_Symbol pointer that make_lisp_symbol
4707 previously disguised by adding the address of 'lispsym'.
4708 On a host with 32-bit pointers and 64-bit Lisp_Objects,
4709 a Lisp_Object might be split into registers saved into
4710 non-adjacent words and P might be the low-order word's value. */
4711 p += (intptr_t) lispsym;
4712 mark_maybe_pointer (p);
4719 4713
4720 verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0); 4714 verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0);
4721 if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT 4715 if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT