unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Ken Raeburn <raeburn@raeburn.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Conservative GC isn't safe
Date: Mon, 28 Nov 2016 08:13:53 -0800	[thread overview]
Message-ID: <9a27456d-81a0-4692-0e0c-4a80ad9075b7@cs.ucla.edu> (raw)
In-Reply-To: <1CB11DFF-E6C2-4A1B-BE7E-8877DC38DB0A@raeburn.org>

On 11/28/2016 01:36 AM, Ken Raeburn wrote:
> here we pass Fvector a pointer to somewhere within the “contents” array of the vector passed as argument “string”

Sure, but in practice there are always other copies of 'string' floating 
around. Look at the call to Fsubstring in bytecode.c, for example:

   TOP = Fsubstring (TOP, v1, v2);

There's another copy of 'string' in the stack. Even if that code were 
changed to this:

   Lisp_Object v = POP; PUSH (Fsubstring (v, v1, v2));

Because the garbage collector doesn't know where the stack top is and so 
scans the entire stack, the GC would still mark the string.

In practice, Emacs C code doesn't create objects that no Elisp code 
cares about, and then mess with those objects in a way that can cause GC 
and that does not need the object base address. Partly this is due to 
the longstanding tradition where such objects needed to be GCPRO'd 
anyway. Partly it's because it's the Emacs C code is designed to be 
subsidiary to the Lisp code, and it's unusual to create and mess with 
objects not intended to be exported to Lisp.

If Emacs code starts doing what you're worried about, then we'll have to 
modify the GC marker to chase all pointers into objects, not merely base 
pointers. But I don't see this being a problem in the current code.




  parent reply	other threads:[~2016-11-28 16:13 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-26  8:11 Conservative GC isn't safe Daniel Colascione
2016-11-26  8:30 ` Paul Eggert
2016-11-26  8:33   ` Daniel Colascione
2016-11-26  9:01     ` Eli Zaretskii
2016-11-26  9:04       ` Daniel Colascione
2016-11-26  9:24         ` Eli Zaretskii
2016-11-26 15:05         ` Stefan Monnier
2016-11-26 15:21           ` Camm Maguire
2016-11-28 17:51           ` Daniel Colascione
2016-11-28 18:00             ` Eli Zaretskii
2016-11-28 18:03               ` Daniel Colascione
2016-11-28 18:50                 ` Eli Zaretskii
2016-11-28 18:03             ` Stefan Monnier
2016-11-28 19:18               ` Daniel Colascione
2016-11-28 19:33                 ` Stefan Monnier
2016-11-28 19:37                 ` Eli Zaretskii
2016-11-28 19:40                   ` Daniel Colascione
2016-11-28 20:03                     ` Eli Zaretskii
2016-11-28 20:09                       ` Daniel Colascione
2016-11-28 19:26               ` Andreas Schwab
2016-11-28 19:34                 ` Stefan Monnier
2016-11-26 15:03   ` Stefan Monnier
2016-11-26 15:12     ` Eli Zaretskii
2016-11-26 16:29       ` Stefan Monnier
2016-11-26 16:42         ` Eli Zaretskii
2016-11-26 18:43           ` Stefan Monnier
2016-11-27  6:17     ` Ken Raeburn
2016-11-27 15:39       ` Eli Zaretskii
2016-11-28  9:50         ` Ken Raeburn
2016-11-28 15:55           ` Eli Zaretskii
2016-11-27 16:15       ` Paul Eggert
2016-11-28  9:36         ` Ken Raeburn
2016-11-28 15:55           ` Eli Zaretskii
2016-11-28 16:15             ` Stefan Monnier
2016-11-28 17:37               ` Eli Zaretskii
2016-11-28 17:49                 ` Stefan Monnier
2016-11-28 17:57                   ` Eli Zaretskii
2016-11-28 18:05                     ` Stefan Monnier
2016-11-28 19:09                 ` Ken Raeburn
2016-11-28 19:33                   ` Eli Zaretskii
2016-11-29  8:49                     ` Ken Raeburn
2016-11-28 17:03             ` Björn Lindqvist
2016-11-28 16:13           ` Paul Eggert [this message]
2016-11-27 16:52       ` Stefan Monnier
2016-11-26 19:08 ` Pip Cet
2016-11-27  0:24   ` Paul Eggert

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=9a27456d-81a0-4692-0e0c-4a80ad9075b7@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=raeburn@raeburn.org \
    /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).