[svn:parrot] r43096 - branches/context_unify3/src/ops

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Dec 16 12:55:07 UTC 2009


Author: bacek
Date: Wed Dec 16 12:55:06 2009
New Revision: 43096
URL: https://trac.parrot.org/parrot/changeset/43096

Log:
Create CallObject for tailcall if it wasn't created early.

Modified:
   branches/context_unify3/src/ops/core.ops

Modified: branches/context_unify3/src/ops/core.ops
==============================================================================
--- branches/context_unify3/src/ops/core.ops	Wed Dec 16 12:33:14 2009	(r43095)
+++ branches/context_unify3/src/ops/core.ops	Wed Dec 16 12:55:06 2009	(r43096)
@@ -463,10 +463,15 @@
     opcode_t   *dest            = expr NEXT();
     PMC * const ctx             = CURRENT_CONTEXT(interp);
     PMC        *call_object     = Parrot_pcc_get_signature(interp, ctx);
-    interp->current_cont        = Parrot_pcc_get_continuation(interp, ctx);
+
+    /* If there is no call_object - create new one */
+    if (PMC_IS_NULL(call_object))
+        call_object = pmc_new(interp, enum_class_CallContext);
 
     Parrot_pcc_merge_signature_for_tailcall(interp, ctx, call_object);
-    Parrot_pcc_prepare_call(interp, call_object, interp->current_cont, interp->current_object);
+    Parrot_pcc_prepare_call(interp, call_object,
+            Parrot_pcc_get_continuation(interp, ctx),
+            interp->current_object);
 
     SUB_FLAG_TAILCALL_SET(interp->current_cont);
     dest = VTABLE_invoke(interp, p, dest);
@@ -560,8 +565,10 @@
 
     /* TODO Factor out with Sub.invoke */
     if (PObj_get_FLAGS(ccont) & SUB_FLAG_TAILCALL) {
-        Parrot_pcc_dec_recursion_depth(interp, ctx);
         PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
+        Parrot_pcc_dec_recursion_depth(interp, ctx);
+        Parrot_pcc_set_caller_ctx(interp, ctx,
+            Parrot_pcc_get_caller_ctx(interp, caller_ctx));
     }
 
     goto OFFSET(argc + 2);


More information about the parrot-commits mailing list