cvsuser     04/09/09 11:45:45

  Modified:    classes  delegate.pmc
               config/gen/makefiles root.in
               lib/Parrot Pmc2c.pm
               src      inter_misc.c library.c objects.c pmc.c string.c
  Log:
  turn more constant strings into CONST_STRINGs, hopefully for a bit of
  memory and speed savings
  
  Revision  Changes    Path
  1.30      +2 -21     parrot/classes/delegate.pmc
  
  Index: delegate.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/classes/delegate.pmc,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -w -r1.29 -r1.30
  --- delegate.pmc      7 Sep 2004 12:18:42 -0000       1.29
  +++ delegate.pmc      9 Sep 2004 18:45:37 -0000       1.30
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2003 The Perl Foundation.  All Rights Reserved.
  -$Id: delegate.pmc,v 1.29 2004/09/07 12:18:42 leo Exp $
  +$Id: delegate.pmc,v 1.30 2004/09/09 18:45:37 dan Exp $
   
   =head1 NAME
   
  @@ -35,6 +35,7 @@
   
   
   #include "parrot/parrot.h"
  +#include "delegate.str"
   #include <assert.h>
   
   
  @@ -151,15 +152,7 @@
   
   =item C<void init()>
   
  -Calls the delegated C<__init()> method if it exists.
  -
  -=item C<PMC* new_extended()>
  -
  -Calls the delegated C<__new_extended> method if it exists.
  -
  -XXX Actually the PMC compiler should emit different code, if a method is
  -present in classes/default.pmc. Some defaulted methods like this one have
  -useful defaults and don't throw exceptiions.
  +Calls the delegated C<init()> method.
   
   =cut
   
  @@ -176,18 +169,6 @@
       void destroy() {
           /* don't delegate destroy */
       }
  -
  -    PMC* new_extended() {
  -        STRING *meth = const_string(interpreter,
  -                PARROT_VTABLE_NEW_EXTENDED_METHNAME );
  -        PMC *sub = find_meth(interpreter, SELF, meth);
  -        if (PMC_IS_NULL(sub)) {
  -            /* run default fallback that constructs an empty object */
  -            return SUPER();
  -        }
  -        return (PMC*) Parrot_run_meth_fromc_args_save(interpreter, sub,
  -                pmc, meth, "P");
  -    }
   }
   
   /*
  
  
  
  1.235     +8 -3      parrot/config/gen/makefiles/root.in
  
  Index: root.in
  ===================================================================
  RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
  retrieving revision 1.234
  retrieving revision 1.235
  diff -u -w -r1.234 -r1.235
  --- root.in   2 Sep 2004 00:44:45 -0000       1.234
  +++ root.in   9 Sep 2004 18:45:39 -0000       1.235
  @@ -1,4 +1,4 @@
  -# $Id: root.in,v 1.234 2004/09/02 00:44:45 dan Exp $
  +# $Id: root.in,v 1.235 2004/09/09 18:45:39 dan Exp $
   
   ###############################################################################
   #
  @@ -430,8 +430,12 @@
   
   STR_FILES = \
       $(SRC)/inter_cb.str \
  +    $(SRC)/inter_misc.str \
  +    $(SRC)/library.str \
  +    $(SRC)/pmc.str \
       $(SRC)/py_func.str \
  -    $(SRC)/objects.str
  +    $(SRC)/objects.str \
  +    classes/delegate.str
   
   $(INC)/string_private_cstring.h : $(STR_FILES) build_tools/c2str.pl
        $(PERL) build_tools/c2str.pl --all
  @@ -790,7 +794,8 @@
   $(SRC)/inter_cb$(O) : $(SRC)/inter_cb.c $(GENERAL_H_FILES) \
       $(SRC)/inter_cb.str
   
  -$(SRC)/inter_misc$(O) : $(SRC)/inter_misc.c $(GENERAL_H_FILES)
  +$(SRC)/inter_misc$(O) : $(SRC)/inter_misc.c $(GENERAL_H_FILES) \
  +    $(SRC)/inter_misc.src
   
   $(SRC)/inter_create$(O) : $(SRC)/inter_create.c $(GENERAL_H_FILES)
   
  
  
  
  1.40      +2 -2      parrot/lib/Parrot/Pmc2c.pm
  
  Index: Pmc2c.pm
  ===================================================================
  RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -w -r1.39 -r1.40
  --- Pmc2c.pm  8 Sep 2004 00:33:55 -0000       1.39
  +++ Pmc2c.pm  9 Sep 2004 18:45:43 -0000       1.40
  @@ -1,5 +1,5 @@
   # Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  -# $Id: Pmc2c.pm,v 1.39 2004/09/08 00:33:55 dan Exp $
  +# $Id: Pmc2c.pm,v 1.40 2004/09/09 18:45:43 dan Exp $
   
   =head1 NAME
   
  @@ -167,7 +167,7 @@
   EOC
       foreach my $class (@classes) {
           $cout .= <<"EOC";
  -    whoami = string_from_const_cstring(interpreter, "$class", 0);
  +    whoami = string_from_cstring(interpreter, "$class", 0);
       type${class} = pmc_register(interpreter, whoami);
   EOC
       }
  @@ -1328,7 +1328,7 @@
   $l
   ${decl} {
       $ret_def
  -    STRING *meth = string_from_cstring(interpreter, $delegate_meth, 0);
  +    STRING *meth = CONST_STRING(interpreter, "__$meth");
       PMC *sub = find_or_die(interpreter, pmc, meth);
       ${func_ret}Parrot_run_meth_fromc_args_save$ret_type(interpreter, sub,
           pmc, meth, "$sig"$arg);
  
  
  
  1.9       +3 -2      parrot/src/inter_misc.c
  
  Index: inter_misc.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/inter_misc.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -w -r1.8 -r1.9
  --- inter_misc.c      8 Sep 2004 00:33:58 -0000       1.8
  +++ inter_misc.c      9 Sep 2004 18:45:44 -0000       1.9
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: inter_misc.c,v 1.8 2004/09/08 00:33:58 dan Exp $
  +$Id: inter_misc.c,v 1.9 2004/09/09 18:45:44 dan Exp $
   
   =head1 NAME
   
  @@ -21,6 +21,7 @@
   
   #include <assert.h>
   #include "parrot/parrot.h"
  +#include "inter_misc.str"
   
   /*
   
  @@ -121,7 +122,7 @@
       VTABLE_set_pmc_keyed_str(interpreter, hash, type, nci);
       /* build native call interface fir the C sub in "func" */
       VTABLE_set_pointer_keyed_str(interpreter, nci,
  -                                 string_from_const_cstring(interpreter, "pIt", 0), 
func);
  +                                 CONST_STRING(interpreter, "pIt"), func);
   }
   
   
  @@ -292,7 +293,7 @@
       case CPU_ARCH:
       case CPU_TYPE:
       default:
  -        return string_from_cstring(interpreter, "", 0);
  +        return CONST_STRING(interpreter, "");
       }
   }
   /*
  
  
  
  1.7       +3 -2      parrot/src/library.c
  
  Index: library.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/library.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- library.c 8 Sep 2004 00:33:58 -0000       1.6
  +++ library.c 9 Sep 2004 18:45:44 -0000       1.7
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  -$Id: library.c,v 1.6 2004/09/08 00:33:58 dan Exp $
  +$Id: library.c,v 1.7 2004/09/09 18:45:44 dan Exp $
   
   =head1 NAME
   
  @@ -20,6 +20,7 @@
   
   #include "parrot/parrot.h"
   #include <assert.h>
  +#include "library.str"
   
   /*
   
  @@ -72,7 +73,7 @@
       name = string_from_cstring(interpreter, func_name, strlen(func_name));
       
       /* get the sub pmc */
  -    str = string_from_cstring(interpreter, "_parrotlib", 10 );
  +    str = CONST_STRING(interpreter, "_parrotlib");
       sub = Parrot_find_global(interpreter, str, name);
       if (!sub) {
           interpreter->resume_flag = resume;
  @@ -81,7 +82,7 @@
       }
   
       /* get the signature */
  -    str = string_from_cstring(interpreter, "signature", 9 );
  +    str = CONST_STRING(interpreter, "signature");
       prop = VTABLE_getprop(interpreter, sub, str);
       if (!prop) {
           interpreter->resume_flag = resume;
  
  
  
  1.117     +2 -2      parrot/src/objects.c
  
  Index: objects.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/objects.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -w -r1.116 -r1.117
  --- objects.c 8 Sep 2004 00:33:58 -0000       1.116
  +++ objects.c 9 Sep 2004 18:45:44 -0000       1.117
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: objects.c,v 1.116 2004/09/08 00:33:58 dan Exp $
  +$Id: objects.c,v 1.117 2004/09/09 18:45:44 dan Exp $
   
   =head1 NAME
   
  @@ -639,7 +639,7 @@
           /* no method found and no BUILD property set? */
           if (!meth && meth_str == NULL) {
               /* use __init as fallback constructor method, if it exists */
  -            meth_str = string_from_cstring(interpreter, "__init", 6);
  +            meth_str = CONST_STRING(interpreter, "__init");
               meth = Parrot_find_method_with_cache(interpreter,
                       parent_class, meth_str);
               default_meth = 1;
  @@ -665,7 +665,7 @@
       /* no method found and no BUILD property set? */
       if (!meth && meth_str == NULL) {
           /* use __init as fallback constructor method, if it exists */
  -        meth_str = string_from_cstring(interpreter, "__init", 6);
  +        meth_str = CONST_STRING(interpreter, "__init");
           meth = Parrot_find_method_with_cache(interpreter, class, meth_str);
           default_meth = 1;
       }
  
  
  
  1.89      +2 -1      parrot/src/pmc.c
  
  Index: pmc.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/pmc.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -w -r1.88 -r1.89
  --- pmc.c     8 Sep 2004 00:33:58 -0000       1.88
  +++ pmc.c     9 Sep 2004 18:45:44 -0000       1.89
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: pmc.c,v 1.88 2004/09/08 00:33:58 dan Exp $
  +$Id: pmc.c,v 1.89 2004/09/09 18:45:44 dan Exp $
   
   =head1 NAME
   
  @@ -18,6 +18,7 @@
   
   #include "parrot/parrot.h"
   #include <assert.h>
  +#include "pmc.str"
   
   static PMC* get_new_pmc_header(Parrot_Interp, INTVAL base_type, UINTVAL flags);
   
  @@ -460,7 +461,7 @@
           if (pos >= (INTVAL)string_length(interpreter, vtable->isa_str))
               break;
           len = string_str_index(interpreter, vtable->isa_str,
  -                               string_from_const_cstring(interpreter, " ", 1), pos);
  +                               CONST_STRING(interpreter, " "), pos);
           if (len == -1)
               break;
           class_name = string_substr(interpreter, vtable->isa_str, pos,
  
  
  
  1.220     +1 -1      parrot/src/string.c
  
  Index: string.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/string.c,v
  retrieving revision 1.219
  retrieving revision 1.220
  diff -u -w -r1.219 -r1.220
  --- string.c  8 Sep 2004 00:33:58 -0000       1.219
  +++ string.c  9 Sep 2004 18:45:44 -0000       1.220
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: string.c,v 1.219 2004/09/08 00:33:58 dan Exp $
  +$Id: string.c,v 1.220 2004/09/09 18:45:44 dan Exp $
   
   =head1 NAME
   
  @@ -648,7 +648,7 @@
   {
       return string_make(interpreter, buffer, len ? len :
               buffer ? strlen(buffer) : 0,
  -                       "iso-8859-1", PObj_external_FLAG); /* make this utf-8 
eventually? */
  +                       "iso-8859-1", 0); /* make this utf-8 eventually? */
   }
   
   /*
  
  
  

Reply via email to