diff options
| author | Paul Eggert | 2018-04-18 13:08:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-04-18 13:15:26 -0700 |
| commit | 3d3923b79fe103ba66838db04aa9460cf990e565 (patch) | |
| tree | 13066615670c76a0f9d9e0edd090dbe7d2caad83 /src | |
| parent | 53c29c4d3c636c7f02b563b3c683b13ae5863bcf (diff) | |
| download | emacs-3d3923b79fe103ba66838db04aa9460cf990e565.tar.gz emacs-3d3923b79fe103ba66838db04aa9460cf990e565.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/alloc.c b/src/alloc.c index 9fdcc7306a8..8264e0623cf 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -6188,11 +6188,7 @@ mark_glyph_matrix (struct glyph_matrix *matrix) | |||
| 6188 | } | 6188 | } |
| 6189 | } | 6189 | } |
| 6190 | 6190 | ||
| 6191 | /* Mark reference to a Lisp_Object. | 6191 | enum { LAST_MARKED_SIZE = 1 << 9 }; /* Must be a power of 2. */ |
| 6192 | If the object referred to has not been seen yet, recursively mark | ||
| 6193 | all the references contained in it. */ | ||
| 6194 | |||
| 6195 | #define LAST_MARKED_SIZE 500 | ||
| 6196 | Lisp_Object last_marked[LAST_MARKED_SIZE] EXTERNALLY_VISIBLE; | 6192 | Lisp_Object last_marked[LAST_MARKED_SIZE] EXTERNALLY_VISIBLE; |
| 6197 | static int last_marked_index; | 6193 | static int last_marked_index; |
| 6198 | 6194 | ||
| @@ -6418,8 +6414,7 @@ mark_object (Lisp_Object arg) | |||
| 6418 | return; | 6414 | return; |
| 6419 | 6415 | ||
| 6420 | last_marked[last_marked_index++] = obj; | 6416 | last_marked[last_marked_index++] = obj; |
| 6421 | if (last_marked_index == LAST_MARKED_SIZE) | 6417 | last_marked_index &= LAST_MARKED_SIZE - 1; |
| 6422 | last_marked_index = 0; | ||
| 6423 | 6418 | ||
| 6424 | /* Perform some sanity checks on the objects marked here. Abort if | 6419 | /* Perform some sanity checks on the objects marked here. Abort if |
| 6425 | we encounter an object we know is bogus. This increases GC time | 6420 | we encounter an object we know is bogus. This increases GC time |