develooper Front page | perl.perl6.internals | Postings from November 2004

Re: Continuations, basic blocks, loops and register allocation

Thread Previous | Thread Next
Leopold Toetsch
November 16, 2004 09:35
Re: Continuations, basic blocks, loops and register allocation
Message ID:
Matt Fowles wrote:
> I disagree with that analysis.  Let us consider the actual effect of
> such an implementation.
> First iteration
> i = 0;
> foo(); #at this point a continuation created capturing i=0, promoted
> by Jens and stuff happens
> #eventually it is invoked, restoring i=0
> i++; #i = 1
> foo(); #at this point a NEW return continuation is created capturing

That would work if there is a one to one representation of the invoation 
of foo() an it's continuation. But no one guarantees that.

By repeatedly invocing the continuation you alway get to the opcode 
after invoke, and registers would be restored to some earlier state.

> ...  If foo's algorithm had an error and did not use the new
> return continuation to recreate its internal continuation each time,
> then you would be correct.  But that would be a bug in the
> implementation of foo.

Why? If foo's implementation is changed internally to double it's work 
per call, it could indicate that progress by returning twice through the 
same continuation.


   unless done
      (done, result) = foo()
      s .= result


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About