all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Emacs development discussions <emacs-devel@gnu.org>
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	[thread overview]
Message-ID: <502E553C.6090705@yandex.ru> (raw)
In-Reply-To: <jwv7gsyqjjq.fsf-monnier+emacs@gnu.org>

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 "<type>-<field>" for accessors and
> "set-<type>-<field>" for setters.

Fixed and installed as 109660.

Dmitry




  reply	other threads:[~2012-08-17 14:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 10:50 Make buffer- and frame-locals a misc object Dmitry Antipov
2012-08-15 14:20 ` Stefan Monnier
2012-08-15 14:33   ` Dmitry Antipov
2012-08-15 16:02     ` Stefan Monnier
2012-08-16  4:10       ` Buffer-/frame-local variables [Was: Re: Make buffer- and frame-locals a misc object] Dmitry Antipov
2012-08-17 13:20         ` Stefan Monnier
2012-08-17 14:29           ` Dmitry Antipov [this message]
2012-08-21 17:35             ` Stefan Monnier
2012-08-17 17:11           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=502E553C.6090705@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.