[svn:parrot] r45382 - in trunk: include/parrot src
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Fri Apr 2 15:16:57 UTC 2010
Author: NotFound
Date: Fri Apr 2 15:16:57 2010
New Revision: 45382
URL: https://trac.parrot.org/parrot/changeset/45382
Log:
new function Parrot_pmc_new_constant_init_int, use it in mmd_build_type_tuple_from_type_list
Modified:
trunk/include/parrot/pmc.h
trunk/src/multidispatch.c
trunk/src/pmc.c
Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h Fri Apr 2 13:55:19 2010 (r45381)
+++ trunk/include/parrot/pmc.h Fri Apr 2 15:16:57 2010 (r45382)
@@ -76,6 +76,13 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
+PMC * Parrot_pmc_new_constant_init_int(PARROT_INTERP,
+ INTVAL base_type,
+ INTVAL init)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
PMC * Parrot_pmc_new_constant_noinit(PARROT_INTERP, INTVAL base_type)
__attribute__nonnull__(1);
@@ -176,6 +183,9 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_pmc_new_constant_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_pmc_new_constant_init_int \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_pmc_new_constant_noinit \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c Fri Apr 2 13:55:19 2010 (r45381)
+++ trunk/src/multidispatch.c Fri Apr 2 15:16:57 2010 (r45382)
@@ -391,12 +391,11 @@
mmd_build_type_tuple_from_type_list(PARROT_INTERP, ARGIN(PMC *type_list))
{
ASSERT_ARGS(mmd_build_type_tuple_from_type_list)
- PMC *multi_sig = Parrot_pmc_new_constant(interp, enum_class_FixedIntegerArray);
INTVAL param_count = VTABLE_elements(interp, type_list);
+ PMC *multi_sig = Parrot_pmc_new_constant_init_int(interp,
+ enum_class_FixedIntegerArray, param_count);
INTVAL i;
- VTABLE_set_integer_native(interp, multi_sig, param_count);
-
for (i = 0; i < param_count; i++) {
STRING *type_name = VTABLE_get_string_keyed_int(interp, type_list, i);
INTVAL type;
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c Fri Apr 2 13:55:19 2010 (r45381)
+++ trunk/src/pmc.c Fri Apr 2 15:16:57 2010 (r45382)
@@ -623,6 +623,30 @@
/*
+=item C<PMC * Parrot_pmc_new_constant_init_int(PARROT_INTERP, INTVAL base_type,
+INTVAL init)>
+
+As C<Parrot_pmc_new_constant>, but passes C<init> to the PMC's C<init_int> vtable
+entry.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PMC *
+Parrot_pmc_new_constant_init_int(PARROT_INTERP, INTVAL base_type, INTVAL init)
+{
+ ASSERT_ARGS(Parrot_pmc_new_constant_init_int)
+ PMC * const pmc = get_new_pmc_header(interp, base_type, PObj_constant_FLAG);
+ VTABLE_init_int(interp, pmc, init);
+ return pmc;
+}
+
+
+/*
+
=item C<PMC * Parrot_pmc_new_temporary(PARROT_INTERP, INTVAL base_type)>
Creates a new temporary PMC of type C<base_type>, then call C<init>. Cannot
More information about the parrot-commits
mailing list