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 06:38
Subject:
Re: Continuations, basic blocks, loops and register allocation
Message ID:
f2601a7f04111506381a917dd7@mail.gmail.com
All~

I think I may know a way around this problem.  You will have to bear
with me for a moment as I am not entirely used to speaking in terms of
continuations (I find a similar difficulty in speaking about Math, but
at least I have a commonly accepted lexicon for that ;-).

The view from 10,000 feet.  Full continuations do not operate on their
context in place, but operate on a copy of it when invoked.

The nitty gritty, consider (as provided by Jeff):

a = 1
foo()
print a
b = 10
return b

in the case where foo does not construct a full continuation an donly
uses the return continuation, no extra copying is done and everything
works.  In the case where foo takes a full continuation and puts it in
a global "evil", when foo upgrades its return continuation to a full
one (which happens automatically if foo or one of its children creates
a full continuation of its own), all of the continuations down the
tree will be marked as full.  When a full continuation is invoked it
*copies* its contenxt into place (thus it can be invoked multiple
times and it will always have its original context).  This means that
invoking full continuations will have a speed hit associated with it
(although that is to be expected), creatings full continuations has a
smaller speed hit of marking the chain (also reasonably expected), but
invoking and creating return continuations would still be cheap.

Hopefully that made sense to someone other than me,
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