[svn:parrot] r39340 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue Jun 2 20:03:29 UTC 2009


Author: chromatic
Date: Tue Jun  2 20:03:26 2009
New Revision: 39340
URL: https://trac.parrot.org/parrot/changeset/39340

Log:
[PMC] Fixed Coroutine PMC's mark vtable entry to avoid unnecessary work (such
as marking its context twice, once here and once in Sub's mark).

Modified:
   trunk/src/pmc/coroutine.pmc

Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc	Tue Jun  2 18:41:47 2009	(r39339)
+++ trunk/src/pmc/coroutine.pmc	Tue Jun  2 20:03:26 2009	(r39340)
@@ -76,9 +76,11 @@
 
     VTABLE void init() {
         Parrot_Coroutine_attributes *attrs =
-            mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
-        attrs->sub = (Parrot_sub*)new_coroutine(INTERP);
+            mem_allocate_typed(Parrot_Coroutine_attributes);
+
+        attrs->sub     = (Parrot_sub *)new_coroutine(INTERP);
         PMC_data(SELF) = attrs;
+
         PObj_custom_mark_destroy_SETALL(SELF);
     }
 
@@ -252,17 +254,15 @@
 
     VTABLE void mark() {
         Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
-        Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+        Parrot_coro * const          co    = (Parrot_coro *)attrs->sub;
 
+        /* co->ctx marked in SUPER(), so do not mark here */
         if (co) {
-            if (co->ctx)
-                mark_context(INTERP, co->ctx);
             if (co->dynamic_state)
                 mark_stack(INTERP, co->dynamic_state);
 
+            SUPER();
         }
-
-        SUPER();
     }
 }
 


More information about the parrot-commits mailing list