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

Re: Continuations, basic blocks, loops and register allocation

Thread Previous | Thread Next
From:
Matt Fowles
Date:
November 15, 2004 14:19
Subject:
Re: Continuations, basic blocks, loops and register allocation
Message ID:
f2601a7f041115141960c8ea9c@mail.gmail.com
Leo~


On Mon, 15 Nov 2004 20:30:18 +0100, Leopold Toetsch <lt@toetsch.at> wrote:
> Matt Fowles wrote:
> 
> 
> > Leo~
> >
> > On Mon, 15 Nov 2004 17:36:20 +0100, Leopold Toetsch <lt@toetsch.at> wrote:
> >
> >>Matt Fowles wrote:
> >>
> >>
> >>>I do mean context + registers and it can do that.  If you keep your
> >>>loop-counter in a PMC, then it will be incremented
> >>
> >>Ok, but having suddenly such a difference between value and reference
> >>types would really cause weird behavior.
> >
> >
> > I disagree.  This is exactly the sort of distinction that has always
> > been annoying novice programmers with most every language.
> 
> Yes of course. But continue that sentence above: weird... depending on
> the presence of Continuation, which, by creating a loop from your code,
> start preserving your scalar data types.

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


> I didn't mention the runtime impact yet. You said already that it's
> costy. This would make continuations unusable for backtracking in the
> rules/rx engine.

The runtime inpact would be comparable to the speed of our previous
calls where memory had to be copied off and restored (accept that we
only need one of the copies instead of two).

I am not saying that this is necessarily the correct solution, but it
is a solution that would impose minimal breakage and would not put
heavy constraints on the register allocator.

One thing that worries me is the need to copy the entire callstack
worth of return continuations into full ones when a continuation is
created/promoted.  This could be optimized for the regex case by
taking an initial continuation and thereafter using its copied stack
to initialize any newly taken continuations.

Which gives me an evil idea.  We could allow bytecode to specify that
it wanted to start taking full continuations everywhere, but that
these would never be used below it on the callstack.  Thus the regex
engine could do this and not suffer too much efficiency loss for
taking new continuations for every backtrack point.

Matt
-- 
"Computer Science is merely the post-Turing Decline of Formal Systems Theory."
-???

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