struct alignments

Don Clugston nospam at nospam.com
Wed Apr 16 11:52:37 PDT 2008


Lionello Lunesu wrote:
> 
>> One problem is that the stack (and hence all local variables) are only 
>> aligned to 32 bytes. This means you can only use SSE aligned loads 
>> (movaps, movapd) on static and heap variables. (This is something that 
>> D really should fix while it has the chance).
> 
> bits?

Um actually the '32 bytes' is completely wrong. You need to have 128 bit 
alignment = 16 bytes, but currently DMD only lets you have 64 bit 
alignment for locals. Since the D calling convention is different from 
C, D could actually define that 128 bit alignment is preserved for 
function calls (ie, stack pushes/pops between function calls must always 
be a multiple of 16 bytes). Extern(C) and extern(Windows) functions will 
need a stack alignment fixup at the start of them.


More information about the Digitalmars-d-learn mailing list