diff options
| author | Eli Zaretskii | 2017-05-06 11:22:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-05-06 11:22:44 +0300 |
| commit | 3472666f82472bc0de8dcfefed0ec442ea715a76 (patch) | |
| tree | fbc25d6e300190a6d194fdbddb05a92331b622ac /src/alloc.c | |
| parent | ff315081a1dd8aa3efc30d65f32f8af503059f86 (diff) | |
| download | emacs-3472666f82472bc0de8dcfefed0ec442ea715a76.tar.gz emacs-3472666f82472bc0de8dcfefed0ec442ea715a76.zip | |
Turn on GC_CHECK_MARKED_OBJECTS by default under ENABLE_CHECKING
* src/alloc.c (GC_CHECK_MARKED_OBJECTS): Define to 1 by default of
ENABLE_CHECKING is defined.
(mark_object): Test for GC_CHECK_MARKED_OBJECTS being non-zero,
instead of being defined.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/alloc.c b/src/alloc.c index 88a1a1ed660..ab6b2960af0 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -75,14 +75,20 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 75 | static bool valgrind_p; | 75 | static bool valgrind_p; |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects. */ | 78 | /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects. |
| 79 | We turn that on by default when ENABLE_CHECKING is defined; | ||
| 80 | define GC_CHECK_MARKED_OBJECTS to zero to disable. */ | ||
| 81 | |||
| 82 | #if defined ENABLE_CHECKING && !defined GC_CHECK_MARKED_OBJECTS | ||
| 83 | # define GC_CHECK_MARKED_OBJECTS 1 | ||
| 84 | #endif | ||
| 79 | 85 | ||
| 80 | /* GC_MALLOC_CHECK defined means perform validity checks of malloc'd | 86 | /* GC_MALLOC_CHECK defined means perform validity checks of malloc'd |
| 81 | memory. Can do this only if using gmalloc.c and if not checking | 87 | memory. Can do this only if using gmalloc.c and if not checking |
| 82 | marked objects. */ | 88 | marked objects. */ |
| 83 | 89 | ||
| 84 | #if (defined SYSTEM_MALLOC || defined DOUG_LEA_MALLOC \ | 90 | #if (defined SYSTEM_MALLOC || defined DOUG_LEA_MALLOC \ |
| 85 | || defined HYBRID_MALLOC || defined GC_CHECK_MARKED_OBJECTS) | 91 | || defined HYBRID_MALLOC || GC_CHECK_MARKED_OBJECTS) |
| 86 | #undef GC_MALLOC_CHECK | 92 | #undef GC_MALLOC_CHECK |
| 87 | #endif | 93 | #endif |
| 88 | 94 | ||
| @@ -6343,7 +6349,7 @@ mark_object (Lisp_Object arg) | |||
| 6343 | { | 6349 | { |
| 6344 | register Lisp_Object obj; | 6350 | register Lisp_Object obj; |
| 6345 | void *po; | 6351 | void *po; |
| 6346 | #ifdef GC_CHECK_MARKED_OBJECTS | 6352 | #if GC_CHECK_MARKED_OBJECTS |
| 6347 | struct mem_node *m; | 6353 | struct mem_node *m; |
| 6348 | #endif | 6354 | #endif |
| 6349 | ptrdiff_t cdr_count = 0; | 6355 | ptrdiff_t cdr_count = 0; |
| @@ -6362,7 +6368,7 @@ mark_object (Lisp_Object arg) | |||
| 6362 | /* Perform some sanity checks on the objects marked here. Abort if | 6368 | /* Perform some sanity checks on the objects marked here. Abort if |
| 6363 | we encounter an object we know is bogus. This increases GC time | 6369 | we encounter an object we know is bogus. This increases GC time |
| 6364 | by ~80%. */ | 6370 | by ~80%. */ |
| 6365 | #ifdef GC_CHECK_MARKED_OBJECTS | 6371 | #if GC_CHECK_MARKED_OBJECTS |
| 6366 | 6372 | ||
| 6367 | /* Check that the object pointed to by PO is known to be a Lisp | 6373 | /* Check that the object pointed to by PO is known to be a Lisp |
| 6368 | structure allocated from the heap. */ | 6374 | structure allocated from the heap. */ |
| @@ -6431,7 +6437,7 @@ mark_object (Lisp_Object arg) | |||
| 6431 | if (VECTOR_MARKED_P (ptr)) | 6437 | if (VECTOR_MARKED_P (ptr)) |
| 6432 | break; | 6438 | break; |
| 6433 | 6439 | ||
| 6434 | #ifdef GC_CHECK_MARKED_OBJECTS | 6440 | #if GC_CHECK_MARKED_OBJECTS |
| 6435 | m = mem_find (po); | 6441 | m = mem_find (po); |
| 6436 | if (m == MEM_NIL && !SUBRP (obj) && !main_thread_p (po)) | 6442 | if (m == MEM_NIL && !SUBRP (obj) && !main_thread_p (po)) |
| 6437 | emacs_abort (); | 6443 | emacs_abort (); |
| @@ -6448,7 +6454,7 @@ mark_object (Lisp_Object arg) | |||
| 6448 | switch (pvectype) | 6454 | switch (pvectype) |
| 6449 | { | 6455 | { |
| 6450 | case PVEC_BUFFER: | 6456 | case PVEC_BUFFER: |
| 6451 | #ifdef GC_CHECK_MARKED_OBJECTS | 6457 | #if GC_CHECK_MARKED_OBJECTS |
| 6452 | { | 6458 | { |
| 6453 | struct buffer *b; | 6459 | struct buffer *b; |
| 6454 | FOR_EACH_BUFFER (b) | 6460 | FOR_EACH_BUFFER (b) |