From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: advice needed for multi-threading patch Date: Wed, 26 Aug 2009 14:50:36 -0400 Message-ID: <9DE0B828-815B-45DA-BD2B-0AB4DAD59CE2@raeburn.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1251314965 13123 80.91.229.12 (26 Aug 2009 19:29:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2009 19:29:25 +0000 (UTC) Cc: Tom Tromey , Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 26 21:29:17 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MgOBH-0003Be-Ef for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 21:29:16 +0200 Original-Received: from localhost ([127.0.0.1]:45540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgOBG-0004iO-FF for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 15:29:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgNaB-0003Nh-IE for emacs-devel@gnu.org; Wed, 26 Aug 2009 14:50:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgNa6-0003Jy-Gf for emacs-devel@gnu.org; Wed, 26 Aug 2009 14:50:55 -0400 Original-Received: from [199.232.76.173] (port=60591 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgNa6-0003Jq-DX for emacs-devel@gnu.org; Wed, 26 Aug 2009 14:50:50 -0400 Original-Received: from splat.raeburn.org ([69.25.196.39]:62015 helo=raeburn.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MgNZy-0001jY-CS for emacs-devel@gnu.org; Wed, 26 Aug 2009 14:50:50 -0400 Original-Received: from [10.0.0.172] (squish.raeburn.org [10.0.0.172]) by raeburn.org (8.14.3/8.14.1) with ESMTP id n7QIob5X014408; Wed, 26 Aug 2009 14:50:37 -0400 (EDT) In-Reply-To: X-Mailer: Apple Mail (2.936) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114625 Archived-At: On Aug 26, 2009, at 10:52, Stefan Monnier wrote: >> (One change I'm looking at in my Guile work is changing >> indirect_variable to >> accept and return Lisp_Objects instead of struct Lisp_Symbol >> pointers, for >> better GC safety. > > I've done the exact opposite change fairly recently, so it would be > going backwards. Oh, right... I meant to ask you at some point if there was a reason for that other than streamlining performance a little. In the guile-emacs code, lots of things can trigger GC that wouldn't in Emacs, and it can happen in any thread; with some changes in the works on the Guile side, it may not even require a thread to reach a special synchronization point. The Guile model for random application- defined object types involves a SCM value that points to an cell or double-cell object, holding an integer indicating the type and 1-3 additional words that can be pointers or SCM values or whatever. So if you've got a big structure like a buffer, one of those words points to it. But if the SCM value isn't seen during GC, the cell doesn't get marked and gets released, and the big structure gets freed up, and much badness ensues. Now, with the GC work in progress, it's possible that during conservative stack scanning, the pointer to the big structure might be enough to cause it to not get freed up; I'm not that familiar with the new code. But the conservative approach seems to be to keep the SCM (Lisp_Object) values live as long as the pointed-to data is needed. It may also be that all of the callers will keep references to the symbol object until the indirect_variable work is done, even with uninterned symbols. If that's the case, maybe I don't need to be concerned on this score. However, there's also the little matter that eventually I want to make Emacs use Guile symbols for its own symbols, for better interaction between the languages. That means that "struct Lisp_Symbol" would go away. If it's part of the internal function interfaces, that means the Guile work has to have greater divergence from the upstream code. Ken