G'day all.

On Sun, Apr 28, 2002 at 09:49:35PM -0400, Melvin Smith wrote:

> I don't think I and Andrew were saying we shouldn't do caller-save, we
> were just discussing that the calling convention (read activation record of
> a subroutine) should support the common optimization of passing args
> in scratch registers when it might make sense. Having scratch registers
> and/or allowing passing in registers says nothing about whether you can
> implement co-routines or continuations how you see fit nor whether
> a caller saves its environment correctly or not.

Actually, I _was_ saying we shouldn't do caller-save (except possibly
for a small number of registers designated for the purpose).

Because of the principle that callees are responsible for pretty much
everything, I had assumed that they were to be responsible for saving
registers too.  (Sorry Dan for not noticing your previous
pronouncements on the matter.)

My main reason for objecting is that it slows down trivial leaf subs,
which are very common in OO programming.  Ideally neither the caller
nor the callee should need to save registers when calling such a sub.

I also can't see that it speeds anything up in the case of non-trivial/
non-leaf subs.  If the caller isn't trivial, it will still have to save
lots of registers, so it really doesn't matter who does it.

There's got to be a reason for making caller-save the default, but I
can't think of it. :-)

Cheers,
Andrew Bromage

Reply via email to