From: Stefan Monnier Date: Thu, 20 Sep 2012 03:10:52 +0000 (-0400) Subject: * src/alloc.c (mark_object) : Mark prev/next_buffers *after* X-Git-Tag: emacs-24.2.90~269^2~18 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e99f70c8cd37778d63e2497ed59d64fda720f731;p=emacs.git * src/alloc.c (mark_object) : 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7f9cac9fa21..c3ce1ee1b0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-09-20 Stefan Monnier + + * alloc.c (mark_object) : 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 Omit unused arg EXPECTED from socket hooks. diff --git a/src/alloc.c b/src/alloc.c index fb7d35b5590..02ba2f5f9e3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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; diff --git a/src/window.c b/src/window.c index fbccab8b358..a6f1104587e 100644 --- a/src/window.c +++ b/src/window.c @@ -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; diff --git a/src/window.h b/src/window.h index 62ae43a999d..115b361194c 100644 --- a/src/window.h +++ b/src/window.h @@ -220,13 +220,6 @@ struct window /* t means this window's child windows are not (re-)combined. */ Lisp_Object combination_limit; - /* Alist of 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 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;