On Thu, 2002-07-18 at 14:27, Melvin Smith wrote:
> The temporary fix is to do:
> 
> new P0, .Sub
> set_addr I0, MYSUB
> set P0, I0
> call

Attached are three small patches, two of them change example files
(examples/assembly/coroutine.pasm and examples/assembly/sub.pasm)
to use this fix that Melvin mentioned.

The third is a fix for a simple bug in coroutine.pmc: Parrot_Coroutine
was being cast to a Parrot_Sub which caused a seg fault when callco was
called.

(This is my first attempt at sending patches to the list, so any
comments about how this should really be done would be appreciated.)

--
Jonathan Sillito
Index: examples/assembly/sub.pasm
===================================================================
RCS file: /cvs/public/parrot/examples/assembly/sub.pasm,v
retrieving revision 1.2
diff -u -r1.2 sub.pasm
--- examples/assembly/sub.pasm	7 Jun 2002 23:41:21 -0000	1.2
+++ examples/assembly/sub.pasm	18 Jul 2002 22:51:09 -0000
@@ -1,13 +1,20 @@
+# sub.pasm
+#
 # Sample sub-routines in Parrot
 #
-# Create 2 subroutines
+# $Id: $
 #
-set_addr I0, SUB 
-new P0, .ParrotSub, I0 
+
+# Create 2 subroutines
+set_addr I0, SUB
+new P0, .Sub
+set P0, I0
 save P0
-new P0, .ParrotSub, I0 
+new P0, .Sub
+set P0, I0
 # Calling convention says P0 will contain the sub
 call
+
 restore P0
 # Call second one
 call
Index: classes/coroutine.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/coroutine.pmc,v
retrieving revision 1.2
diff -u -r1.2 coroutine.pmc
--- classes/coroutine.pmc	18 Jul 2002 03:48:33 -0000	1.2
+++ classes/coroutine.pmc	18 Jul 2002 22:53:12 -0000
@@ -77,11 +77,11 @@
    }
 */
    void set_integer (PMC * value) {
-       ((struct Parrot_Sub*)SELF->data)->init = (opcode_t*)value->vtable->get_integer(INTERP, value);
+       ((struct Parrot_Coroutine*)SELF->data)->init = (opcode_t*)value->vtable->get_integer(INTERP, value);
    }
 
    void set_integer_native (INTVAL value) {
-       ((struct Parrot_Sub*)SELF->data)->init = (opcode_t*)value;
+       ((struct Parrot_Coroutine*)SELF->data)->init = (opcode_t*)value;
    }
 /*
    void set_integer_bigint (BIGINT value) {
Index: examples/assembly/coroutine.pasm
===================================================================
RCS file: /cvs/public/parrot/examples/assembly/coroutine.pasm,v
retrieving revision 1.1
diff -u -r1.1 coroutine.pasm
--- examples/assembly/coroutine.pasm	7 Jun 2002 23:36:03 -0000	1.1
+++ examples/assembly/coroutine.pasm	18 Jul 2002 22:50:56 -0000
@@ -1,11 +1,17 @@
+# coroutine.pasm
+# 
 # Sample co-routines in Parrot
 #
-# Create 2 coroutines
+# $Id: $
 #
+
 set_addr I0, MYCOROUTINE 
-new P0, .ParrotCoroutine, I0 
+new P0, .Coroutine
+set P0, I0
 save P0
-new P0, .ParrotCoroutine, I0 
+new P0, .Coroutine
+set P0, I0
+
 # Calling convention says P0 will contain the sub so..
 print "Calling 1st co-routine\n"
 callco

Reply via email to