On Wed, 1 Dec 1999, Dmitrij Tejblum wrote:
> Bruce Evans wrote:
> > I would have
> > expected the most generally efficient way to align doubles and the new PIII
> > obkects to be aligning the stack only in functions that have such objects
j
> > on the stack. This requires at most one extra instruction:
> >
> > andl $~0xf,$esp 16-byte alignment
%
>
> I think, it's not that simple in the usual case when the object is accessed via
> (%ebp-<someconstant>).
%ebp would have to be aligned relative to %esp, but this would require an
unusal function prologue with possible complications in debuggers, and seems
to require 2 or 3 more extra instructions to recover the original %esp:
pushl %ebp
movl %esp,%eax # extra
andl $0xf,%esp # extra
movl %esp,%ebp
pushl %eax # extra
... # worst case: no registers saved, no local space
... # allocated, and no alloca() allowance
movl -4(%ebp),%esp # extra
popl %ebp
ret
If the caller has passed a double, then the stack alignment can be determined
at compile time and the current subl-type adjustment can be used.
If alloca() is not allowed for, then %esp-relative accesses can be used for
auto and temporary variables, and %ebp-relative accesses for args.
Bruce
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message