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: Sun, 27 Nov 2016 17:39:44 +0200 Message-ID: <837f7p0w5b.fsf@gnu.org> References: <66485157-00cd-4704-a421-cbfe84299cae@cs.ucla.edu> <805F5A19-BFAF-4CA4-AAD6-497C6D554830@raeburn.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1480261199 13765 195.159.176.226 (27 Nov 2016 15:39:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 Nov 2016 15:39:59 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Ken Raeburn Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 27 16:39:55 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 1cB1YY-0002jT-DN for ged-emacs-devel@m.gmane.org; Sun, 27 Nov 2016 16:39:54 +0100 Original-Received: from localhost ([::1]:54605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB1Yc-0001Ey-0j for ged-emacs-devel@m.gmane.org; Sun, 27 Nov 2016 10:39:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB1YV-0001Ef-8Z for emacs-devel@gnu.org; Sun, 27 Nov 2016 10:39:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cB1YS-0000DH-2F for emacs-devel@gnu.org; Sun, 27 Nov 2016 10:39:51 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cB1YR-0000DD-V9; Sun, 27 Nov 2016 10:39:47 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1450 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1cB1YR-0007KL-7w; Sun, 27 Nov 2016 10:39:47 -0500 In-reply-to: <805F5A19-BFAF-4CA4-AAD6-497C6D554830@raeburn.org> (message from Ken Raeburn on Sun, 27 Nov 2016 01:17:54 -0500) 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:209630 Archived-At: > From: Ken Raeburn > Date: Sun, 27 Nov 2016 01:17:54 -0500 > Cc: emacs-devel@gnu.org > > > Indeed. Hans Boehm's done a fair bit of research in this issue, > > including discussing the underlying assumptions and arguing that > > compilers should (and usually do) guarantee those assumptions. > > I’d be surprised if that held reliably when the last use of a Lisp_Object in some function extracts an object pointer and then never references the Lisp_Object as such ever again. > > Lisp_Object foo (Lisp_Object obj) > { > … > return mumble (XSYMBOL (obj)); > } > > It’s got no reason to specifically obfuscate the value, but it may also have no reason to keep a copy of the Lisp_Object value around when it’s no longer needed. It’s not so much that the compiler has decided to start using an interior pointer on its own, but instead just doing what we told it to do. If “mumble” triggers GC, stack marking may well find only the pointer and not the original “obj” value in this function, especially if the compiler optimizes away the stack frame of “foo” completely. IOW, you envision the possibility that the object identified by 'obj' is not held in any stack-based memory cell in any of the 'foo's callers, and instead all of them hold that object only in registers? Is that a reasonable assumption?