Commit 1342fc6f authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(mark_object): Detect long lists for debugging.

(mark_object_loop_halt): New variable.
parent 3622bdf9
...@@ -4427,6 +4427,12 @@ mark_image_cache (f) ...@@ -4427,6 +4427,12 @@ mark_image_cache (f)
Lisp_Object *last_marked[LAST_MARKED_SIZE]; Lisp_Object *last_marked[LAST_MARKED_SIZE];
int last_marked_index; int last_marked_index;
/* For debugging--call abort when we cdr down this many
links of a list, in mark_object. In debugging,
the call to abort will hit a breakpoint.
Normally this is zero and the check never goes off. */
int mark_object_loop_halt;
void void
mark_object (argptr) mark_object (argptr)
Lisp_Object *argptr; Lisp_Object *argptr;
...@@ -4437,6 +4443,7 @@ mark_object (argptr) ...@@ -4437,6 +4443,7 @@ mark_object (argptr)
void *po; void *po;
struct mem_node *m; struct mem_node *m;
#endif #endif
int cdr_count = 0;
loop: loop:
obj = *objptr; obj = *objptr;
...@@ -4790,10 +4797,14 @@ mark_object (argptr) ...@@ -4790,10 +4797,14 @@ mark_object (argptr)
if (EQ (ptr->cdr, Qnil)) if (EQ (ptr->cdr, Qnil))
{ {
objptr = &ptr->car; objptr = &ptr->car;
cdr_count = 0;
goto loop; goto loop;
} }
mark_object (&ptr->car); mark_object (&ptr->car);
objptr = &ptr->cdr; objptr = &ptr->cdr;
cdr_count++;
if (cdr_count == mark_object_loop_halt)
abort ();
goto loop; goto loop;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment