mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-26 07:33:47 +00:00
* src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value
(mark_memory): Simplify loop. Don't assume a pointer-sized word can be cast to Lisp_Object.
This commit is contained in:
parent
cca0f93359
commit
09b2b8a5ce
28
src/alloc.c
28
src/alloc.c
@ -4607,8 +4607,15 @@ mark_maybe_pointer (void *p)
|
||||
VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p));
|
||||
#endif
|
||||
|
||||
if (!maybe_lisp_pointer (p))
|
||||
return;
|
||||
if (sizeof (Lisp_Object) == sizeof (void *) || !HAVE_MODULES)
|
||||
{
|
||||
if (!maybe_lisp_pointer (p))
|
||||
return;
|
||||
}
|
||||
else
|
||||
/* For the wide-int case, we also have to accept emacs_value "tagged
|
||||
pointers", which can be generated by emacs-module.c's value_to_lisp. */
|
||||
p = (void*)((uintptr_t) p & ~(GCALIGNMENT - 1));
|
||||
|
||||
m = mem_find (p);
|
||||
if (m != MEM_NIL)
|
||||
@ -4685,8 +4692,7 @@ mark_maybe_pointer (void *p)
|
||||
static void ATTRIBUTE_NO_SANITIZE_ADDRESS
|
||||
mark_memory (void *start, void *end)
|
||||
{
|
||||
void **pp;
|
||||
int i;
|
||||
char *pp;
|
||||
|
||||
/* Make START the pointer to the start of the memory region,
|
||||
if it isn't already. */
|
||||
@ -4697,6 +4703,8 @@ mark_memory (void *start, void *end)
|
||||
end = tem;
|
||||
}
|
||||
|
||||
eassert (((uintptr_t) start) % GC_POINTER_ALIGNMENT == 0);
|
||||
|
||||
/* Mark Lisp data pointed to. This is necessary because, in some
|
||||
situations, the C compiler optimizes Lisp objects away, so that
|
||||
only a pointer to them remains. Example:
|
||||
@ -4715,13 +4723,11 @@ mark_memory (void *start, void *end)
|
||||
away. The only reference to the life string is through the
|
||||
pointer `s'. */
|
||||
|
||||
for (pp = start; (void *) pp < end; pp++)
|
||||
for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT)
|
||||
{
|
||||
void *p = *(void **) ((char *) pp + i);
|
||||
mark_maybe_pointer (p);
|
||||
mark_maybe_object (XIL ((intptr_t) p));
|
||||
}
|
||||
for (pp = start; (void*)pp < end; pp = pp + GC_POINTER_ALIGNMENT)
|
||||
{
|
||||
mark_maybe_pointer (*(void **) pp);
|
||||
mark_maybe_object (*(Lisp_Object *) pp);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
|
||||
|
Loading…
Reference in New Issue
Block a user