From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: Conservative GC isn't safe Date: Mon, 28 Nov 2016 04:50:56 -0500 Message-ID: <16D21C8B-B91E-497D-BA1A-B5A3FC9D1B13@raeburn.org> References: <66485157-00cd-4704-a421-cbfe84299cae@cs.ucla.edu> <805F5A19-BFAF-4CA4-AAD6-497C6D554830@raeburn.org> <837f7p0w5b.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1480326671 28822 195.159.176.226 (28 Nov 2016 09:51:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 Nov 2016 09:51:11 +0000 (UTC) Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 28 10:51:07 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 1cBIaY-0007Ec-Qz for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2016 10:51:06 +0100 Original-Received: from localhost ([::1]:57599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBIac-0003m2-CU for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2016 04:51:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBIaV-0003li-Ac for emacs-devel@gnu.org; Mon, 28 Nov 2016 04:51:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBIaR-0006E3-D7 for emacs-devel@gnu.org; Mon, 28 Nov 2016 04:51:03 -0500 Original-Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:36682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cBIaR-0006DY-7g for emacs-devel@gnu.org; Mon, 28 Nov 2016 04:50:59 -0500 Original-Received: by mail-qt0-x242.google.com with SMTP id n34so10854799qtb.3 for ; Mon, 28 Nov 2016 01:50:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raeburn-org.20150623.gappssmtp.com; s=20150623; h=subject:mime-version:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=454X+rrJY4iT0pkH9WthyFLawUqQHt5ZyH/K3sUs1Xo=; b=NYkQNiah2SNEfpIpk7hP7fOg01Obba+NzbrGcnr92+29IJ+K8bkCPe8/yAqJ+brMyn 3oG0EEiu2zqhpn8zD9J9Si5PoFrJ247tUW/pVU3HZQkvycO3DgDVv3261Z5RpFNCZ8iO vnCk2Vl/BIrrmb/zjzUvzvmGsiTwv40cXphUXA4BbOq6LsP+vKcm3HqIzMw57/ZybD0c IzLs2iRw3lIToKWS8ysBIcxMuWT6SgDp1aG3zK5le/4PMaECmaXE4rlQA0vX1wa/Iz59 OlpnenS9tpA23hk2Ym/vdK/plo5m2CcWGkp09zxZs1Wm8OjI0NZxGOKLzY49G3nOxkcp YwzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=454X+rrJY4iT0pkH9WthyFLawUqQHt5ZyH/K3sUs1Xo=; b=VT27rzc/XbIcCylUmPS4gspERdowJsbOiSjVk7Xz1cUEkdkyeRBdqBeK/Gj8gf8+ZP zCElXZm3rZ7Y8J4vzw5W+QDG85APjDy3kXXMSjK5+Fqs86vBjLu7M8kWIEyQhbB6jV3H nm8TKv+oUZKk9tSj53QWPl8TRnPIl1sgdoSJY4cuuutjBBD5Ww3jJ9MFJtrqJHeRtYjX ol7ZwDoCEN0RM5KOILFKfc2mJqr0wSQLhTdVV+YauIRG5q4cM5abSr1vsS0iKrZC8HpW F1HmrOmRRuZpsILxM6mcRpdI68UywsXXM8+EoxQaj462UmmnNiamnXHZsqTgdZWK1N9X Vipw== X-Gm-Message-State: AKaTC02XHJMYyFkBzz+3U+aOspPqWm/YlmFfW1KZBl3Og9T0Y6I7JXmoHxr8Sseu+aBfug== X-Received: by 10.237.45.38 with SMTP id h35mr20283526qtd.9.1480326658577; Mon, 28 Nov 2016 01:50:58 -0800 (PST) Original-Received: from [192.168.23.52] (c-50-138-183-136.hsd1.ma.comcast.net. [50.138.183.136]) by smtp.gmail.com with ESMTPSA id w8sm28044017qtc.3.2016.11.28.01.50.57 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Nov 2016 01:50:57 -0800 (PST) In-Reply-To: <837f7p0w5b.fsf@gnu.org> X-Mailer: Apple Mail (2.3124) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::242 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:209645 Archived-At: On Nov 27, 2016, at 10:39, Eli Zaretskii wrote: >=20 >> From: Ken Raeburn >> Date: Sun, 27 Nov 2016 01:17:54 -0500 >> Cc: emacs-devel@gnu.org >>=20 >>> 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. >>=20 >> I=E2=80=99d 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. >>=20 >> Lisp_Object foo (Lisp_Object obj) >> { >> =E2=80=A6 >> return mumble (XSYMBOL (obj)); >> } >>=20 >> It=E2=80=99s 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=E2=80=99s no longer needed. It=E2=80=99s 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 =E2=80=9Cmumble=E2=80= =9D triggers GC, stack marking may well find only the pointer and not = the original =E2=80=9Cobj=E2=80=9D value in this function, especially if = the compiler optimizes away the stack frame of =E2=80=9Cfoo=E2=80=9D = completely. >=20 > 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? Anything held in registers should get scanned by GC as well, once setjmp = forces them into memory. But if the caller never refers to the object again, it=E2=80=99s = certainly possible that it wouldn=E2=80=99t keep around any copies of = the Lisp_Object value, even in other registers, once it=E2=80=99s set up = the arguments for the one function call that uses the object. If the = caller also created the object, there may not be any other references = left. Ken=