emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_S


From: Dmitry Antipov
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Thu, 04 Sep 2014 08:59:35 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

On 09/03/2014 08:42 PM, Paul Eggert wrote:

For GCC, we can define struct Lisp_Cons via 'struct __attribute__ ((aligned 
(GCALIGNMENT))) Lisp_Cons { ... };'.
For compilers that don't support this syntax we can align the struct by hand, 
by using a character-array compound
literal that's a bit too large, aligning the resulting pointer by hand, and 
then using the aligned pointer.

Yes, that seems to work:

Lisp_Object obj;
struct Lisp_Cons *c = ((struct Lisp_Cons *)
                       (((uintptr_t) (char [2 * sizeof (struct Lisp_Cons) - 1]) 
{}
                         + (GCALIGNMENT - 1)) & ~(GCALIGNMENT - 1)));
c->car = Qnil;
c->u.cdr = Qnil;
XSETCONS (obj, c);

But I don't see how to fold this snippet into a macro which can be used as an 
rvalue, just like:

Lisp_Object obj = scoped_cons (Qnil, Qnil);

Dmitry




reply via email to

[Prev in Thread] Current Thread [Next in Thread]