Andrew J Bromage <[EMAIL PROTECTED]> writes:

> G'day all.
>
> On Fri, Apr 19, 2002 at 07:06:04AM +0100, Piers Cawley wrote:
>
>> If I'm going to be doing tail call optimization
>> (and I can't call it scheme if I don't) then my first thought was as
>> follows.
>> 
>>   # This is a tail call
>> 
>>              branch FOO_tail
>>              ...
>> 
>>   # This not a tail call
>> 
>>              bsr FOO
>>              ...
>> 
>>   FOO:       pop_call I0
>>   FOO_tail:  ...
>>              ...
>>   FOO_ret:   push_call I0
>>              ret
>> 
>> (In the example I'm using 'I0' as my 'partial continuation
>> register'. Essentially the partial continuation is the place where you
>> want to return to when the current function is finished.
>
> I don't understand why you need it.  Can't you just use the top of
> the call stack as the continuation?

It's fine for partial continuations certainly, but less fine if you
want to implement full continations which require you to save the
state of the entire stack. I was hoping I'd find a way to do this
without having to wait for Parrot to get its own continuations. If

      set I0, LABEL

sets I0 to an address which I can C<jump> to from anywhere then I have
what I need. If it doesn't, then (AFAICS) I'm going to need the
ability to manipulate the call stack, or I'll just have to live with
partial continuations.

What's SECD by the way?

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to