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

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Mar 23 21:29:56 UTC 2010


Author: bacek
Date: Tue Mar 23 21:29:51 2010
New Revision: 45133
URL: https://trac.parrot.org/parrot/changeset/45133

Log:
Freeze/thaw Sub.outer_sub by name to avoid thawing second instance of
outer Sub. Closes TT#1172.

Modified:
   trunk/src/pmc/sub.pmc

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Tue Mar 23 17:09:02 2010	(r45132)
+++ trunk/src/pmc/sub.pmc	Tue Mar 23 21:29:51 2010	(r45133)
@@ -417,10 +417,10 @@
          * to the new context (refcounted) and convert the
          * retcontinuation to a normal continuation.  */
         if (PObj_get_FLAGS(SELF) & SUB_FLAG_IS_OUTER) {
-            sub->ctx = context;
             /* convert retcontinuation to a continuation */
             ccont->vtable = interp->vtables[enum_class_Continuation];
         }
+        sub->ctx = context;
 
         /* create pad if needed
          * TODO move this up in front of argument passing
@@ -632,7 +632,6 @@
     VTABLE void visit(PMC *info) {
         VISIT_PMC_ATTR(INTERP, info, SELF, Sub, namespace_name);
         VISIT_PMC_ATTR(INTERP, info, SELF, Sub, multi_signature);
-        VISIT_PMC_ATTR(INTERP, info, SELF, Sub, outer_sub);
 
         /*
          * XXX visit_pmc_now is wrong, because it breaks
@@ -703,6 +702,14 @@
             sub->subid = CONST_STRING(INTERP, "");
 
         VTABLE_push_string(INTERP, info, sub->subid);
+
+        /* Store name of outer sub */
+        if (!PMC_IS_NULL(sub->outer_sub)) {
+            VTABLE_push_string(INTERP, info, VTABLE_get_string(INTERP, sub->outer_sub));
+        }
+        else {
+            VTABLE_push_string(INTERP, info, CONST_STRING(INTERP, ""));
+        }
     }
 
 
@@ -720,6 +727,7 @@
         Parrot_Sub_attributes *sub;
         INTVAL flags;
         int    i;
+        STRING *outer_name;
 
         SUPER(info);
 
@@ -744,6 +752,14 @@
             sub->n_regs_used[i] = VTABLE_shift_integer(INTERP, info);
 
         sub->subid        = VTABLE_shift_string(INTERP, info);
+
+        outer_name = VTABLE_shift_string(INTERP, info);
+        if (!Parrot_str_equal(INTERP, outer_name, CONST_STRING(INTERP, ""))) {
+            sub->outer_sub = Parrot_find_name_op(INTERP, outer_name, NULL);
+        }
+        else {
+            sub->outer_sub = PMCNULL;
+        }
     }
 
 


More information about the parrot-commits mailing list