Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2017 09:18:50 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Mateusz Guzik <mjguzik@gmail.com>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: There is *NO* abi stability in -head
Message-ID:  <07ED56CD-A7D5-44DE-B44A-C24BE9FC5488@FreeBSD.org>
In-Reply-To: <CAGudoHERrva8esddVU66PhZYL%2BZjmh8JtWXFtH4=vBZcTX-aQg@mail.gmail.com>
References:  <CAGudoHERrva8esddVU66PhZYL%2BZjmh8JtWXFtH4=vBZcTX-aQg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 23 Oct 2017, at 21:35, Mateusz Guzik <mjguzik@gmail.com> wrote:
> 
> Instead, the same can be reshuffled:
> struct crap2 {
>        int i1;
>        int i2;
>        void *p1;
>        void *p2;
> };
> 
> With offsets:
> 
> 0x1000 i1
> 0x1004 i2
> 0x1008 p1
> 0x1010 p2
> 
> This is only 24 bytes. 2 ints can be placed together and since they add
> up to 8 the p1 pointer gets the right alignment without extra padding.

If you are making changes of this nature, please consider sorting in the other order.  When we start seeing 128-bit pointers (which, with CHERI-like systems, may be sooner than you think) then this ordering will give you lots of padding, whereas putting the pointers first will not.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?07ED56CD-A7D5-44DE-B44A-C24BE9FC5488>