[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 09b2b8a: * src/alloc.c (mark_maybe_pointer): Also
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs-25 09b2b8a: * src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value |
Date: |
Sun, 10 Jan 2016 02:15:16 +0000 |
branch: emacs-25
commit 09b2b8a5ce5b542856f93b645db51eb11cf9855a
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* 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.
---
src/alloc.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/alloc.c b/src/alloc.c
index 9ec44b8..e1b0d2e 100644
--- a/src/alloc.c
+++ b/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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 09b2b8a: * src/alloc.c (mark_maybe_pointer): Also check wide-int's emacs_value,
Stefan Monnier <=