unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Emacs development discussions <emacs-devel@gnu.org>
Subject: Re: Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings]
Date: Wed, 03 Sep 2014 22:13:10 -0700	[thread overview]
Message-ID: <5407F4E6.2040809@cs.ucla.edu> (raw)
In-Reply-To: <5407F1B7.6090704@yandex.ru>

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))

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



  reply	other threads:[~2014-09-04  5:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 12:55 [RFC] temporary Lisp_Strings Dmitry Antipov
2014-09-02 13:21 ` Andreas Schwab
2014-09-02 13:47   ` Dmitry Antipov
2014-09-02 14:14     ` Andreas Schwab
2014-09-02 15:00     ` Eli Zaretskii
2014-09-02 14:00 ` Stefan Monnier
2014-09-02 15:13   ` Dmitry Antipov
2014-09-02 17:32     ` Stefan Monnier
2014-09-03 10:23       ` Benchmarking temporary Lisp objects [Was: Re: [RFC] temporary Lisp_Strings] Dmitry Antipov
2014-09-03 13:14         ` Stefan Monnier
2014-09-03 14:39         ` Paul Eggert
2014-09-03 15:39           ` Dmitry Antipov
2014-09-03 16:42             ` Paul Eggert
2014-09-03 17:47               ` Stefan Monnier
2014-09-03 18:00                 ` Paul Eggert
2014-09-04  4:59               ` Dmitry Antipov
2014-09-04  5:13                 ` Paul Eggert [this message]
2014-09-04  5:51                   ` Dmitry Antipov
2014-09-04  6:45                     ` Paul Eggert
2014-09-04 13:11                     ` Stefan Monnier
2014-09-04 13:37                       ` Dmitry Antipov
2014-09-04 14:46                         ` Dmitry Antipov
2014-09-04 16:03                           ` Paul Eggert
2014-09-05  4:00                             ` Dmitry Antipov
2014-09-05  4:24                               ` Stefan Monnier
2014-09-05  9:28                                 ` Dmitry Antipov
2014-09-05  7:15                               ` Paul Eggert
2014-09-05  9:16                                 ` Dmitry Antipov
2014-09-05 14:35                                   ` Paul Eggert
2014-09-05 15:35                                 ` Stefan Monnier
2014-09-08 10:33                                   ` Dmitry Antipov
2014-09-08 12:01                                     ` Dmitry Antipov
2014-09-08 13:30                                       ` Stefan Monnier
2014-09-08 12:44                                     ` Stefan Monnier
2014-09-08 13:30                                       ` Stefan Monnier
2014-09-02 14:37 ` [RFC] temporary Lisp_Strings Paul Eggert
2014-09-02 15:24   ` Dmitry Antipov
2014-09-02 15:28   ` Dmitry Antipov

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5407F4E6.2040809@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=dmantipov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).