[svn:parrot] r38824 - in trunk: include/parrot lib/Parrot/Pmc2c src/interp

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat May 16 10:46:51 UTC 2009


Author: chromatic
Date: Sat May 16 10:46:51 2009
New Revision: 38824
URL: https://trac.parrot.org/parrot/changeset/38824

Log:
[src] Modified raw NCI registration in PMC generator to use CONST_STRINGs
instead of C strings; this removes 25% of the transient STRINGs created during
startup.  The speedup is minor, but measurable.

Modified:
   trunk/include/parrot/interpreter.h
   trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
   trunk/src/interp/inter_misc.c

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h	Sat May 16 10:45:28 2009	(r38823)
+++ trunk/include/parrot/interpreter.h	Sat May 16 10:46:51 2009	(r38824)
@@ -636,7 +636,7 @@
 void register_raw_nci_method_in_ns(PARROT_INTERP,
     const int type,
     ARGIN(void *func),
-    ARGIN(const char *name))
+    ARGIN(STRING *name))
         __attribute__nonnull__(1)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4);

Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Sat May 16 10:45:28 2009	(r38823)
+++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Sat May 16 10:46:51 2009	(r38824)
@@ -736,6 +736,7 @@
 EOC
 
     @isa = $classname unless @isa;
+
     for my $isa (@isa) {
         $cout .= <<"EOC";
             VTABLE_push_string(interp, mro, CONST_STRING_GEN(interp, "$isa"));
@@ -760,8 +761,7 @@
 
         if ( exists $method->{PCCMETHOD} ) {
             $cout .= <<"EOC";
-        register_raw_nci_method_in_ns(interp, entry,
-            F2DPTR(Parrot_${classname}_${method_name}), "$symbol_name");
+        register_raw_nci_method_in_ns(interp, entry, F2DPTR(Parrot_${classname}_${method_name}), CONST_STRING_GEN(interp, "$symbol_name"));
 EOC
         }
         else {

Modified: trunk/src/interp/inter_misc.c
==============================================================================
--- trunk/src/interp/inter_misc.c	Sat May 16 10:45:28 2009	(r38823)
+++ trunk/src/interp/inter_misc.c	Sat May 16 10:46:51 2009	(r38824)
@@ -79,19 +79,17 @@
 PARROT_EXPORT
 void
 register_raw_nci_method_in_ns(PARROT_INTERP, const int type, ARGIN(void *func),
-        ARGIN(const char *name))
+        ARGIN(STRING *name))
 {
     ASSERT_ARGS(register_raw_nci_method_in_ns)
     PMC    * const method      = pmc_new(interp, enum_class_NCI);
-    STRING * const method_name = string_make(interp, name, strlen(name),
-        NULL, PObj_constant_FLAG|PObj_external_FLAG);
 
     /* setup call func */
     VTABLE_set_pointer(interp, method, func);
 
     /* insert it into namespace */
     VTABLE_set_pmc_keyed_str(interp, interp->vtables[type]->_namespace,
-            method_name, method);
+            name, method);
 }
 
 /*


More information about the parrot-commits mailing list