performance page

Matthew Fluet fluet@CS.Cornell.EDU
Tue, 9 Oct 2001 14:59:27 -0400 (EDT)


> I've been thinking about nontail fib and tak as well, and I believe that we
> could do better, even with a stack calling convention.  The problem is that with
> our current calling convention, arguments are returned on the stack just above
> the return address.  So, in the callee, where the slot for the return address is
> dead, you almost always see some shuffle code to move all the return values down
> 4 bytes.  Without changing calling conventions, we could change the current
> register allocator to leave the four bytes dead and avoid the shuffle.  

That sounds like it would work.

> Even
> better, we could change the calling convention so that the caller leaves space
> for the return values below the return address and the callee places them
> there.  Then, no shuffle and no dead space.  And I don't think it requires any
> runtime system changes.

We just need to make sure that we get the frameLayouts and
frameSize correct.  But that would be nice.  The only "untested" aspect of
this is that the callee would be writing to negative stack offset slots.
It shouldn't be a problem, but I'm just noting that it's something the
codegens haven't seen before.

> I think that this change should be done independently of the calling convention
> for small numbers of ints.

Agreed.  I'm still not completely sure how this would play out in the
native codegen.  The minor issue is that function call convention has to
some extent already been expanded; so, the codegen would sort of need to
infer the arguments and treat them differently.