From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: Buffer-/frame-local variables [Was: Re: Make buffer- and frame-locals a misc object] Date: Fri, 17 Aug 2012 18:29:16 +0400 Message-ID: <502E553C.6090705@yandex.ru> References: <502B7EFB.7030300@yandex.ru> <502BB333.70306@yandex.ru> <502C72CD.2050908@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345213615 1184 80.91.229.3 (17 Aug 2012 14:26:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 14:26:55 +0000 (UTC) Cc: Emacs development discussions To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 17 16:26:54 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T2NVl-0002Jq-H3 for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2012 16:26:53 +0200 Original-Received: from localhost ([::1]:43805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2NVk-00027q-BJ for ged-emacs-devel@m.gmane.org; Fri, 17 Aug 2012 10:26:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2NVh-00027a-AG for emacs-devel@gnu.org; Fri, 17 Aug 2012 10:26:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2NVf-00042u-Ux for emacs-devel@gnu.org; Fri, 17 Aug 2012 10:26:49 -0400 Original-Received: from forward1h.mail.yandex.net ([84.201.187.146]:49901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2NVf-00042n-It for emacs-devel@gnu.org; Fri, 17 Aug 2012 10:26:47 -0400 Original-Received: from smtp4h.mail.yandex.net (smtp4h.mail.yandex.net [84.201.186.21]) by forward1h.mail.yandex.net (Yandex) with ESMTP id 086949E4296; Fri, 17 Aug 2012 18:26:45 +0400 (MSK) Original-Received: from smtp4h.mail.yandex.net (localhost [127.0.0.1]) by smtp4h.mail.yandex.net (Yandex) with ESMTP id C6B182C016F; Fri, 17 Aug 2012 18:26:45 +0400 (MSK) Original-Received: from unknown (unknown [37.139.84.55]) by smtp4h.mail.yandex.net (nwsmtp/Yandex) with ESMTP id QiX0l8I5-QjXmi7DK; Fri, 17 Aug 2012 18:26:45 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1345213605; bh=OQ6AUAhkV7MojRza1W9+r/f7myh+vxhar+RdMWW0fdg=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=FdiVffDvuujvnd29cRiC8kBPOLbN3RMzuvcgt1CpsOwf7P32kaiddTA1768PLsxKg HumY+oOo8WFAxt4d8O8u0OYgN9+py1nw06+ogVOH1PyMrxos+NSJMMv5BD2PRrNbSH XxJ1Re612kouJmzKUu4RrZThvtvTHs+ytfszyKuA= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 84.201.187.146 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152611 Archived-At: On 08/17/2012 05:20 PM, Stefan Monnier wrote: > Another reason is that until they're initialized, the fields contain > invalid values, so if the GC sees them we're in trouble, right? Not quite. In our terms, the core thing for simple generational GC is: struct Lisp_Foo { Lisp_Object bar; Lisp_Object baz; }; void foo_set_bar (Lisp_Object foo, Lisp_Object bar) { if (object_generation (foo) == OLD && object_generation (bar) == NEW) /* This function should record all pointer-type Lisp_Objects from new generation which are accessible from old generation. Such objects will be considered as a part of the root set at the next generational collection. */ record_intergenerational_object (bar); XFOO (foo)->bar = bar; } /* Likewise for foo_set_baz. */ Lisp_Object make_foo (Lisp_Object bar, Lisp_Object baz) { Lisp_Object foo = allocate_foo (); /* At this point, object_generation (foo) is always NEW. */ foo_set_bar (foo, bar); /* Since foo is NEW, barrier action isn't raised whatever bar is; don't care about old (uninitialized) XFOO (foo)->bar here. */ foo_set_baz (foo, baz); /* Likewise. */ return foo; } > > - valcontents = BLV_VALUE (blv); > + valcontents = XCDR (blv->valcell); > > Please don't: BLV_VALUE is more clear and abstract (same applies to > other places where you replace BLV_VALUE with XCDR (blv->valcell)). > > -#define BLV_FOUND(blv) \ > +get_blv_found (struct Lisp_Buffer_Local_Value *blv) > > Why add a "get_" prefix? > Elisp and Emacs generally uses "-" for accessors and > "set--" for setters. Fixed and installed as 109660. Dmitry