From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Conservative GC isn't safe Date: Sat, 26 Nov 2016 11:24:38 +0200 Message-ID: <831sxy386h.fsf@gnu.org> References: <66485157-00cd-4704-a421-cbfe84299cae@cs.ucla.edu> <69a1fdf3-7120-125b-8556-d74f5afc6b37@dancol.org> <8360na399k.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1480152335 19201 195.159.176.226 (26 Nov 2016 09:25:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 26 Nov 2016 09:25:35 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 26 10:25:30 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cAZEd-0002sZ-VO for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2016 10:25:28 +0100 Original-Received: from localhost ([::1]:49778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAZEc-00065P-Si for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2016 04:25:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAZE1-00064J-FX for emacs-devel@gnu.org; Sat, 26 Nov 2016 04:24:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cAZDy-0004xx-AE for emacs-devel@gnu.org; Sat, 26 Nov 2016 04:24:49 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAZDy-0004xt-6p; Sat, 26 Nov 2016 04:24:46 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3661 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1cAZDx-0003KA-FU; Sat, 26 Nov 2016 04:24:45 -0500 In-reply-to: (message from Daniel Colascione on Sat, 26 Nov 2016 01:04:18 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:209611 Archived-At: > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > From: Daniel Colascione > Date: Sat, 26 Nov 2016 01:04:18 -0800 > > On 11/26/2016 01:01 AM, Eli Zaretskii wrote: > >> From: Daniel Colascione > >> Date: Sat, 26 Nov 2016 00:33:13 -0800 > >> > >>>> 2) INTERVAL is GCed, but it's not represented in the memory tree: > >>>> struct interval isn't a real lisp object and it's allocated as > >>>> MEM_TYPE_NON_LISP. Even a direct pointer to the start of an interval > >>>> won't protect it from GC. Shouldn't we treat intervals like conses? > >>> > >>> Does the code ever create an interval that is accessible only via locals > >>> when a GC occurs? If not, Emacs should be OK. (This should also be > >>> documented better.) > >> > >> Anywhere in the code? Forever? I wouldn't be confident saying so. > > > > A simple practical solution to such assumptions is to add an assertion > > in some strategic place(s). > > > > I don't think it's TRT to sprinkle our sources with code that is there > > "just in case", i.e. it will never actually run. > > How would you assert dynamically that if an interval is reachable, its > owning string or buffer must be too? It's not enough for the variable > holding the reference to the string or buffer to be in scope: you have > to be sure that the reference isn't dead. I don't understand the use case you have in mind. Why would an interval be created that is not reachable from the interval tree of some Lisp object?