[svn:parrot] r43168 - branches/context_unify3_simple/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Dec 19 23:26:17 UTC 2009


Author: bacek
Date: Sat Dec 19 23:26:16 2009
New Revision: 43168
URL: https://trac.parrot.org/parrot/changeset/43168

Log:
Use previously created signature as context in Sub and Coro.invoke.

Modified:
   branches/context_unify3_simple/src/pmc/coroutine.pmc
   branches/context_unify3_simple/src/pmc/sub.pmc

Modified: branches/context_unify3_simple/src/pmc/coroutine.pmc
==============================================================================
--- branches/context_unify3_simple/src/pmc/coroutine.pmc	Sat Dec 19 23:25:55 2009	(r43167)
+++ branches/context_unify3_simple/src/pmc/coroutine.pmc	Sat Dec 19 23:26:16 2009	(r43168)
@@ -155,7 +155,13 @@
                         "tail call to coro not allowed");
 
             /* first time set current sub, cont, object */
-            ctx     = Parrot_set_new_context(INTERP, co->n_regs_used);
+            ctx = Parrot_pcc_get_signature(INTERP, caller_ctx);
+            if (PMC_IS_NULL(ctx))
+                ctx = pmc_new(INTERP, enum_class_CallContext);
+            CURRENT_CONTEXT(INTERP) = ctx;
+            Parrot_pcc_allocate_registers(INTERP, ctx, co->n_regs_used);
+            Parrot_pcc_set_caller_ctx(INTERP, ctx, caller_ctx);
+            Parrot_pcc_init_context(INTERP, ctx, caller_ctx);
 
             co->ctx = ctx;
 

Modified: branches/context_unify3_simple/src/pmc/sub.pmc
==============================================================================
--- branches/context_unify3_simple/src/pmc/sub.pmc	Sat Dec 19 23:25:55 2009	(r43167)
+++ branches/context_unify3_simple/src/pmc/sub.pmc	Sat Dec 19 23:26:16 2009	(r43168)
@@ -387,7 +387,14 @@
 
         /* plain subroutine call
          * create new context, place it in interpreter */
-        context               = Parrot_set_new_context(INTERP, sub->n_regs_used);
+        context = Parrot_pcc_get_signature(INTERP, caller_ctx);
+        if (PMC_IS_NULL(context))
+            context = pmc_new(INTERP, enum_class_CallContext);
+        CURRENT_CONTEXT(INTERP) = context;
+        Parrot_pcc_set_caller_ctx(INTERP, context, caller_ctx);
+        Parrot_pcc_allocate_registers(INTERP, context, sub->n_regs_used);
+        Parrot_pcc_init_context(INTERP, context, caller_ctx);
+
         Parrot_pcc_set_sub(interp, context, SELF);
         Parrot_pcc_set_continuation(interp, context, ccont);
         Parrot_pcc_set_constants(interp, context, sub->seg->const_table->constants);


More information about the parrot-commits mailing list