Commit 3d3923b7 authored by Paul Eggert's avatar Paul Eggert

Tweak mark_object to avoid a conditional branch

* src/alloc.c (LAST_MARKED_SIZE): Now an enum.  Make it a power of 2.
(mark_object): Take advantage of the power of 2.
parent 53c29c4d
......@@ -814,7 +814,7 @@ the machine where you started GDB and use the debugger from there.
** Debugging problems which happen in GC
The array 'last_marked' (defined on alloc.c) can be used to display up
to 500 last objects marked by the garbage collection process.
to the 512 most-recent objects marked by the garbage collection process.
Whenever the garbage collector marks a Lisp object, it records the
pointer to that object in the 'last_marked' array, which is maintained
as a circular buffer. The variable 'last_marked_index' holds the
......
......@@ -6188,11 +6188,7 @@ mark_glyph_matrix (struct glyph_matrix *matrix)
}
}
/* Mark reference to a Lisp_Object.
If the object referred to has not been seen yet, recursively mark
all the references contained in it. */
#define LAST_MARKED_SIZE 500
enum { LAST_MARKED_SIZE = 1 << 9 }; /* Must be a power of 2. */
Lisp_Object last_marked[LAST_MARKED_SIZE] EXTERNALLY_VISIBLE;
static int last_marked_index;
......@@ -6418,8 +6414,7 @@ mark_object (Lisp_Object arg)
return;
last_marked[last_marked_index++] = obj;
if (last_marked_index == LAST_MARKED_SIZE)
last_marked_index = 0;
last_marked_index &= LAST_MARKED_SIZE - 1;
/* Perform some sanity checks on the objects marked here. Abort if
we encounter an object we know is bogus. This increases GC time
......
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