[svn:parrot] r48434 - trunk/src/call
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Thu Aug 12 19:37:44 UTC 2010
Author: chromatic
Date: Thu Aug 12 19:37:44 2010
New Revision: 48434
URL: https://trac.parrot.org/parrot/changeset/48434
Log:
[PCC] Presized sigs in parse_signature_string().
This improves Rakudo startup by a modest amount.
Modified:
trunk/src/call/args.c
Modified: trunk/src/call/args.c
==============================================================================
--- trunk/src/call/args.c Thu Aug 12 12:29:57 2010 (r48433)
+++ trunk/src/call/args.c Thu Aug 12 19:37:44 2010 (r48434)
@@ -1368,10 +1368,30 @@
const char *x;
INTVAL flags = 0;
INTVAL set = 0;
+ INTVAL count = 0;
+
+ for (x = signature; *x; ++x) {
+ if (*x == '-')
+ break;
+ switch (*x) {
+ case 'I': count++; break;
+ case 'N': count++; break;
+ case 'S': count++; break;
+ case 'P': count++; break;
+ default: break;
+ }
+ }
if (PMC_IS_NULL(*arg_flags))
- *arg_flags = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
- current_array = *arg_flags;
+ current_array = *arg_flags
+ = Parrot_pmc_new_init_int(interp,
+ enum_class_ResizableIntegerArray, count);
+ else {
+ current_array = *arg_flags;
+ VTABLE_set_integer_native(interp, current_array, count);
+ }
+
+ count = 0;
for (x = signature; *x != '\0'; ++x) {
@@ -1384,7 +1404,7 @@
/* Starting a new argument, so store the previous argument,
* if there was one. */
if (set) {
- VTABLE_push_integer(interp, current_array, flags);
+ VTABLE_set_integer_keyed_int(interp, current_array, count++, flags);
set = 0;
}
@@ -1421,7 +1441,7 @@
/* Store the final argument, if there was one. */
if (set)
- VTABLE_push_integer(interp, current_array, flags);
+ VTABLE_set_integer_keyed_int(interp, current_array, count, flags);
}
/*
More information about the parrot-commits
mailing list