[M3devel] max_align

Jay K jay.krell at cornell.edu
Tue Jan 26 14:21:44 CET 2010


Visual C++/x86:

 

 

#include <stdio.h>

int main()
{
 printf("%u %u\n", __alignof(double), __alignof(__int64));
 return 0;
}

gcc/Linux/x86:

#include <stdio.h>

int main()
{
 printf("%u %u\n", __alignof(double), __alignof(long long));
 return 0;
}

 

 

both print "8 8".

 

 

Fixing this would break some pickles that contain LONGINT and/or LONGREAL, depending on if they needed padding to align.

 

 

 - Jay

 


From: jay.krell at cornell.edu
To: m3devel at elegosoft.com
Subject: max_align
Date: Tue, 26 Jan 2010 12:15:21 +0000



I kind of think max_align ought to left up at 64 for all platforms, or better yet, just removed.
 
In particular, this align LONGINT on 64bit boundaries on 32bit x86 systems.
And also double (LONGFLOAT, whatever).
 
This would help with atomic compare exchange on 64 bit values on x86.
It would probably let us drop the m3cg x86 -mno-align-double switch.
  That would have saved me quite some debugging time a while ago....
Not sure about -munaligned-doubles though on Linux/sparc.
 
I'd have to check what the language allows, but if there is "adequate" and
"ideal" alignment, then users should maybe be able to ask for "adequate"
if they have large arrays and want to optimize for memory.
 
Note that some platforms (PA64_HPUX, PPC_LINUX) have 128bit-aligned jmpbuf.
Though max_align doesn't appear to be applied to jmpbufs.
 
Notice that the language doesn't let you declare such high alignment.
 
- Jay

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


More information about the M3devel mailing list