G'day all. On Sat, Apr 27, 2002 at 07:00:17AM +0100, Piers Cawley wrote:
> I'm trying to see how, if you want genuine continuations and/or tail > call optimization, you're going to get away with anything but 'caller > saves everything important to it', and what do you know, I > can't. If you have genuine continuations, you don't put anything important in registers across a call to a continuation. In fact, usually you don't need to. I don't see what the problem is with tail call optimization. The simplest form of tail call optimization is that you jump instead of bsr and use the caller's ret to return to your caller. When you get more complex, you emulate the callee's prologue and then just jump to the point after the prologue. In Parrot, subs are meant to have only One True Entry Point, so you'd probably do it with a wrapper sub: foo: sub_prologue_for_foo tailcall foo_TAIL foo_TAIL: do_whatever sub_epilogue_for_foo ret Callees who are aware of the tailcall entry for foo can use it, otherwise they can use the non-optimized version. Cheers, Andrew Bromage