[Mono-list] Stack variable alignment on Windows

Adam Miles amiles at gmail.com
Thu Jun 17 17:47:27 EDT 2010

The more I read what little documentation there is on variable alignment the
more I realise I might have misunderstood what is guaranteed. The guarantee
appears to be that the top of the stack frame is 16 byte aligned, not
necessarily every variable on the stack. So the variable at the top (?) of
the stack is 16 byte aligned however if the top variable is a float, the
next variable will be on a 4 byte boundary, not 16.

Where I've passed 3 Vector4f's by reference into a function it has pushed my
stack allocated Vector4 12 bytes along (presumably a 'ref' variable is 4
bytes on the stack, like a pointer). I could pass all Vector4f's by value,
but even then you couldn't also pass a float as well.

Assuming I've understood this correct (that's a big if), Mono.Simd is going
to suffer quite poor performance with all the unavoidable unaligned loads
and there's nothing that the user can do to work around it.
View this message in context: http://mono.1490590.n4.nabble.com/Stack-variable-alignment-on-Windows-tp2258096p2259520.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list