[M3devel] m3gap.... it's an alignment issue
Jay K
jay.krell at cornell.edu
Fri Oct 8 21:03:19 CEST 2010
Gcc does nothing special. There are "never" alignment exceptions on x86.
Things might run slower. There is a control bit in the processor to make
it more strict but surely nobody sets it.
Some interlocked and maybe sse/sse2/3/4 intructions have alignment requirements.
We either have to go pains to match it precisely, and have silent memory
corruption if we fail. Or give up and don't really try.
By relaxed I meant larger alignments. You might call this more strict.
- Jay
----------------------------------------
> From: dragisha at m3w.org
> To: jay.krell at cornell.edu
> Date: Fri, 8 Oct 2010 20:46:56 +0200
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] m3gap.... it's an alignment issue
>
> We will always have some friction there... IMO, stricter is better, with
> maybe a pragma there... preceding variable/field name, fixing align,
> like
>
> EventKey = RECORD
> type: EventType;
> <* ALIGN 4 *> window: WindowStar;
> ...
> END;
>
> As for GCC... Does it not make alignment exception, or something, to
> reference non-aligned pointer on AMD64?
>
> Idealized structs... I didn't follow you there, probably I missed
> something earlier on list.
>
> On Fri, 2010-10-08 at 18:36 +0000, Jay K wrote:
> > I may have broken this, a while ago. I may have relaxed all the
> > alignments long ago.
> > We have very little interfacing with C now and most of that is with
> > our own C,
> > where I avoid small types.
> > We have had at least temporary problems related to our rules being
> > sort of too strict.
> > The need for -munaligned-double or such. (which reminds me I should
> > try that again).
> > Where our rules were ok but gcc's default for to align stuff more.
> > Where our layout and gcc's didn't agree.
> >
> > How bad would it be to generate or write a C layer that copies stuff
> > into "idealized" structs?
> > Where the types are all INTEGER or LONGINT or pointers.
> --
> Dragiša Durić
>
More information about the M3devel
mailing list