[svn:parrot] r43129 - in branches/context_unify3: compilers/imcc src/call src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Thu Dec 17 09:17:40 UTC 2009


Author: chromatic
Date: Thu Dec 17 09:17:39 2009
New Revision: 43129
URL: https://trac.parrot.org/parrot/changeset/43129

Log:
[PMC] Set the current sub of NCI calls to the parent sub, so that calls into
Parrot through NCI know their calling PIR subs.  Also changed the Sub PMC's
set_outer() method to ignore the NCI calling context when attaching the correct
context to another Sub PMC.  If that sounds esoteric, be glad that bacek and I
know what it means, and that we have a test which catches it.

(Roll on Lorito to make this all go away.)

Modified:
   branches/context_unify3/compilers/imcc/pbc.c
   branches/context_unify3/src/call/pcc.c
   branches/context_unify3/src/pmc/nci.pmc
   branches/context_unify3/src/pmc/sub.pmc

Modified: branches/context_unify3/compilers/imcc/pbc.c
==============================================================================
--- branches/context_unify3/compilers/imcc/pbc.c	Thu Dec 17 08:31:35 2009	(r43128)
+++ branches/context_unify3/compilers/imcc/pbc.c	Thu Dec 17 09:17:39 2009	(r43129)
@@ -1211,7 +1211,7 @@
     PMC_get_sub(interp, current, sub);
     cur_name = sub->name;
 
-    cur_name_str = Parrot_str_to_cstring(interp,  sub->name);
+    cur_name_str = Parrot_str_to_cstring(interp, sub->name);
     if (strlen(cur_name_str) == len
     && (memcmp(cur_name_str, unit->outer->name, len) == 0)) {
         Parrot_str_free_cstring(cur_name_str);

Modified: branches/context_unify3/src/call/pcc.c
==============================================================================
--- branches/context_unify3/src/call/pcc.c	Thu Dec 17 08:31:35 2009	(r43128)
+++ branches/context_unify3/src/call/pcc.c	Thu Dec 17 09:17:39 2009	(r43129)
@@ -253,7 +253,7 @@
 }
 
 /*
- 
+
 =item C<PMC* Parrot_pcc_prepare_call(PARROT_INTERP, PMC *call_object, PMC
 *ret_cont, PMC *current_object)>
 

Modified: branches/context_unify3/src/pmc/nci.pmc
==============================================================================
--- branches/context_unify3/src/pmc/nci.pmc	Thu Dec 17 08:31:35 2009	(r43128)
+++ branches/context_unify3/src/pmc/nci.pmc	Thu Dec 17 09:17:39 2009	(r43129)
@@ -320,6 +320,10 @@
                     "attempt to call NULL function");
         }
 
+        Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp),
+            Parrot_pcc_get_sub(interp,
+                Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp))));
+
         if (nci_info->jitted) {
             nci_jit_sub_t jit_func = (nci_jit_sub_t) D2FPTR(nci_info->func);
 

Modified: branches/context_unify3/src/pmc/sub.pmc
==============================================================================
--- branches/context_unify3/src/pmc/sub.pmc	Thu Dec 17 08:31:35 2009	(r43128)
+++ branches/context_unify3/src/pmc/sub.pmc	Thu Dec 17 09:17:39 2009	(r43129)
@@ -1072,8 +1072,8 @@
         }
 
         /* If we've got a context around for the outer sub, set it as the
-         * outer context. */
-        tmp1 = CURRENT_CONTEXT(interp);
+         * outer context, but skip the first outer (for the method call) */
+        tmp1 = Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
         while (!PMC_IS_NULL(tmp1)) {
             if (Parrot_pcc_get_sub(interp, tmp1) == outer) {
                 sub->outer_ctx = tmp1;


More information about the parrot-commits mailing list