unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.
Date: Wed, 02 Jul 2014 19:13:24 +0400	[thread overview]
Message-ID: <53B42194.2040003@yandex.ru> (raw)
In-Reply-To: <jwvlhsb4z51.fsf-monnier+emacsdiffs@gnu.org>

On 07/02/2014 06:30 PM, Stefan Monnier wrote:

> Are we sure this SUB_CHAR_TABLE_OFFSET exists?  I don't see any reason
> why `contents' should necessarily be aligned on a multiple of Lisp_Objects.

Strictly speaking, you're right. ISO C99 says (6.7.2.1) just:

"Each non-bit-field member of a structure or union object is aligned in an
implementation-defined manner appropriate to its type."

In fact, on a 64-bit system and 32-bit system with --with-wide-int, sizeof (int) is
4 and sizeof (Lisp_Object) is 8. On a 64-bit system, any reasonable compiler should
pack 2 integers to 8-byte area, so SUB_CHAR_TABLE_OFFSET is 1; if the compiler is
stupid and packs each field to 8-byte slot, SUB_CHAR_TABLE_OFFSET is 2. On a 32-bit
system, SUB_CHAR_TABLE_OFFSET is 2 if sizeof (Lisp_Object) is 4 and 1 if
sizeof(Lisp_Object) is 8; anyway, it should be aligned (unless some packing tricks
are in effect?)

> So, I think it's unsafe to cast your new "struct Lisp_Sub_Char_Table"
> to a "struct Lisp_Vector".  Maybe it does work on current existing
> systems, but it's too fragile.

I'll install verify() to catch future (broken) systems.

Dmitry




  reply	other threads:[~2014-07-02 15:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1X2BBz-0000lE-Hh@vcs.savannah.gnu.org>
2014-07-02 14:30 ` [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects Stefan Monnier
2014-07-02 15:13   ` Dmitry Antipov [this message]
2014-07-02 15:42     ` Stefan Monnier
2014-07-02 15:54       ` Dmitry Antipov
2014-07-02 18:27         ` Stefan Monnier
2014-07-03  4:12           ` Dmitry Antipov
2014-07-03  5:01             ` Stephen J. Turnbull
2014-07-03 14:55               ` Eli Zaretskii
2014-07-03 16:12                 ` Dmitry Antipov
2014-07-03 16:37                   ` Nano-improvements " Eli Zaretskii
2014-07-03 13:57             ` [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring " Stefan Monnier
2014-07-03 15:36               ` Dmitry Antipov
2014-07-03 16:49                 ` Stefan Monnier
2014-07-03 17:01                   ` Dmitry Antipov
2014-07-03 19:52                     ` Stefan Monnier
2014-07-03 14:53             ` Nano-improvements (was: [Emacs-diffs] trunk r117464: Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects.) Eli Zaretskii
2014-07-03 15:58               ` Nano-improvements Dmitry Antipov
2014-07-03 16:10                 ` Nano-improvements Eli Zaretskii

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=53B42194.2040003@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 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).