[svn:parrot] r43036 - in branches/context_unify3/src: call ops pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon Dec 14 12:41:10 UTC 2009
Author: bacek
Date: Mon Dec 14 12:41:09 2009
New Revision: 43036
URL: https://trac.parrot.org/parrot/changeset/43036
Log:
Move pushing of CallContext out of Sub.invoke
Modified:
branches/context_unify3/src/call/pcc.c
branches/context_unify3/src/ops/core.ops
branches/context_unify3/src/pmc/sub.pmc
Modified: branches/context_unify3/src/call/pcc.c
==============================================================================
--- branches/context_unify3/src/call/pcc.c Mon Dec 14 12:38:37 2009 (r43035)
+++ branches/context_unify3/src/call/pcc.c Mon Dec 14 12:41:09 2009 (r43036)
@@ -273,15 +273,14 @@
ASSERT_ARGS(Parrot_pcc_invoke_from_sig_object)
opcode_t *dest;
- PMC *ctx = call_object;
PMC * const ret_cont = new_ret_continuation_pmc(interp, NULL);
- Parrot_pcc_init_context(interp, call_object, CURRENT_CONTEXT(interp));
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_object);
- Parrot_pcc_set_caller_ctx(interp, ctx, CURRENT_CONTEXT(interp));
- Parrot_pcc_set_continuation(interp, ctx, ret_cont);
- interp->current_cont = NEED_CONTINUATION;
- PARROT_CONTINUATION(ret_cont)->from_ctx = ctx;
+ Parrot_pcc_init_context(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_caller_ctx(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_continuation(interp, call_object, ret_cont);
+ interp->current_cont = ret_cont;
+ CURRENT_CONTEXT(interp) = call_object;
/* Invoke the function */
dest = VTABLE_invoke(interp, sub_obj, NULL);
@@ -298,7 +297,7 @@
runops(interp, offset);
Interp_core_SET(interp, old_core);
}
- Parrot_pcc_set_signature(interp, ctx, NULL);
+ //Parrot_pcc_set_signature(interp, ctx, NULL);
Parrot_pop_context(interp);
}
Modified: branches/context_unify3/src/ops/core.ops
==============================================================================
--- branches/context_unify3/src/ops/core.ops Mon Dec 14 12:38:37 2009 (r43035)
+++ branches/context_unify3/src/ops/core.ops Mon Dec 14 12:41:09 2009 (r43036)
@@ -427,9 +427,15 @@
inline op invokecc(invar PMC) :flow {
PMC * const p = $1;
opcode_t *dest = expr NEXT();
+ PMC *call_object = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
interp->current_object = NULL;
- interp->current_cont = NEED_CONTINUATION;
+ interp->current_cont = new_ret_continuation_pmc(interp, dest);
+ Parrot_pcc_init_context(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_caller_ctx(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_continuation(interp, call_object, interp->current_cont);
+ CURRENT_CONTEXT(interp) = call_object;
+
dest = VTABLE_invoke(interp, p, dest);
goto ADDRESS(dest);
@@ -438,9 +444,14 @@
inline op invoke(invar PMC, invar PMC) :flow {
opcode_t *dest = expr NEXT();
PMC * const p = $1;
+ PMC *call_object = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
interp->current_object = NULL;
interp->current_cont = $2;
+ Parrot_pcc_init_context(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_caller_ctx(interp, call_object, CURRENT_CONTEXT(interp));
+ Parrot_pcc_set_continuation(interp, call_object, interp->current_cont);
+ CURRENT_CONTEXT(interp) = call_object;
dest = VTABLE_invoke(interp, p, dest);
goto ADDRESS(dest);
@@ -461,10 +472,8 @@
opcode_t *dest = expr NEXT();
PMC * const ctx = CURRENT_CONTEXT(interp);
PMC * const parent_ctx = Parrot_pcc_get_caller_ctx(interp, ctx);
- PMC * const this_call_sig = Parrot_pcc_get_signature(interp, ctx);
- PMC * const parent_call_sig = Parrot_pcc_get_signature(interp, parent_ctx);
interp->current_cont = Parrot_pcc_get_continuation(interp, ctx);
- Parrot_pcc_merge_signature_for_tailcall(interp, parent_call_sig, this_call_sig);
+ Parrot_pcc_merge_signature_for_tailcall(interp, parent_ctx, ctx);
SUB_FLAG_TAILCALL_SET(interp->current_cont);
dest = VTABLE_invoke(interp, p, dest);
Modified: branches/context_unify3/src/pmc/sub.pmc
==============================================================================
--- branches/context_unify3/src/pmc/sub.pmc Mon Dec 14 12:38:37 2009 (r43035)
+++ branches/context_unify3/src/pmc/sub.pmc Mon Dec 14 12:41:09 2009 (r43036)
@@ -379,16 +379,11 @@
ccont = INTERP->current_cont;
INTERP->current_cont = NULL;
- if (ccont == NEED_CONTINUATION)
- ccont = new_ret_continuation_pmc(interp, (opcode_t *)next);
-
PARROT_ASSERT(!PMC_IS_NULL(ccont));
/* plain subroutine call
* create new context, place it in interpreter */
- context = Parrot_pcc_get_signature(INTERP, CURRENT_CONTEXT(INTERP));
- Parrot_pcc_init_context(INTERP, context, CURRENT_CONTEXT(INTERP));
- CURRENT_CONTEXT(INTERP) = context;
+ context = CURRENT_CONTEXT(INTERP);
Parrot_pcc_allocate_registers(INTERP, context, sub->n_regs_used);
Parrot_pcc_set_sub(interp, context, SELF);
Parrot_pcc_set_continuation(interp, context, ccont);
More information about the parrot-commits
mailing list