[Issue 2278] Guarantee alignment of stack-allocated variables on x86

Don nospam at nospam.com.au
Tue Aug 12 00:00:04 PDT 2008


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=2278
> 
> 
> 
> 
> 
> ------- Comment #2 from bugzilla at digitalmars.com  2008-08-11 16:38 -------
> Keeping the stack always aligned is not that simple. The code generator will
> also push/pop register pairs when it runs out of them.

Yes, that's why I said it needs an extra push if and only if
(pushed arguments + pushed registers so far
in this function) is odd.

Code generator needs a counter which is incremented for every push, and 
decremented for every pop. This counter should be consulted before 
generating a function call.

> 
> Probably the most practical approach is to align static arrays by using the
> code to AND the ESP register, but this means that there will be two frame
> pointers for the function. Ug.




More information about the Digitalmars-d-bugs mailing list