[svn:parrot] r44949 - branches/pcc_hackathon_6Mar10/src/call
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Mon Mar 15 21:45:44 UTC 2010
Author: chromatic
Date: Mon Mar 15 21:45:42 2010
New Revision: 44949
URL: https://trac.parrot.org/parrot/changeset/44949
Log:
[PCC] Added static Parrot_pcc_add_invocant() function to call only when
necessary, rather than relying on the state of interp->current_object which was
frequently wrong.
Modified:
branches/pcc_hackathon_6Mar10/src/call/pcc.c
Modified: branches/pcc_hackathon_6Mar10/src/call/pcc.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/call/pcc.c Mon Mar 15 20:04:43 2010 (r44948)
+++ branches/pcc_hackathon_6Mar10/src/call/pcc.c Mon Mar 15 21:45:42 2010 (r44949)
@@ -35,9 +35,20 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+static void Parrot_pcc_add_invocant(PARROT_INTERP,
+ ARGIN(PMC *call_obj),
+ ARGIN(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
#define ASSERT_ARGS_do_run_ops __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) \
+ , PARROT_ASSERT_ARG(pmc))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -166,6 +177,28 @@
Parrot_pcc_invoke_from_sig_object(interp, sub_obj, sig_obj);
}
+
+/*
+
+=item C<void Parrot_pcc_add_invocant(PARROT_INTERP, PMC *call_obj, PMC *pmc)>
+
+Adds the given PMC as an invocant to the given CallContext PMC. You should
+never have to use this, and it should go away with interp->current_object.
+
+*/
+
+static void
+Parrot_pcc_add_invocant(PARROT_INTERP, ARGIN(PMC *call_obj), ARGIN(PMC *pmc))
+{
+ ASSERT_ARGS(Parrot_pcc_add_invocant)
+ PMC *arg_flags;
+ GETATTR_CallContext_arg_flags(interp, call_obj, arg_flags);
+
+ VTABLE_unshift_integer(interp, arg_flags,
+ PARROT_ARG_PMC | PARROT_ARG_INVOCANT);
+ VTABLE_unshift_pmc(interp, call_obj, pmc);
+}
+
/*
=item C<void Parrot_pcc_invoke_method_from_c_args(PARROT_INTERP, PMC* pmc,
@@ -195,10 +228,10 @@
char *arg_sig, *ret_sig;
Parrot_pcc_split_signature_string(interp, signature, &arg_sig, &ret_sig);
- interp->current_object = pmc;
-
va_start(args, signature);
call_obj = Parrot_pcc_build_call_from_varargs(interp, PMCNULL, arg_sig, &args);
+ Parrot_pcc_add_invocant(interp, call_obj, pmc);
+
Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_obj);
/* Find the subroutine object as a named method on pmc */
@@ -214,9 +247,9 @@
Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
PARROT_ERRORS_RESULT_COUNT_FLAG);
va_end(args);
-
}
+
/*
=item C<static int is_invokable(PARROT_INTERP, PMC *sub_obj)>
More information about the parrot-commits
mailing list