[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rep:Re: Rep:Re: [f-cpu] Stack handling



hi,

i can't read all the messages in this thread, but i see
that this last message contains some good things.

First, nicO's remark about buffer overflows etc. :-)

Then i have to answer Christophe's questions :

Christophe Avoinne wrote:
> 
> Please, I would like to know if using several registers as stack pointers
> pointing out on the same stack but with interleaved offset is a good way to
> reduce dependency register (in fact using contiguous store +8,r64,r? has or
> not depencency problem like in x86 ?)

in fact, it is much better !
it's not a problem of dependency here, but of scheduling.
it takes several cycles to update a pointer, that is :
the "distance" between two uses of a same pointer in a register
is rather large, around 6 cycles. If you can interleave memory
references, you can avoid the 6 cycles stalls.

if you interleave the stack pointers 2x, then your push and pop
duration is one half. yet you have to find other instructions
to interleave, but that's another story.

> > to push r1..r6, do :
> >
> > addi     -8  ,r62,r8
> > store    -16,r62,r1
> > store    -16,r8  ,r2
> > store    -16,r62,r3
> > store    -16,r8  ,r4
> >
> > store    -0  ,r62,r5
> > store    -0  ,r8  ,r6
> >
> > instead of :
> >
> > store    -8,r62,r1
> > store    -8,r62,r2
> > store    -8,r62,r3
> > store    -8,r62,r4
> >
> > store    -8,r62,r5
> > store    -0,r62,r6
> >
> > why not a triple stack ?
> >
> > addi     -8  ,r62,r8
> > addi     -16,r62,r9
> > store    -24,r62,r1
> > store    -24,r8  ,r2
> > store    -24,r9  ,r3
> > store    -0  ,r62,r4
> >
> > store    -0  ,r8  ,r5
> > store    -0  ,r9  ,r6
> >
> > ----- Original Message -----
> > From: "Nicolas Boulay" <nicolas.boulay@ifrance.com>
> > To: <f-cpu@seul.org>
> > Sent: Tuesday, July 23, 2002 4:27 PM
> > Subject: Rep:Re: Rep:Re: [f-cpu] Stack handling
> >
> >
> > Stack have a main draw back : it's add a udge dependancies in a single
> > poor register (the stack pointer).
> >
> > For security reason, i have proposed to use 2 stack : one for data, one
> > for code. So buffer overflow will became really hard ! this could be
> > usefull for performance, too. But most of the time, the stack will use
> > the register bank...
> >
> > And that doesn't solve the problem of push and pop.
> >
> > nicO
WHYGEE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/