* src/alloc.c (mark_object) <PVEC_WINDOW>: Mark prev/next_buffers *after*

calling mark_vectorlike since that's the one that marks the window.
(mark_discard_killed_buffers): Mark the final cdr.
* src/window.h (struct window): Move prev/next_buffers to the
non-standard fields.
* src/window.c (make_window): Initialize prev/next_buffers manually.
This commit is contained in:
Stefan Monnier 2012-09-19 23:10:52 -04:00
parent f75beb4787
commit e99f70c8cd
4 changed files with 34 additions and 20 deletions

View file

@ -1,3 +1,12 @@
2012-09-20 Stefan Monnier <monnier@iro.umontreal.ca>
* alloc.c (mark_object) <PVEC_WINDOW>: Mark prev/next_buffers *after*
calling mark_vectorlike since that's the one that marks the window.
(mark_discard_killed_buffers): Mark the final cdr.
* window.h (struct window): Move prev/next_buffers to the
non-standard fields.
* window.c (make_window): Initialize prev/next_buffers manually.
2012-09-20 Paul Eggert <eggert@cs.ucla.edu>
Omit unused arg EXPECTED from socket hooks.

View file

@ -5521,7 +5521,7 @@ mark_buffer (struct buffer *buffer)
}
/* Remove killed buffers or items whose car is a killed buffer from
LIST, and mark other items. Return changed LIST, which is marked. */
LIST, and mark other items. Return changed LIST, which is marked. */
static Lisp_Object
mark_discard_killed_buffers (Lisp_Object list)
@ -5543,6 +5543,7 @@ mark_discard_killed_buffers (Lisp_Object list)
prev = &XCDR_AS_LVALUE (tail);
}
}
mark_object (tail);
return list;
}
@ -5691,18 +5692,8 @@ mark_object (Lisp_Object arg)
struct window *w = (struct window *) ptr;
bool leaf = NILP (w->hchild) && NILP (w->vchild);
/* For live windows, Lisp code filters out killed buffers
from both buffer lists. For dead windows, we do it here
in attempt to help GC to reclaim killed buffers faster. */
if (leaf && NILP (w->buffer))
{
wset_prev_buffers
(w, mark_discard_killed_buffers (w->prev_buffers));
wset_next_buffers
(w, mark_discard_killed_buffers (w->next_buffers));
}
mark_vectorlike (ptr);
/* Mark glyphs for leaf windows. Marking window
matrices is sufficient because frame matrices
use the same glyph memory. */
@ -5711,6 +5702,15 @@ mark_object (Lisp_Object arg)
mark_glyph_matrix (w->current_matrix);
mark_glyph_matrix (w->desired_matrix);
}
/* Filter out killed buffers from both buffer lists
in attempt to help GC to reclaim killed buffers faster.
We can do it elsewhere for live windows, but this is the
best place to do it for dead windows. */
wset_prev_buffers
(w, mark_discard_killed_buffers (w->prev_buffers));
wset_next_buffers
(w, mark_discard_killed_buffers (w->next_buffers));
}
break;

View file

@ -3462,7 +3462,11 @@ make_window (void)
wset_vertical_scroll_bar_type (w, Qt);
wset_window_end_pos (w, make_number (0));
wset_window_end_vpos (w, make_number (0));
/* These Lisp fields are marked specially so they're not set to nil by
allocate_window. */
wset_prev_buffers (w, Qnil);
wset_next_buffers (w, Qnil);
/* Initialize non-Lisp data. Note that allocate_window zeroes out all
non-Lisp data, so do it only for slots which should not be zero. */
w->nrows_scale_factor = w->ncols_scale_factor = 1;

View file

@ -220,13 +220,6 @@ struct window
/* t means this window's child windows are not (re-)combined. */
Lisp_Object combination_limit;
/* Alist of <buffer, window-start, window-point> triples listing
buffers previously shown in this window. */
Lisp_Object prev_buffers;
/* List of buffers re-shown in this window. */
Lisp_Object next_buffers;
/* An alist with parameters. */
Lisp_Object window_parameters;
@ -238,6 +231,14 @@ struct window
struct glyph_matrix *current_matrix;
struct glyph_matrix *desired_matrix;
/* The two Lisp_Object fields below are marked in a special way,
which is why they're placed after `current_matrix'. */
/* Alist of <buffer, window-start, window-point> triples listing
buffers previously shown in this window. */
Lisp_Object prev_buffers;
/* List of buffers re-shown in this window. */
Lisp_Object next_buffers;
/* Number saying how recently window was selected. */
int use_time;