Skip to content

Commit

Permalink
Revert "add experimental fix for a bug found by jnthn++"
Browse files Browse the repository at this point in the history
This reverts commit ee17ddd.
  • Loading branch information
cotto committed Jun 9, 2011
1 parent 25dd6bf commit a680d04
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions src/call/pcc.c
Expand Up @@ -34,6 +34,12 @@ static int do_run_ops(PARROT_INTERP, ARGIN(PMC *sub_obj))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

PARROT_INLINE
PARROT_WARN_UNUSED_RESULT
static int is_invokable(PARROT_INTERP, ARGIN(PMC *sub_obj))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static void Parrot_pcc_add_invocant(PARROT_INTERP,
ARGIN(PMC *call_obj),
ARGIN(PMC *pmc))
Expand All @@ -44,6 +50,9 @@ static void Parrot_pcc_add_invocant(PARROT_INTERP,
#define ASSERT_ARGS_do_run_ops __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(sub_obj))
#define ASSERT_ARGS_is_invokable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(sub_obj))
#define ASSERT_ARGS_Parrot_pcc_add_invocant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(call_obj) \
Expand Down Expand Up @@ -215,6 +224,29 @@ 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
PARROT_WARN_UNUSED_RESULT
static int
is_invokable(PARROT_INTERP, ARGIN(PMC *sub_obj))
{
ASSERT_ARGS(is_invokable)

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)>
Expand All @@ -234,13 +266,17 @@ do_run_ops(PARROT_INTERP, ARGIN(PMC *sub_obj))

if (sub_obj->vtable->base_type < enum_class_core_max) {
switch (sub_obj->vtable->base_type) {
case enum_class_NCI:
case enum_class_NativePCCMethod:
return 0;
default:
case enum_class_Sub:
case enum_class_MultiSub:
case enum_class_Eval:
return 1;
case enum_class_Object:
break;
default:
return 0;
}
}
return is_invokable(interp, sub_obj);
}

/*
Expand Down

0 comments on commit a680d04

Please sign in to comment.