[svn:parrot] r48320 - trunk/src/call

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed Aug 4 16:30:16 UTC 2010


Author: chromatic
Date: Wed Aug  4 16:30:15 2010
New Revision: 48320
URL: https://trac.parrot.org/parrot/changeset/48320

Log:
[PCC] Added positionals presizing to fill_args.

Avoiding reallocation is useful here.  Perhaps this is a good use for
init_pmc_int?

Modified:
   trunk/src/call/args.c

Modified: trunk/src/call/args.c
==============================================================================
--- trunk/src/call/args.c	Wed Aug  4 16:30:13 2010	(r48319)
+++ trunk/src/call/args.c	Wed Aug  4 16:30:15 2010	(r48320)
@@ -758,7 +758,6 @@
 
     GETATTR_FixedIntegerArray_size(interp, raw_sig, param_count);
 
-
     /* A null call object is fine if there are no arguments and no returns. */
     if (PMC_IS_NULL(call_object)) {
         if (param_count > 0 && err_check)
@@ -818,6 +817,7 @@
          * arguments into an array.*/
         if (param_flags & PARROT_ARG_SLURPY_ARRAY) {
             PMC *collect_positional;
+            int  j;
 
             /* Can't handle named slurpy here, go to named argument handling */
             if (param_flags & PARROT_ARG_NAME)
@@ -830,9 +830,11 @@
 
             collect_positional = Parrot_pmc_new(interp,
                 Parrot_get_ctx_HLL_type(interp, enum_class_ResizablePMCArray));
+            VTABLE_set_integer_native(interp, collect_positional,
+                positional_args - arg_index);
 
-            for (; arg_index < positional_args; ++arg_index) {
-                VTABLE_push_pmc(interp, collect_positional,
+            for (j = 0; arg_index < positional_args; ++arg_index) {
+                VTABLE_set_pmc_keyed_int(interp, collect_positional, j++,
                     VTABLE_get_pmc_keyed_int(interp, call_object, arg_index));
             }
 


More information about the parrot-commits mailing list