From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Dmitry Antipov <antipov@mvista.com>
Cc: emacs-devel@gnu.org
Subject: Re: immediate strings #2
Date: Mon, 28 Nov 2011 12:33:26 -0500 [thread overview]
Message-ID: <jwvborwcgee.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4ED35057.8010103@yandex.ru> (Dmitry Antipov's message of "Mon, 28 Nov 2011 13:11:51 +0400")
> struct Lisp_String
> {
> + /* Text properties in this string. */
> + INTERVAL intervals;
> +
> + /* Mark bit used for GC. */
> + unsigned gcmarkbit : 1;
> +
> + /* String subtype. */
> + unsigned immbit : 1;
> +
> + union {
> +
> + /* When IMMBIT is 1. */
> + struct {
> + EMACS_INT size : 7;
> + EMACS_INT size_byte : 7;
> + unsigned char data[STRING_IMM_MAX];
> + } imm;
> +
> + /* When IMMBIT is 0. */
> + struct {
> + EMACS_INT size : BITS_PER_EMACS_INT - 1;
> + EMACS_INT size_byte : BITS_PER_EMACS_INT - 1;
> + unsigned char *data;
> + } dat;
> + } u;
> };
I don't know any C compiler able to allocate unions at the bit level, so
the above struct will have the following layout:
INTERVAL: 32
gcmarkbit: 1
immbit: 1
<padding>: 30
union: 96
I'm not sure about the layout of dat.size_byte, but I could even imagine
it straddling two words. You need to move the immbit and gcmarkbit
into the union :-(
It's great to see that it can speed up compilation, tho (although
the 1.3% difference could just as well be due to noise). You might want
to check what proportion of those strings have a NULL `intervals' field.
Stefan
next prev parent reply other threads:[~2011-11-28 17:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 9:11 immediate strings #2 Dmitry Antipov
2011-11-28 17:33 ` Stefan Monnier [this message]
2011-11-28 19:48 ` Ken Raeburn
2011-11-28 20:10 ` Andreas Schwab
2011-11-28 21:54 ` Stefan Monnier
2011-11-28 22:25 ` Andreas Schwab
2011-11-29 0:57 ` Ken Raeburn
2011-11-29 8:44 ` Andreas Schwab
2011-11-29 15:48 ` Ken Raeburn
2011-11-29 16:08 ` Andreas Schwab
2011-11-30 16:43 ` Ken Raeburn
2011-11-28 22:18 ` Paul Eggert
2011-11-29 2:07 ` Stefan Monnier
2011-11-29 3:37 ` Dmitry Antipov
2011-11-29 8:50 ` Paul Eggert
2011-11-30 5:37 ` Dmitry Antipov
2011-11-30 9:35 ` Paul Eggert
2011-11-30 16:43 ` Ken Raeburn
2011-11-30 21:44 ` Paul Eggert
2011-11-29 3:17 ` Dmitry Antipov
2011-11-29 5:29 ` 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=jwvborwcgee.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=antipov@mvista.com \
--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).