[Top][All Lists]

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

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

From: Paul Eggert
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Wed, 03 Sep 2014 22:13:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

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

How about something like this? The cool thing here is that GCC optimizes 'foo' away to a function that simply returns 0.

typedef unsigned long uintptr_t;

typedef uintptr_t Lisp_Object;

struct __attribute__ ((aligned (8))) Lisp_Cons
  Lisp_Object car;
  Lisp_Object cdr;

#define BCONS(a, b) ((Lisp_Object) &(struct Lisp_Cons) { a, b } + 3)
#define UNTAG(x) ((struct Lisp_Cons *) (uintptr_t) ((x) - 3))

foo (void)
  Lisp_Object a = BCONS (0, 0);
  Lisp_Object b = BCONS (0, a);
  return UNTAG (UNTAG (b) -> cdr) -> car;

reply via email to

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