[Top][All Lists]

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

Re: Alignment of Lisp_Subr

From: Stephen J. Turnbull
Subject: Re: Alignment of Lisp_Subr
Date: Fri, 14 Nov 2003 01:18:25 +0900
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.5 (celeriac, linux)

>>>>> "Miles" == Miles Bader <address@hidden> writes:

    Miles> On Wed, Nov 12, 2003 at 11:22:33AM -0500, Stefan Monnier
    Miles> wrote:

    >> - Structures of type Lisp_Subr are statically allocated and are
    >> not guaranteed to be aligned on a multiple of 8.  I currently
    >> solve this by adding __attributes__ ((__aligned__ (8))), but
    >> this only works for GCC AFAIK.

    Miles> I think the compiler will force the structure to be aligned
    Miles> to the strictest alignment of any component, so if you
    Miles> stick an field with 8-byte-alignment in there _somewhere_,
    Miles> the compiler should do everything for you.  It should even
    Miles> work to put the `forcing field' in as a member of a union
    Miles> with another field, and simply never use the forcing field.
    Miles> On many platforms, `double' could be used as the type of
    Miles> the forcing-field, but I'm not sure how universal this is.

XEmacs has a typedef and a family of macros for forcing alignment.  I
believe the author is Martin Buchholz <address@hidden>.  We don't
need to force 8 bytes, but I'd be surprised if Martin doesn't know how
to do that for a very wide variety of platforms.

There may be issues with Lisp objects with tagbits at the bottom.  I
know XEmacs had some problems on recent glibc, which were never
properly diagnosed.  It's probable that this was due to excessive
cleverness in optimizing space use of malloc blocks, but if you do run
into weirdness (we were crashing) feel free to ping me and I'll dig up
the thread.

Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.

reply via email to

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