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 15, 2004 11:17
Re: Continuations, basic blocks, loops and register allocation
Message ID:
Jeff Clites <> wrote:

> Picture this call stack:

> 	main --> A --> B --> C --> D --> E

> The call from D to E uses the "RESUMEABLE" label, and E stores the
> resulting continuation in a global, and everything up to main returns.
> Then, main invokes the continuation, and we find ourselves back in D.
> Now, C, B, and A will return "again", without any compile-time hint.

That's fine. The return is an expected operation. I don't think that's
the problem. The error in gc_13 is a call path like:

   choose() -> try (with_cc) -> fail() ->
                     (choose again)  <- +     <--+
   choose() -> try (with_cc) -> fail() ->        |
                                        |        |
                     (choose again)  <- +        |
   fail()  --------------------------------------+

The problem now is not per se the path in main from the two choose()
calls down to fail is executed more then once (as it's the case with
multiple returns). The problem is the loop in main. By denoting the loop
from the call to fail() to the first choose() with some kind of syntax,
the register allocator does the right thing.

> JEff


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