[svn:parrot] r45872 - trunk/tools/dev

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed Apr 21 23:28:50 UTC 2010


Author: chromatic
Date: Wed Apr 21 23:28:50 2010
New Revision: 45872
URL: https://trac.parrot.org/parrot/changeset/45872

Log:
[tools] Fixed MSVC code generation in pbc_to_exe to avoid expensive string
concatenation (implied by TT #1572).

Modified:
   trunk/tools/dev/pbc_to_exe.pir

Modified: trunk/tools/dev/pbc_to_exe.pir
==============================================================================
--- trunk/tools/dev/pbc_to_exe.pir	Wed Apr 21 23:10:13 2010	(r45871)
+++ trunk/tools/dev/pbc_to_exe.pir	Wed Apr 21 23:28:50 2010	(r45872)
@@ -444,17 +444,16 @@
     pbc_size = $P2[7]
 
 
-    .local string codestring
-    codestring  = ''
-    codestring .= '#include <windows.h>'
-    codestring .= "\n"
-    codestring .= rc_constant_defines
-    codestring .= "const unsigned int bytecode_size = "
+    .local pmc codestring
+    codestring  = new [ 'ResizableStringArray' ]
+    push codestring, "#include <windows.h>\n"
+    push codestring, rc_constant_defines
+    push codestring, "const unsigned int bytecode_size = "
     $S0 = pbc_size
-    codestring .= $S0
-    codestring .= ";\n"
+    push codestring, $S0
+    push codestring, ";\n"
 
-    codestring .= <<'END_OF_FUNCTION'
+    push codestring, <<'END_OF_FUNCTION'
         const void * get_program_code(void)
         {
             HRSRC   hResource;
@@ -496,9 +495,10 @@
     unless status goto rc_ok
 
     die "RC command failed"
-  rc_ok:
 
-    .return (codestring)
+  rc_ok:
+    $S0 = join '', codestring
+    .return ($S0)
 
   err_h_open:
     die "cannot open .h file"


More information about the parrot-commits mailing list