[M3devel] platform-independent packing/alignment?

Tony Hosking hosking at cs.purdue.edu
Mon Feb 1 09:11:38 CET 2010


That shouldn't affect things since the pickler picks apart the structures and ships the individual primitives.  Right?

On 1 Feb 2010, at 02:41, Jay K wrote:

> Let's say I have:
>  
>  
> TYPE FOO = RECORD a: LONGFLOAT; b: UINT32; END;
> TYPE FOOA = ARRAY [0..1] OF FOO;
>  
>  
> And I have a platform with max_align = 32 and a platform with max_align = 64.
> One platform will make FOOA be 24 bytes, the other 32.
>   One platform will pad out FOO to be align the 8 byte LONGFLOAT, one won't.
> Can that pickle be read/written by the two platforms?
> And how does the code know/detect the difference?
> That is, if a platform changed from max_align = 32 to 64, would the pickle code work just
> as well on the "same" platform as on the "different" platforms?
>  
>  
> I very recently changed NT386 max_align from 32 to 64, and I believe
> the remaining active platforms with max_align = 32 should also be 64.
> It would "only" affect pickles with LONGINT or LONGFLOAT, as well
> as "lining up" such structs with C.
>  
>  
> Such alignment shold make us not need the extra "unaligned double" switch
> on most platforms (some mystery still on some platforms) as well as
> perhaps be needed for some atomic operations, esp. maybe on
> LONGINT on 32bit x86.
>  
>  
>  - Jay
> 
>  
> > From: dragisha at m3w.org
> > To: rodney_bates at lcwb.coop
> > Date: Sun, 31 Jan 2010 22:14:47 +0100
> > CC: m3devel at elegosoft.com
> > Subject: Re: [M3devel] platform-independent packing/alignment?
> > 
> > I've not changed my code, that is for sure.... But now I am not sure
> > some parent type (esp MUTEX here an there) was not changed... I'll take
> > a look on this again sometime soon and report my findings.
> > 
> > Thanks for clues.
> > 
> > On Sun, 2010-01-31 at 14:00 -0600, Rodney M. Bates wrote:
> > > 
> > > Dragiša Durić wrote:
> > > > I've asked this before, but didn't catch answer:
> > > > 
> > > > On Sun, 2010-01-31 at 12:21 +0000, Jay K wrote:
> > > >> I suggest we can probably get by with platform-independent
> > > >> packing/alignment settings.
> > > > 
> > > > Some time ago I've used pickles (CM3) to save some data... My program
> > > > does not read that pickle anymore.... 
> > > 
> > > And you are certain your program that tries to read still contains
> > > exact structurally equivalent types to all the types in the pickle?
> > > 
> > > > 
> > > > Someone remembers moment when this incompatible changes were made? 
> > -- 
> > Dragiša Durić <dragisha at m3w.org>
> > 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100201/cf5de097/attachment-0002.html>


More information about the M3devel mailing list