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

Re: Continuations, basic blocks, loops and register allocation

Thread Previous | Thread Next
From:
Leopold Toetsch
Date:
November 16, 2004 00:32
Subject:
Re: Continuations, basic blocks, loops and register allocation
Message ID:
200411160823.iAG8NOc28724@thu8.leo.home
Matt Fowles <ubermatt@gmail.com> wrote:

[ continuations should restore registers ]

> I am sorry, but I don't understand what you are trying to say here.
> Would you mind rewording it for me?

Imagine a simple loop:

    i = 0
  lp:
    foo()
    inc i
    if i < 10 goto lp

Looking at the loop counter a programmer or optimizer could easily
decide that using an I-Reg for it instead of a P-Reg is fine. Now comes
your proposed implementation for continuations: they copy the register
frame on creation and restore it on invocation. Besides of the big cost
of the memcpy's this simple loop above suddenly stops working, depending
on the implementation of foo() - which might be outside your control.

BTW in an early stage we had exactly this behavior of continuations.
This was abandoned. The subject was IIRC something like "Should
continuations close over registers". The answer was clearly "no".

leo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About