[svn:parrot] r43061 - in branches/context_unify3: include/parrot src/call src/ops
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Dec 15 10:26:20 UTC 2009
Author: bacek
Date: Tue Dec 15 10:26:19 2009
New Revision: 43061
URL: https://trac.parrot.org/parrot/changeset/43061
Log:
Allocate CallContext in pcc_prepare_call if it wasn't allocated before
Modified:
branches/context_unify3/include/parrot/call.h
branches/context_unify3/src/call/context.c
branches/context_unify3/src/call/pcc.c
branches/context_unify3/src/ops/core.ops
branches/context_unify3/src/ops/object.ops
Modified: branches/context_unify3/include/parrot/call.h
==============================================================================
--- branches/context_unify3/include/parrot/call.h Tue Dec 15 08:21:11 2009 (r43060)
+++ branches/context_unify3/include/parrot/call.h Tue Dec 15 10:26:19 2009 (r43061)
@@ -82,7 +82,9 @@
__attribute__nonnull__(3);
PARROT_EXPORT
-void Parrot_pcc_prepare_call(PARROT_INTERP,
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC* Parrot_pcc_prepare_call(PARROT_INTERP,
ARGIN(PMC *call_object),
ARGIN(PMC *ret_cont),
ARGIN_NULLOK(PMC *current_object))
Modified: branches/context_unify3/src/call/context.c
==============================================================================
--- branches/context_unify3/src/call/context.c Tue Dec 15 08:21:11 2009 (r43060)
+++ branches/context_unify3/src/call/context.c Tue Dec 15 10:26:19 2009 (r43061)
@@ -301,6 +301,8 @@
ASSERT_ARGS(init_context)
Parrot_Context *ctx = get_context_struct_fast(interp, pmcctx);
+ PARROT_ASSERT(!PMC_IS_NULL(pmcctx) || !"Can't initialise Null CallContext");
+
/* pmcold may be null */
Parrot_Context *old = PMC_IS_NULL(pmcold)
? NULL
Modified: branches/context_unify3/src/call/pcc.c
==============================================================================
--- branches/context_unify3/src/call/pcc.c Tue Dec 15 08:21:11 2009 (r43060)
+++ branches/context_unify3/src/call/pcc.c Tue Dec 15 10:26:19 2009 (r43061)
@@ -254,7 +254,7 @@
/*
-=item C<void Parrot_pcc_prepare_call(PARROT_INTERP, PMC *call_object, PMC
+=item C<PMC* Parrot_pcc_prepare_call(PARROT_INTERP, PMC *call_object, PMC
*ret_cont, PMC *current_object)>
Prepare and push CallContext for invoke Sub.
@@ -265,12 +265,17 @@
*/
PARROT_EXPORT
-void
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+PMC*
Parrot_pcc_prepare_call(PARROT_INTERP, ARGIN(PMC *call_object),
ARGIN(PMC *ret_cont), ARGIN_NULLOK(PMC *current_object))
{
ASSERT_ARGS(Parrot_pcc_prepare_call)
+ if (PMC_IS_NULL(call_object))
+ call_object = pmc_new(interp, enum_class_CallContext);
+
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_object);
Parrot_pcc_init_context(interp, call_object, CURRENT_CONTEXT(interp));
Parrot_pcc_set_caller_ctx(interp, call_object, CURRENT_CONTEXT(interp));
@@ -278,6 +283,8 @@
interp->current_cont = ret_cont;
interp->current_object = current_object;
CURRENT_CONTEXT(interp) = call_object;
+
+ return call_object;
}
/*
Modified: branches/context_unify3/src/ops/core.ops
==============================================================================
--- branches/context_unify3/src/ops/core.ops Tue Dec 15 08:21:11 2009 (r43060)
+++ branches/context_unify3/src/ops/core.ops Tue Dec 15 10:26:19 2009 (r43061)
@@ -429,7 +429,8 @@
opcode_t *dest = expr NEXT();
PMC *call_object = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
- Parrot_pcc_prepare_call(interp, call_object, new_ret_continuation_pmc(interp, dest), NULL);
+ call_object = Parrot_pcc_prepare_call(interp, call_object,
+ new_ret_continuation_pmc(interp, dest), NULL);
dest = VTABLE_invoke(interp, p, dest);
@@ -441,7 +442,7 @@
PMC * const p = $1;
PMC *call_object = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
- Parrot_pcc_prepare_call(interp, call_object, $2, NULL);
+ call_object = Parrot_pcc_prepare_call(interp, call_object, $2, NULL);
dest = VTABLE_invoke(interp, p, dest);
goto ADDRESS(dest);
Modified: branches/context_unify3/src/ops/object.ops
==============================================================================
--- branches/context_unify3/src/ops/object.ops Tue Dec 15 08:21:11 2009 (r43060)
+++ branches/context_unify3/src/ops/object.ops Tue Dec 15 10:26:19 2009 (r43061)
@@ -70,7 +70,8 @@
}
}
else {
- Parrot_pcc_prepare_call(interp, call_object, new_ret_continuation_pmc(interp, next), object);
+ call_object = Parrot_pcc_prepare_call(interp, call_object,
+ new_ret_continuation_pmc(interp, next), object);
dest = VTABLE_invoke(interp, method_pmc, next);
}
goto ADDRESS(dest);
@@ -81,7 +82,8 @@
opcode_t * const next = expr NEXT();
PMC * call_object = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
- Parrot_pcc_prepare_call(interp, call_object, new_ret_continuation_pmc(interp, next), $1);
+ call_object = Parrot_pcc_prepare_call(interp, call_object,
+ new_ret_continuation_pmc(interp, next), $1);
dest = VTABLE_invoke(interp, $2, next);
goto ADDRESS(dest);
@@ -103,7 +105,7 @@
VTABLE_get_string(interp, VTABLE_get_class(interp, object)));
}
else {
- Parrot_pcc_prepare_call(interp, call_object, $3, object);
+ call_object = Parrot_pcc_prepare_call(interp, call_object, $3, object);
dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
}
goto ADDRESS(dest);
@@ -117,7 +119,7 @@
opcode_t *dest;
- Parrot_pcc_prepare_call(interp, call_object, $3, object);
+ call_object = Parrot_pcc_prepare_call(interp, call_object, $3, object);
dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
goto ADDRESS(dest);
}
More information about the parrot-commits
mailing list