From: Dmitry Antipov <dmantipov@yandex.ru>
To: martin rudalics <rudalics@gmx.at>
Cc: Paul Eggert <eggert@cs.ucla.edu>,
Stefan Monnier <monnier@IRO.UMontreal.CA>,
emacs-devel@gnu.org
Subject: Re: Reachable killed buffers
Date: Wed, 12 Sep 2012 19:59:13 +0400 [thread overview]
Message-ID: <5050B151.2020304@yandex.ru> (raw)
In-Reply-To: <505098FB.1020801@gmx.at>
[-- Attachment #1: Type: text/plain, Size: 341 bytes --]
On 09/12/2012 06:15 PM, martin rudalics wrote:
>> Perhaps there's something smarter, but I hope the dumb answer
>> is good enough....
>
> ... it is ;-)
What if we join marking and killed buffer removal? Thus we
can avoid the infinite-loop on circularity and double walking
through the list (one for removal and one for marking)...
Dmitry
[-- Attachment #2: mark_and_discard.patch --]
[-- Type: text/plain, Size: 1891 bytes --]
=== modified file 'src/alloc.c'
--- src/alloc.c 2012-09-11 20:35:23 +0000
+++ src/alloc.c 2012-09-12 15:53:01 +0000
@@ -5865,16 +5865,16 @@
mark_buffer (buffer->base_buffer);
}
-/* Remove killed buffers or items whose car is a killed buffer
- from LIST and return changed LIST. Called during GC. */
+/* Remove killed buffers or items whose car is a killed buffer from
+ LIST, and mark other items. Return changed LIST, which is marked. */
static Lisp_Object
-discard_killed_buffers (Lisp_Object list)
+mark_discard_killed_buffers (Lisp_Object list)
{
Lisp_Object *prev = &list;
- Lisp_Object tail;
+ Lisp_Object tail = list;
- for (tail = list; CONSP (tail); tail = XCDR (tail))
+ while (CONSP (tail) && !CONS_MARKED_P (XCONS (tail)))
{
Lisp_Object tem = XCAR (tail);
if (CONSP (tem))
@@ -5882,7 +5882,12 @@
if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem)))
*prev = XCDR (tail);
else
- prev = &XCDR_AS_LVALUE (tail);
+ {
+ CONS_MARK (tail);
+ mark_object (XCAR (tail));
+ prev = &XCDR_AS_LVALUE (tail);
+ }
+ tail = XCDR (tail);
}
return list;
}
@@ -6030,7 +6035,7 @@
store_frame_param. For dead frames, we do it here in
attempt to help GC to reclaim killed buffers faster. */
if (!FRAME_LIVE_P (f))
- fset_buffer_list (f, discard_killed_buffers (f->buffer_list));
+ fset_buffer_list (f, mark_discard_killed_buffers (f->buffer_list));
mark_vectorlike (ptr);
mark_face_cache (f->face_cache);
@@ -6048,9 +6053,9 @@
if (leaf && NILP (w->buffer))
{
wset_prev_buffers
- (w, discard_killed_buffers (w->prev_buffers));
+ (w, mark_discard_killed_buffers (w->prev_buffers));
wset_next_buffers
- (w, discard_killed_buffers (w->next_buffers));
+ (w, mark_discard_killed_buffers (w->next_buffers));
}
mark_vectorlike (ptr);
next prev parent reply other threads:[~2012-09-12 15:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1T9II0-0005q4-Gh@vcs.savannah.gnu.org>
2012-09-05 18:24 ` [Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from deleted buffers, windows and frames Stefan Monnier
2012-09-05 19:15 ` Stefan Monnier
2012-09-06 6:55 ` Dmitry Antipov
2012-09-06 7:00 ` Herring, Davis
2012-09-06 7:28 ` martin rudalics
2012-09-06 9:57 ` Dmitry Antipov
2012-09-06 14:42 ` martin rudalics
2012-09-06 12:53 ` Stefan Monnier
2012-09-06 14:42 ` martin rudalics
2012-09-06 12:52 ` Stefan Monnier
2012-09-06 14:42 ` martin rudalics
2012-09-06 17:33 ` Stefan Monnier
2012-09-07 9:52 ` martin rudalics
2012-09-06 17:06 ` Dmitry Antipov
2012-09-06 17:37 ` Stefan Monnier
2012-09-07 9:53 ` martin rudalics
2012-09-07 15:19 ` Stefan Monnier
2012-09-10 9:46 ` Reachable killed buffers [Was: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from deleted buffers, windows and frames] Dmitry Antipov
2012-09-10 13:25 ` Stefan Monnier
2012-09-10 15:15 ` Reachable killed buffers Dmitry Antipov
2012-09-10 20:15 ` Stefan Monnier
2012-09-10 21:10 ` Stefan Monnier
2012-09-11 5:25 ` Dmitry Antipov
2012-09-11 13:06 ` Stefan Monnier
2012-09-12 8:09 ` martin rudalics
2012-09-12 13:47 ` Paul Eggert
2012-09-12 13:59 ` Dmitry Antipov
2012-09-12 14:05 ` Paul Eggert
2012-09-12 14:15 ` martin rudalics
2012-09-12 15:59 ` Dmitry Antipov [this message]
2012-09-12 17:37 ` martin rudalics
2012-09-12 17:55 ` Paul Eggert
2012-09-13 3:29 ` Stefan Monnier
2012-09-13 4:43 ` Paul Eggert
2012-09-13 5:00 ` Dmitry Antipov
2012-09-13 5:18 ` Paul Eggert
2012-09-13 12:47 ` Stefan Monnier
2012-09-13 16:49 ` martin rudalics
2012-09-13 17:11 ` Paul Eggert
2012-09-13 17:30 ` martin rudalics
2012-09-14 12:10 ` Dmitry Antipov
2012-09-14 13:29 ` Stefan Monnier
2012-09-14 13:38 ` martin rudalics
2012-09-13 18:01 ` Dmitry Antipov
2012-09-06 7:20 ` [Emacs-diffs] /srv/bzr/emacs/trunk r109890: Do not mark objects from deleted buffers, windows and frames martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5050B151.2020304@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).