[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3d3923b: Tweak mark_object to avoid a conditional b
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 3d3923b: Tweak mark_object to avoid a conditional branch |
Date: |
Wed, 18 Apr 2018 16:15:47 -0400 (EDT) |
branch: master
commit 3d3923b79fe103ba66838db04aa9460cf990e565
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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.
---
etc/DEBUG | 2 +-
src/alloc.c | 9 ++-------
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/etc/DEBUG b/etc/DEBUG
index c4774b0..a779295 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -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
diff --git a/src/alloc.c b/src/alloc.c
index 9fdcc73..8264e06 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 3d3923b: Tweak mark_object to avoid a conditional branch,
Paul Eggert <=