Message from discussion Continuations (again)
Mailing-List: contact perl6-internals-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-intern...@perl.org
Received: (qmail 760 invoked by uid 76); 21 Mar 2004 20:47:32 -0000
Received: from x1.develooper.com (HELO x1.develooper.com) (22.214.171.124)
by onion.perl.org (qpsmtpd/0.27.1) with SMTP; Sun, 21 Mar 2004 12:47:32 -0800
Received: (qmail 30478 invoked by uid 225); 21 Mar 2004 20:47:28 -0000
Received: (qmail 30471 invoked by alias); 21 Mar 2004 20:47:27 -0000
X-Spam-Status: No, hits=0.0 required=7.0
Received: from bors.merula.net (HELO bors.merula.net) (126.96.36.199)
by la.mx.develooper.com (qpsmtpd/0.27.1) with ESMTP; Sun, 21 Mar 2004 12:47:12 -0800
Received: from obelisk.bofh.org.uk (adsl-188.8.131.52.merula.net [184.108.40.206])
by bors.merula.net (8.12.10/8.12.9) with ESMTP id i2LKpRYm027203;
Sun, 21 Mar 2004 20:51:29 GMT
Received: from localhost (localhost [127.0.0.1])
by obelisk.bofh.org.uk (Postfix) with ESMTP
id ED27A379D4B; Sun, 21 Mar 2004 20:47:21 +0000 (GMT)
Received: from obelisk.bofh.org.uk ([127.0.0.1])
by localhost (obelisk.bofh.org.uk [127.0.0.1]) (amavisd-new, port 10024)
with LMTP id 17115-03-2; Sun, 21 Mar 2004 20:47:02 +0000 (GMT)
Received: by obelisk.bofh.org.uk (Postfix, from userid 501)
id DBB2C379D41; Sun, 21 Mar 2004 20:47:02 +0000 (GMT)
Subject: Re: Continuations (again)
Date: Sun, 21 Mar 2004 20:47:02 +0000
In-Reply-To: <200403211747.i2LHlAg26610@thu8.leo.home> (Leopold Toetsch's
message of "Sun, 21 Mar 2004 18:47:10 +0100")
User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (darwin)
Content-Type: text/plain; charset=us-ascii
X-Virus-Scanned: by amavisd-new at bofh.org.uk
From: pdcaw...@bofh.org.uk (Piers Cawley)
Leopold Toetsch <l...@toetsch.at> writes:
> Piers Cawley <pdcaw...@bofh.org.uk> wrote:
>> So, I'm trying to get my head 'round parrot's continuations. It's my
>> understanding that, at creation time, a Continuation closes over the
>> current user stacks, control stack and lexical pad (and possibly some
>> other stuff but those'll do for now).
> Yes register stacks. Which is one problem of your code. The calling
> sequence has a "savetop" inside, which isn't in the Continuations
But why do I need the savetop? I only care about the
> I already posted an working example.
> Here is another one (comments indicate problems with your code:
> .sub main
> $P0 = new PerlUndef
> $P0 = "Howdy, world\n"
> save $P0
> # create continuation inside, so that it has this in context
> $P1 = newcont after
> P5 = $P1
> P0 = find_global "_invoker"
> restore $P2
> print $P2
> # end *is* needed in main
> .sub _invoker
> # ^^ global labels have an underscore
> .param pmc a_cont
> invoke a_cont
>> Weird hunh?
> As long as no one really can tell the semantics of Continuations, they
> have to be hand-crafted like above.
So why does the generated pasm work where the PIR doesn't?
I can see why saving P0-2 would be a good idea, but after doesn't need
any of the other registers.