Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Continuations (again)

Newsgroups: perl.perl6.internals
Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <pdcaw...@bofh.org.uk>
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) (63.251.223.170)
  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
Delivered-To: perl6-intern...@perl.org
Received: (qmail 30471 invoked by alias); 21 Mar 2004 20:47:27 -0000
X-Spam-Status: No, hits=0.0 required=7.0
	tests=
X-Spam-Check-By: la.mx.develooper.com
Received: from bors.merula.net (HELO bors.merula.net) (217.146.101.1)
  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-217.146.110.1.merula.net [217.146.110.1])
	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)
To: l...@toetsch.at
Cc: perl6-intern...@perl.org
Subject: Re: Continuations (again)
References: <m2znaata3d.fsf@obelisk.bofh.org.uk>
	<200403211747.i2LHlAg26610@thu8.leo.home>
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")
Message-ID: <m2llluszax.fsf@obelisk.bofh.org.uk>
User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (darwin)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Virus-Scanned: by amavisd-new at bofh.org.uk
Approved: n...@nntp.perl.org
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
> context.

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
>     savetop
>     $P1 = newcont after
>     P5 = $P1
>     P0 = find_global "_invoker"
>     invokecc
> after:
>     restoretop
>     restore $P2
>     print $P2
>
>     end
>     # end *is* needed in main
> .end
>
> .sub _invoker
> #    ^^ global labels have an underscore
>     .param pmc a_cont
>     invoke a_cont
> .end
>
>> 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.