G'day all. On Mon, Apr 22, 2002 at 01:52:30PM -0700, Brent Dax wrote:
> > How about we instead declare that all subs have One True Entry Point, > > and the sub does whatever is needed there? Normal subs can just set up > > scoping and jump to the beginning of the sub's body; coroutines retrieve > > their context object and use it; XS and JIT call enternative; etc. That > > way we only pay for the overhead on subs that need it. On Thu, Apr 25, 2002 at 02:12:57PM +0100, Tim Bunce wrote: > I agree. I also agree, however, I suspect it might be a good time to also consider calling convention. This is partly a language-specific issue. Some languages have no well-defined "arguments", some languages have multiple return values and so on. While not necessarily wanting to mandate a specific convention in this respect, it would be very handy (and not just for the optimizer) to know which values must be stored in specific registers and which may be stored elsewhere. > To my mind that means that a subroutine should be responsible for > setting up whatever _it_ needs (and ideally only what it knows it needs). I think there's one possible exception to this rule. It may make sense to make some registers caller-save rather than callee-save. This is especially important in OO programming, which tends to feature lots of trivial leaf subs which, for efficiency, shouldn't need to save any registers. I suggest, as a first cut, splitting the range down the middle: X0-X15 (which will, no doubt, include sub arguments) are caller-save and X16-X31 are callee-save. This may not be the right number for each class, but we can only tell that with experience. If it's only truly trivial leaf subs which we need to worry about, making only 8 registers of each kind caller-save might be the way to go, but then you might start trampling on argument-passing space. Cheers, Andrew Bromage