[svn:parrot] r46368 - in branches/codestring: . config/auto/zlib include/parrot ports/fedora/2.3.0 ports/suse/2.2.0 runtime/parrot/library runtime/parrot/library/Getopt runtime/parrot/library/PGE runtime/parrot/library/Test runtime/parrot/library/Test/Builder src/interp src/pmc src/runcore t/pmc t/src tools/dev

coke at svn.parrot.org coke at svn.parrot.org
Thu May 6 16:27:02 UTC 2010


Author: coke
Date: Thu May  6 16:27:01 2010
New Revision: 46368
URL: https://trac.parrot.org/parrot/changeset/46368

Log:
merge latest from trunk

Modified:
   branches/codestring/   (props changed)
   branches/codestring/MANIFEST.generated
   branches/codestring/config/auto/zlib/   (props changed)
   branches/codestring/include/parrot/runcore_trace.h   (props changed)
   branches/codestring/ports/fedora/2.3.0/   (props changed)
   branches/codestring/ports/suse/2.2.0/   (props changed)
   branches/codestring/runtime/parrot/library/Getopt/Obj.pir
   branches/codestring/runtime/parrot/library/PGE/Dumper.pir
   branches/codestring/runtime/parrot/library/Test/Builder.pir
   branches/codestring/runtime/parrot/library/Test/Builder/Test.pir
   branches/codestring/runtime/parrot/library/Test/More.pir
   branches/codestring/runtime/parrot/library/parrotlib.pir
   branches/codestring/src/interp/inter_create.c   (props changed)
   branches/codestring/src/pmc/stringbuilder.pmc
   branches/codestring/src/runcore/cores.c   (props changed)
   branches/codestring/src/runcore/trace.c   (props changed)
   branches/codestring/t/pmc/stringbuilder.t
   branches/codestring/t/src/embed.t   (props changed)
   branches/codestring/tools/dev/mk_gitignore.pl   (props changed)

Modified: branches/codestring/MANIFEST.generated
==============================================================================
--- branches/codestring/MANIFEST.generated	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/MANIFEST.generated	Thu May  6 16:27:01 2010	(r46368)
@@ -84,6 +84,7 @@
 include/pmc/pmc_nci.h                            [devel]include
 include/pmc/pmc_null.h                           [devel]include
 include/pmc/pmc_object.h                         [devel]include
+include/pmc/pmc_opcode.h                         [devel]include
 include/pmc/pmc_oplib.h                          [devel]include
 include/pmc/pmc_orderedhash.h                    [devel]include
 include/pmc/pmc_orderedhashiterator.h            [devel]include

Modified: branches/codestring/runtime/parrot/library/Getopt/Obj.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/Getopt/Obj.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/Getopt/Obj.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -413,8 +413,8 @@
     if type == 'f' goto flt
     $P0 = new 'Exception'
     $S0 = "Unknown specs option '"
-    $S0 .= type
-    $S0 .= "'"
+    $S0 = $S0 . type
+    $S0 = $S0 . "'"
     $P0 = $S0
     throw $P0
 
@@ -506,8 +506,8 @@
     if $I0 goto finish
     $P0 = new 'Exception'
     $S0 = "Option '"
-    $S0 .= key
-    $S0 .= "' not in specs"
+    $S0 = $S0 . key
+    $S0 = $S0 . "' not in specs"
     $P0 = $S0
     throw $P0
 finish:
@@ -558,8 +558,8 @@
 
     $P0 = new 'Exception'
     $S0 = "Missing a required argument for option '"
-    $S0 .= arg
-    $S0 .= "'"
+    $S0 = $S0 . arg
+    $S0 = $S0 . "'"
     $P0 = $S0
     throw $P0
 .end

Modified: branches/codestring/runtime/parrot/library/PGE/Dumper.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/PGE/Dumper.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/PGE/Dumper.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -112,8 +112,10 @@
     if has_b1 goto start
     b1 = "["
   start:
-    .local string out
-    out = concat prefix, ':'
+    .local pmc out
+    out = new ['StringBuilder']
+    out = prefix
+    out .= ':'
     unless self goto subpats
     out .= ' <'
     $S0 = self
@@ -136,8 +138,8 @@
     unless spi < spc goto subrules
     prefix1 = concat prefix, b1
     $S0 = spi
-    concat prefix1, $S0
-    concat prefix1, b2
+    prefix1 = concat prefix1, $S0
+    prefix1 = concat prefix1, b2
     $I0 = defined capt[spi]
     unless $I0 goto subpats_2
     $P0 = capt[spi]
@@ -154,8 +156,8 @@
     unless it goto end
     $S0 = shift it
     prefix1 = concat prefix, '<'
-    concat prefix1, $S0
-    concat prefix1, ">"
+    prefix1 = concat prefix1, $S0
+    prefix1 = concat prefix1, ">"
     $I0 = defined capt[$S0]
     unless $I0 goto subrules_1
     $P0 = capt[$S0]
@@ -178,8 +180,8 @@
     $P1 = $P0[$I0]
     prefix2 = concat prefix1, b1
     $S0 = $I0
-    concat prefix2, $S0
-    concat prefix2, b2
+    prefix2 = concat prefix2, $S0
+    prefix2 = concat prefix2, b2
     $S0 = $P1.'dump_str'(prefix2, b1, b2)
     out .= $S0
     inc $I0
@@ -195,7 +197,8 @@
     local_return jmpstack
 
   end:
-    .return (out)
+    $S0 = out
+    .return ($S0)
 .end
 
 

Modified: branches/codestring/runtime/parrot/library/Test/Builder.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/Test/Builder.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/Test/Builder.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -493,7 +493,8 @@
     .local pmc output
     output   = self.'output'()
 
-    .local string bail_out
+    .local pmc bail_out
+    bail_out = new ['StringBuilder']
     bail_out = 'Bail out!'
 
     unless has_reason goto WRITE_REASON

Modified: branches/codestring/runtime/parrot/library/Test/Builder/Test.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/Test/Builder/Test.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/Test/Builder/Test.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -231,7 +231,7 @@
     concat report, 'ok '
     concat report, number_string
 
-    unless description goto REPORT
+    unless desc_string goto REPORT
 
     concat report, ' - '
     concat report, desc_string

Modified: branches/codestring/runtime/parrot/library/Test/More.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/Test/More.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/Test/More.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -560,7 +560,8 @@
     .param int have_desc   :opt_flag
 
     .local int    result
-    .local string diagnosis
+    .local pmc diagnosis
+    diagnosis = new ['StringBuilder']
 
     .local pmc position
     position = new 'ResizablePMCArray'
@@ -660,16 +661,21 @@
     r_count = r_array
     if l_count == r_count goto compare_contents
 
-    .local string l_count_string
-    .local string r_count_string
-    l_count_string  = l_count
+    .local pmc l_count_string
+    .local pmc r_count_string
+    l_count_string  = new ['StringBuilder']
+    r_count_string  = new ['StringBuilder']
+
+    $S0 = l_count
+    l_count_string  = $S0
     l_count_string .= ' element'
 
     if l_count == 1 goto pluralization_done
     l_count_string .= 's'
 
   pluralization_done:
-    r_count_string  = r_count
+    $S0 = r_count
+    r_count_string  = $S0
 
     push position, l_count_string
     push position, r_count_string
@@ -733,16 +739,21 @@
     r_count = r_hash
     if l_count == r_count goto compare_contents
 
-    .local string l_count_string
-    .local string r_count_string
-    l_count_string  = l_count
+    .local pmc l_count_string
+    .local pmc r_count_string
+    l_count_string  = new ['StringBuilder']
+    r_count_string  = new ['StringBuilder']
+
+    $S0 = l_count
+    l_count_string  = $S0
     l_count_string .= ' element'
 
     if l_count == 1 goto pluralization_done
     l_count_string .= 's'
 
   pluralization_done:
-    r_count_string  = r_count
+    $S0 = r_count
+    r_count_string  = $S0
 
     push position, l_count_string
     push position, r_count_string
@@ -1166,7 +1177,9 @@
     .param string description :optional
 
     .local pmc test
-    .local string diagnostic
+    .local pmc diagnostic
+    diagnostic = new ['StringBuilder']
+
     get_hll_global test, [ 'Test'; 'More' ], '_test'
     $I0 = index target, text
     $I0 = isne $I0, -1
@@ -1206,7 +1219,8 @@
     load_bytecode "PGE/Util.pbc"
     p6rule_compile = compreg "PGE::Perl6Regex"
 
-    .local string diagnostic
+    .local pmc diagnostic
+    diagnostic = new ['StringBuilder']
     .local int pass
     pass = 0
 
@@ -1320,12 +1334,17 @@
     .local pmc test
     get_hll_global test, [ 'Test'; 'More' ], '_test'
 
-    .local string description, diagnostic
+    .local pmc description
+    .local pmc diagnostic
+    description = new ['StringBuilder']
+    diagnostic  = new ['StringBuilder']
+
     description = "The object"
     unless got_name goto keep_default
     description = object_name
   keep_default:
-    diagnostic = description
+    $S0 = description
+    diagnostic = $S0
     description .= " isa "
     $S0 = class_name
     description .= $S0
@@ -1346,14 +1365,16 @@
 .sub _make_diagnostic
     .param string received
     .param string expected
-    .local string diagnostic
+    .local pmc diagnostic
 
+    diagnostic  = new ['StringBuilder']
     diagnostic  = 'Have: '
     diagnostic .= received
     diagnostic .= "\nWant: "
     diagnostic .= expected
 
-    .return( diagnostic )
+    $S0 = diagnostic
+    .return( $S0 )
 .end
 
 =back

Modified: branches/codestring/runtime/parrot/library/parrotlib.pir
==============================================================================
--- branches/codestring/runtime/parrot/library/parrotlib.pir	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/runtime/parrot/library/parrotlib.pir	Thu May  6 16:27:01 2010	(r46368)
@@ -36,8 +36,7 @@
 OKAY:
 
     # XXX: get include paths from config
-    $S0 = clone root
-    concat $S0, "/include"
+    $S0 = concat root, "/include"
     paths = new 'ResizableStringArray'
     push paths, "."
     push paths, $S0
@@ -55,7 +54,7 @@
     $P1 = clone $P0
     $P2 = new 'String'
     $S0 = shift paths
-    concat $S0, "/"
+    $S0 = concat $S0, "/"
     $P2 = $S0
     setprop $P1, "path", $P2
     push includes, $P1
@@ -134,25 +133,21 @@
     stat $I0, name, 0
     if $I0 goto END
 
-    name = clone request
-    concat name, ext
+    name = concat request, ext
     stat $I0, name, 0
     if $I0 goto END
 
-    name = "runtime/parrot/dynext/"
-    concat name, request
+    name = concat "runtime/parrot/dynext/", request
     stat $I0, name, 0
     if $I0 goto END
 
-    name = "runtime/parrot/dynext/"
-    concat name, request
-    concat name, ext
+    name = concat "runtime/parrot/dynext/", request
+    name = concat name, ext
     stat $I0, name, 0
     if $I0 goto END
 
     # file not found, give the OS a chance to locate it
-    name = clone request
-    concat name, ext
+    name = concat request, ext
 
 END:
     .begin_return
@@ -191,8 +186,7 @@
     getprop $P0, "path", $P1
     path = $P0
 
-    $S0 = clone path
-    concat $S0, name
+    $S0 = concat path, name
     stat $I0, $S0, 0
     if $I0 goto OK
     null $S0

Modified: branches/codestring/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/codestring/src/pmc/stringbuilder.pmc	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/src/pmc/stringbuilder.pmc	Thu May  6 16:27:01 2010	(r46368)
@@ -166,9 +166,9 @@
 
 /*
 
-=item C<VTABLE i_concatenate_str()
+=item C<VTABLE i_concatenate_str()>
 
-=item C<VTABLE i_concatenate()
+=item C<VTABLE i_concatenate()>
 
 Append string. Synonym for push_string
 
@@ -184,6 +184,10 @@
         SELF.push_string(VTABLE_get_string(INTERP, p));
     }
 
+    VTABLE void push_pmc(PMC *p) {
+        SELF.push_string(VTABLE_get_string(INTERP, p));
+    }
+
 /*
 
 =item C<VTABLE set_string_native()>

Modified: branches/codestring/t/pmc/stringbuilder.t
==============================================================================
--- branches/codestring/t/pmc/stringbuilder.t	Thu May  6 16:07:46 2010	(r46367)
+++ branches/codestring/t/pmc/stringbuilder.t	Thu May  6 16:27:01 2010	(r46368)
@@ -20,9 +20,10 @@
 .sub 'main' :main
     .include 'test_more.pir'
 
-    plan(17)
+    plan(21)
     test_create()               # 2 tests
     test_push_string()          # 9 tests
+    test_push_pmc()             # 4 tests
     test_push_string_unicode()  # 1 test
     test_i_concatenate()        # 1 test
     test_set_string_native()    # 3 tests
@@ -93,6 +94,26 @@
 
 .end
 
+.sub 'test_push_pmc'
+    .local pmc sb
+    sb = new ["StringBuilder"]
+
+    box $P0, "foo"
+    push sb, $P0
+    $S0 = sb
+    is( $S0, "foo", "First string pushed")
+
+    box $P0, "bar"
+    push sb, $P0
+    $S1 = sb
+    is( $S1, "foobar", "Second string pushed")
+
+    is( $S0, "foo", "... without clobbering first string")
+
+    $I0 = sb
+    is( $I0, 128, "... and capacity still 128" )
+.end
+
 .sub 'test_push_string_unicode'
     .local pmc sb
     sb = new ["StringBuilder"]


More information about the parrot-commits mailing list