Skip to content

Commit

Permalink
[pcc] allow Parrot_pcc_invoke_from_sig_object to take a PMC that isa …
Browse files Browse the repository at this point in the history
…Sub or does invokable

git-svn-id: https://svn.parrot.org/parrot/trunk@42131 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
NotFound authored and NotFound committed Oct 26, 2009
1 parent e937569 commit b558256
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions src/call/pcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ Parrot_pcc_invoke_method_from_c_args(PARROT_INTERP, ARGIN(PMC* pmc),

/*
=item C<static int is_invokable(PARROT_INTERP, PMC *sub_obj)>
Check if the PMC is a Sub or does invokable. Helper for do_run_ops.
=cut
*/

PARROT_INLINE
static int
is_invokable(PARROT_INTERP, ARGIN(PMC*sub_obj)) /* HEADERIZER SKIP */
{
if (VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Sub")))
return 1;
else
return VTABLE_does(interp, sub_obj, CONST_STRING(interp, "invokable"));
}

/*
=item C<static int do_run_ops(PARROT_INTERP, PMC *sub_obj)>
Check should we run ops.
Expand All @@ -213,27 +233,20 @@ PIR Subs need runops to run their opcodes. Methods and NCI subs don't.
=cut
*/

static int
do_run_ops(PARROT_INTERP, ARGIN(PMC *sub_obj))
{
ASSERT_ARGS(do_run_ops)
if (!PMC_IS_NULL(interp->current_object))
return 0;

if (sub_obj->vtable->base_type == enum_class_Sub
|| sub_obj->vtable->base_type == enum_class_MultiSub
|| sub_obj->vtable->base_type == enum_class_Eval)
return 1;

/* No more core PMC to run ops */
if (sub_obj->vtable->base_type < enum_class_core_max)
return 0;

/* But we can have inherited */
if (VTABLE_isa(interp, sub_obj, CONST_STRING(interp, "Sub")))
return 1;

return 0;
return sub_obj->vtable->base_type == enum_class_Sub
|| sub_obj->vtable->base_type == enum_class_MultiSub
|| sub_obj->vtable->base_type == enum_class_Eval;
else
return is_invokable(interp, sub_obj);
}

/*
Expand Down

0 comments on commit b558256

Please sign in to comment.