[svn:parrot] r43068 - branches/context_unify3/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Dec 15 12:06:06 UTC 2009
Author: bacek
Date: Tue Dec 15 12:06:05 2009
New Revision: 43068
URL: https://trac.parrot.org/parrot/changeset/43068
Log:
Update Corotine.invoke to use already pushed CallContext.
Modified:
branches/context_unify3/src/pmc/coroutine.pmc
Modified: branches/context_unify3/src/pmc/coroutine.pmc
==============================================================================
--- branches/context_unify3/src/pmc/coroutine.pmc Tue Dec 15 12:05:26 2009 (r43067)
+++ branches/context_unify3/src/pmc/coroutine.pmc Tue Dec 15 12:06:05 2009 (r43068)
@@ -143,8 +143,8 @@
print_sub_name(INTERP, SELF);
if (PMC_IS_NULL(co->ctx)) {
- PMC * const caller_ctx = CURRENT_CONTEXT(interp);
- PMC *ctx;
+ PMC * ctx = CURRENT_CONTEXT(interp);
+ PMC * const caller_ctx = Parrot_pcc_get_caller_ctx(INTERP, ctx);
PMC *ccont = INTERP->current_cont;
if (ccont == NEED_CONTINUATION)
@@ -154,9 +154,7 @@
Parrot_ex_throw_from_c_args(INTERP, NULL, CONTROL_ERROR,
"tail call to coro not allowed");
- /* first time set current sub, cont, object */
- ctx = Parrot_set_new_context(INTERP, co->n_regs_used);
-
+ Parrot_pcc_allocate_registers(interp, ctx, co->n_regs_used);
co->ctx = ctx;
PARROT_CONTINUATION(ccont)->from_ctx = ctx;
@@ -182,8 +180,9 @@
/* if calling the Coro we need the segment of the Coro */
else if (!(PObj_get_FLAGS(SELF) & SUB_FLAG_CORO_FF)) {
- PMC * const ctx = co->ctx;
- PMC * const ccont = Parrot_pcc_get_continuation(INTERP, ctx);
+ PMC * const ctx = co->ctx;
+ PMC * const caller_ctx = Parrot_pcc_get_caller_ctx(INTERP, ctx);
+ PMC * const ccont = Parrot_pcc_get_continuation(INTERP, ctx);
PObj_get_FLAGS(SELF) |= SUB_FLAG_CORO_FF;
wanted_seg = co->seg;
@@ -192,8 +191,7 @@
co->caller_seg = INTERP->code;
/* and the recent call context */
- PARROT_CONTINUATION(ccont)->to_ctx = CURRENT_CONTEXT(interp);
- Parrot_pcc_set_caller_ctx(interp, ctx, CURRENT_CONTEXT(interp));
+ PARROT_CONTINUATION(ccont)->to_ctx = caller_ctx;
/* set context to coro context */
CURRENT_CONTEXT(interp) = ctx;
More information about the parrot-commits
mailing list