Commit 785cd37f authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(mark_object): Save last 500 values of objptr.

Check for clobberage of ptr, when marking a vector.
parent 37bef230
...@@ -1269,6 +1269,10 @@ clear_marks () ...@@ -1269,6 +1269,10 @@ clear_marks ()
lives in the last slot in the chain. We recognize the end lives in the last slot in the chain. We recognize the end
because it is < (unsigned) STRING_BLOCK_SIZE. */ because it is < (unsigned) STRING_BLOCK_SIZE. */
#define LAST_MARKED_SIZE 500
Lisp_Object *last_marked[LAST_MARKED_SIZE];
int last_marked_index;
static void static void
mark_object (objptr) mark_object (objptr)
Lisp_Object *objptr; Lisp_Object *objptr;
...@@ -1284,6 +1288,10 @@ mark_object (objptr) ...@@ -1284,6 +1288,10 @@ mark_object (objptr)
&& (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
return; return;
last_marked[last_marked_index++] = objptr;
if (last_marked_index == LAST_MARKED_SIZE)
last_marked_index = 0;
#ifdef SWITCH_ENUM_BUG #ifdef SWITCH_ENUM_BUG
switch ((int) XGCTYPE (obj)) switch ((int) XGCTYPE (obj))
#else #else
...@@ -1328,12 +1336,17 @@ mark_object (objptr) ...@@ -1328,12 +1336,17 @@ mark_object (objptr)
{ {
register struct Lisp_Vector *ptr = XVECTOR (obj); register struct Lisp_Vector *ptr = XVECTOR (obj);
register int size = ptr->size; register int size = ptr->size;
struct Lisp_Vector *volatile ptr1 = ptr;
register int i; register int i;
if (size & ARRAY_MARK_FLAG) break; /* Already marked */ if (size & ARRAY_MARK_FLAG) break; /* Already marked */
ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */ ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */
for (i = 0; i < size; i++) /* and then mark its elements */ for (i = 0; i < size; i++) /* and then mark its elements */
mark_object (&ptr->contents[i]); {
if (ptr != ptr1)
abort ();
mark_object (&ptr->contents[i]);
}
} }
break; break;
......
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