On Fri, 9 Jan 2004, Leopold Toetsch wrote:

> Michal Wallace <[EMAIL PROTECTED]> wrote:
>
> > Hey all,
>
> > When you invoke a Coroutine, it calls swap_context()
>
> Can you have a look at imcc/t/syn/pcc.t, there is an coroutine
> iterator test.

Yep, it has the same problem. The patch below exposes it.
Comment out the first zero=0 line and you get an infinite
stream of sixes. With both in there it prints two numbers
and ends. (This is without Luke's patch)

The principle seems to be that you can't modify anything
in the context without screwing up the continuation's
registers.

Sincerely,

Michal J Wallace
Sabren Enterprises, Inc.
-------------------------------------
contact: [EMAIL PROTECTED]
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
--------------------------------------


Index: t/syn/pcc.t
===================================================================
RCS file: /cvs/public/parrot/imcc/t/syn/pcc.t,v
retrieving revision 1.28
diff -u -r1.28 pcc.t
--- t/syn/pcc.t 16 Dec 2003 08:53:44 -0000      1.28
+++ t/syn/pcc.t 10 Jan 2004 03:41:28 -0000
@@ -489,6 +489,8 @@

 output_is(<<'CODE', <<'OUT', "coroutine iterator");
 .sub _main
+  .local int zero
+  zero=0
   .local int i
   i=5
   newsub $P0, .Coroutine, _addtwo
@@ -500,6 +502,7 @@
  ret_addr:
   .result $I2
   .pcc_end
+    zero = 0
     print $I2
     print "\n"
     savetop

Reply via email to