[svn:parrot] r43021 - in branches/context_unify3/src: call pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Dec 12 19:51:25 UTC 2009
Author: bacek
Date: Sat Dec 12 19:51:25 2009
New Revision: 43021
URL: https://trac.parrot.org/parrot/changeset/43021
Log:
First naive try to avoid creating of many useless CallContext objetcs
Modified:
branches/context_unify3/src/call/pcc.c
branches/context_unify3/src/pmc/sub.pmc
Modified: branches/context_unify3/src/call/pcc.c
==============================================================================
--- branches/context_unify3/src/call/pcc.c Sat Dec 12 19:51:05 2009 (r43020)
+++ branches/context_unify3/src/call/pcc.c Sat Dec 12 19:51:25 2009 (r43021)
@@ -273,14 +273,16 @@
ASSERT_ARGS(Parrot_pcc_invoke_from_sig_object)
opcode_t *dest;
- INTVAL n_regs_used[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
- PMC *ctx = Parrot_push_context(interp, n_regs_used);
+ PMC *ctx = call_object;
PMC * const ret_cont = new_ret_continuation_pmc(interp, NULL);
- Parrot_pcc_set_signature(interp, ctx, call_object);
+ 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;
+ CURRENT_CONTEXT(interp) = ctx;
/* Invoke the function */
dest = VTABLE_invoke(interp, sub_obj, NULL);
Modified: branches/context_unify3/src/pmc/sub.pmc
==============================================================================
--- branches/context_unify3/src/pmc/sub.pmc Sat Dec 12 19:51:05 2009 (r43020)
+++ branches/context_unify3/src/pmc/sub.pmc Sat Dec 12 19:51:25 2009 (r43021)
@@ -376,7 +376,6 @@
*
*/
pc = sub->seg->base.data + sub->start_offs;
- caller_ctx = CURRENT_CONTEXT(interp);
ccont = INTERP->current_cont;
INTERP->current_cont = NULL;
@@ -387,7 +386,8 @@
/* plain subroutine call
* create new context, place it in interpreter */
- context = Parrot_set_new_context(INTERP, sub->n_regs_used);
+ 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);
Parrot_pcc_set_constants(interp, context, sub->seg->const_table->constants);
@@ -481,8 +481,8 @@
Parrot_pcc_dec_recursion_depth(INTERP, context);
PObj_get_FLAGS(ccont) &= ~SUB_FLAG_TAILCALL;
- Parrot_pcc_set_caller_ctx(interp, context,
- Parrot_pcc_get_caller_ctx(interp, caller_ctx));
+ //Parrot_pcc_set_caller_ctx(interp, context,
+ // Parrot_pcc_get_caller_ctx(interp, caller_ctx));
}
}
More information about the parrot-commits
mailing list