[svn:parrot] r40576 - branches/tt795_kill_parrot_sub_structure/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Aug 16 04:13:58 UTC 2009


Author: bacek
Date: Sun Aug 16 04:13:55 2009
New Revision: 40576
URL: https://trac.parrot.org/parrot/changeset/40576

Log:
[core] Fix Coroutine compilation.

Modified:
   branches/tt795_kill_parrot_sub_structure/src/pmc/coroutine.pmc

Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/coroutine.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/coroutine.pmc	Sun Aug 16 03:14:49 2009	(r40575)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/coroutine.pmc	Sun Aug 16 04:13:55 2009	(r40576)
@@ -57,8 +57,8 @@
 }
 
 pmclass Coroutine extends Sub need_ext {
-    PackFile_ByteCode *caller_seg;  /* bytecode segment */
-    opcode_t *address;           /* next address to run - toggled each time */
+    ATTR PackFile_ByteCode *caller_seg;  /* bytecode segment */
+    ATTR opcode_t *address;           /* next address to run - toggled each time */
 
 /*
 
@@ -76,9 +76,10 @@
 
     VTABLE void init() {
         Parrot_Coroutine_attributes *attrs =
-            mem_allocate_typed(Parrot_Coroutine_attributes);
+            mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
 
-        attrs->sub     = (Parrot_sub *)new_coroutine(INTERP);
+        attrs->seg = INTERP->code;
+        attrs->ctx = NULL;
         PMC_data(SELF) = attrs;
 
         PObj_custom_mark_destroy_SETALL(SELF);
@@ -97,14 +98,12 @@
 
     VTABLE PMC *clone() {
         PMC         * const ret      = pmc_new(INTERP, SELF->vtable->base_type);
-        Parrot_sub         *sub;
-        Parrot_sub         *coro_sub;
+        Parrot_Coroutine_attributes *sub = PARROT_COROUTINE(SELF);
+        Parrot_Coroutine_attributes *coro_sub = PARROT_COROUTINE(ret);
 
         PObj_custom_mark_destroy_SETALL(ret);
 
-        PMC_get_sub(INTERP, ret,  coro_sub);
-        PMC_get_sub(INTERP, SELF, sub);
-        memcpy(coro_sub, sub, sizeof (Parrot_coro));
+        memcpy(coro_sub, sub, sizeof (Parrot_Coroutine_attributes));
 
         coro_sub->name      = Parrot_str_copy(INTERP, coro_sub->name);
 
@@ -123,8 +122,7 @@
 
     VTABLE opcode_t *invoke(void *next) {
         PackFile_ByteCode  *wanted_seg;
-        Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
-        Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+        Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
         opcode_t    * dest     = co->address;
 
         if (Interp_trace_TEST(INTERP, PARROT_TRACE_SUB_CALL_FLAG))
@@ -244,8 +242,7 @@
 */
 
     VTABLE void mark() {
-        Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
-        Parrot_coro * const          co    = (Parrot_coro *)attrs->sub;
+        Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
 
         /* co->ctx marked in SUPER(), so do not mark here */
         if (co) {


More information about the parrot-commits mailing list