From: Dmitry Antipov <dmantipov@yandex.ru>
To: Sergey Mozgovoy <egnartsms@gmail.com>
Cc: Emacs-devel@gnu.org
Subject: Re: mark_stack () vs GCPROn
Date: Thu, 06 Dec 2012 14:13:47 +0400 [thread overview]
Message-ID: <50C06FDB.5020203@yandex.ru> (raw)
In-Reply-To: <1354784459583-271770.post@n5.nabble.com>
On 12/06/2012 01:00 PM, Sergey Mozgovoy wrote:
> Emacs has a `mark_stack' function in alloc.c, which looks for (potential)
> Lisp_Objects located on the current C stack. Does it mean that GCPROn
> mechanism is not necessary for local Lisp_Object variables now ?
If stack marking is supported, then yes in general; but GCPROs are also
used for debugging. This is controlled by GC_MARK_STACK in lisp.h.
> It is quite clear that gcprolist is still necessary for static Lisp_Objects.
IIUC you mix staticpro and GCPRO.
> What are the relationships between these 2 approaches for marking objects ?
In short, GCPRO is faster because you don't need to check whether the word
in memory is a Lisp_Object. But stack marking is much more useful because
you don't need to check whether C code calls Feval (and so potentially
Fgarbage_collect) and so you don't worry about protecting local Lisp_Objects.
BTW, the more important distinction is that the GCPRO-assisted collection
is exact: you always know where the Lisp_Objects are, and mark them. Stack
marking is conservative, e.g. treats everything which looks like
the valid Lisp_Object as Lisp_Object. For example, if you have Lisp_Object
at 0x12345678 and this object is not accessible from other objects, but
there is an integer value 0x12345678 somewhere on C stack, the object will
be marked. This way the collector doesn't reclaim some dead objects, which
is impossible if GCPRO is used.
Dmitry
next prev parent reply other threads:[~2012-12-06 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 9:00 mark_stack () vs GCPROn Sergey Mozgovoy
2012-12-06 10:13 ` Dmitry Antipov [this message]
2012-12-06 14:07 ` Stefan Monnier
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=50C06FDB.5020203@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=Emacs-devel@gnu.org \
--cc=egnartsms@gmail.com \
/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).