[svn:parrot] r47247 - in branches/gc_massacre: lib/Parrot/Harness t/compilers/imcc/syn t/op t/pmc t/pmc/testlib

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Jun 1 09:02:55 UTC 2010


Author: bacek
Date: Tue Jun  1 09:02:54 2010
New Revision: 47247
URL: https://trac.parrot.org/parrot/changeset/47247

Log:
Merge branch 'master' into gc_massacre

Modified:
   branches/gc_massacre/lib/Parrot/Harness/DefaultTests.pm
   branches/gc_massacre/t/compilers/imcc/syn/tail.t
   branches/gc_massacre/t/op/interp.t
   branches/gc_massacre/t/pmc/addrregistry.t
   branches/gc_massacre/t/pmc/eval.t
   branches/gc_massacre/t/pmc/packfile.t
   branches/gc_massacre/t/pmc/packfileannotations.t
   branches/gc_massacre/t/pmc/resizablebooleanarray.t
   branches/gc_massacre/t/pmc/resizableintegerarray.t
   branches/gc_massacre/t/pmc/resizablepmcarray.t
   branches/gc_massacre/t/pmc/testlib/packfile_common.pir

Modified: branches/gc_massacre/lib/Parrot/Harness/DefaultTests.pm
==============================================================================
--- branches/gc_massacre/lib/Parrot/Harness/DefaultTests.pm	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/lib/Parrot/Harness/DefaultTests.pm	Tue Jun  1 09:02:54 2010	(r47247)
@@ -65,7 +65,6 @@
     t/pmc/*.t
     t/oo/*.t
     t/native_pbc/*.t
-    t/dynpmc/*.t
 );
 
 # core tests are run unless --runcore-tests is present.  Typically

Modified: branches/gc_massacre/t/compilers/imcc/syn/tail.t
==============================================================================
--- branches/gc_massacre/t/compilers/imcc/syn/tail.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/compilers/imcc/syn/tail.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -15,7 +15,6 @@
 $ENV{TEST_PROG_ARGS} = '-Oc';
 
 pir_output_is( <<'CODE', <<'OUT', "tail call optimization, final position" );
-.loadlib 'io_ops'
 
 .sub _main :main
     $P1 = new 'Integer'
@@ -57,7 +56,7 @@
     $I33 = defined function
     if $I33 goto doit
 bad_func:
-    printerr "_funcall:  Bad function.\n"
+    print "_funcall:  Bad function.\n"
     exit 0
 doit:
     set_args "0x20", argv
@@ -99,8 +98,6 @@
 
 pir_output_is( <<'CODE', <<'OUT', "tail call optimization, intermediate position" );
 
-.loadlib 'io_ops'
-
 .sub _main :main
     $P1 = new 'Integer'
     $P1 = 20
@@ -138,7 +135,7 @@
 doit:
     .tailcall function(argv :flat)
 bad_func:
-    printerr "_funcall:  Bad function.\n"
+    print "_funcall:  Bad function.\n"
     exit 0
 .end
 
@@ -175,8 +172,6 @@
 
 pir_output_is( <<'CODE', <<'OUT', "tail call optimization, implicit final return" );
 
-.loadlib 'io_ops'
-
 .sub _main :main
 
     $P1 = new 'Integer'
@@ -213,7 +208,7 @@
     $I33 = defined function
     if $I33 goto doit
 bad_func:
-    printerr "_funcall:  Bad function.\n"
+    print "_funcall:  Bad function.\n"
     exit 0
 doit:
     .tailcall function(argv :flat)
@@ -256,8 +251,6 @@
 
 pir_output_is( <<'CODE', <<'OUT', ":flatten in .return" );
 
-.loadlib 'io_ops'
-
 .sub _main :main
 
     $P1 = new 'Integer'
@@ -291,7 +284,7 @@
         print " results]\n"
     .return ($P35 :flat)
 bad_func:
-    printerr "_funcall:  Bad function.\n"
+    print "_funcall:  Bad function.\n"
     exit 0
 .end
 

Modified: branches/gc_massacre/t/op/interp.t
==============================================================================
--- branches/gc_massacre/t/op/interp.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/op/interp.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -43,13 +43,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<'OUTPUT', 'runinterp - works with printing' );
-.loadlib 'io_ops'
 .sub 'test' :main
     .local string actual
     .local pmc test_interp
                test_interp = new 'ParrotInterpreter'
-    .local pmc stdout
-               stdout = getstdout
 
     print "uno\n"
     runinterp test_interp, pasm
@@ -71,15 +68,14 @@
 # the test fail.
 pasm_output_like(
     <<'CODE', <<'OUTPUT', "restart trace" );
-    .loadlib 'io_ops'
-    printerr "ok 1\n"
+    print "ok 1\n"
     sweepoff
     set I0, 1
     trace I0
     dec I0
     trace I0
     sweepon
-    printerr "ok 2\n"
+    print "ok 2\n"
     end
 CODE
 /^ok\s1\n
@@ -91,8 +87,7 @@
 pasm_output_is( <<'CODE', 'nada:', 'interp - warnings' );
     new P0, 'Undef'
     set I0, P0
-    .loadlib 'io_ops'
-    printerr "nada:"
+    print "nada:"
     warningson 1
     new P1, 'Undef'
     set I0, P1

Modified: branches/gc_massacre/t/pmc/addrregistry.t
==============================================================================
--- branches/gc_massacre/t/pmc/addrregistry.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/addrregistry.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -19,10 +19,24 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(1)
+    plan(3)
 
     $P0 = new ['AddrRegistry']
     ok(1, 'Instantiated .AddrRegistry')
+
+    $I0 = 0
+    if $P0 goto isnotempty
+    inc $I0
+isnotempty:
+    ok($I0, 'vtable get_bool gives false when empty')
+
+    $P1 = new [ 'Integer' ]
+    $P0[0] = $P1
+    $I0 = 0
+    unless $P0 goto isempty
+    inc $I0
+isempty:
+    ok($I0, 'vtable get_bool gives true when non empty')
 .end
 
 # Local Variables:

Modified: branches/gc_massacre/t/pmc/eval.t
==============================================================================
--- branches/gc_massacre/t/pmc/eval.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/eval.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -245,21 +245,21 @@
 my (undef, $temp2_pbc) = create_tempfile( SUFFIX => '.pbc', UNLINK => 1 );
 
 pir_output_is( <<"CODE", <<'OUTPUT', "eval.get_string" );
-.loadlib 'io_ops'
 .sub main :main
 
   .local pmc f1, f2
   .local pmc io
   f1 = compi("foo_1", "hello from foo_1")
   \$S0 = f1
-  io = open "$temp_pbc", 'w'
+  io = new ['FileHandle']
+  io.'open'("$temp_pbc", 'w')
   print io, \$S0
-  close io
+  io.'close'()
   load_bytecode "$temp_pbc"
   f2 = compi("foo_2", "hello from foo_2")
-  io = open "$temp2_pbc", 'w'
+  io.'open'("$temp2_pbc", 'w')
   print io, f2
-  close io
+  io.'close'()
   load_bytecode "$temp2_pbc"
 .end
 
@@ -321,23 +321,23 @@
 close $fh;
 
 pir_output_is( <<"CODE", <<'OUTPUT', "eval.get_string - same file" );
-.loadlib 'io_ops'
 .sub main :main
   .local pmc f1, f2
   .local pmc io, os
   f1 = compi("foo_1", "hello from foo_1")
   \$S0 = f1
-  io = open "$temp_pbc", 'w'
+  io = new ['FileHandle']
+  io.'open'("$temp_pbc", 'w')
   print io, \$S0
-  close io
+  io.'close'()
   load_bytecode "$temp_pbc"
   \$P0 = loadlib 'os'
   os = new ['OS']
   os.'rm'("$temp_pbc")
   f2 = compi("foo_2", "hello from foo_2")
-  io = open "$temp_pbc", 'w'
+  io.'open'("$temp_pbc", 'w')
   print io, f2
-  close io
+  io.'close'()
   load_bytecode "$temp_pbc"
 .end
 
@@ -365,15 +365,15 @@
 my (undef, $temp_file) = create_tempfile( UNLINK => 1 );
 
 pir_output_is( <<"CODE", <<'OUTPUT', "eval.freeze" );
-.loadlib 'io_ops'
 .sub main :main
   .local pmc f, e
   .local pmc io
   f = compi("foo_1", "hello from foo_1")
   \$S0 = freeze f
-  io = open "$temp_file", 'w'
+  io = new ['FileHandle']
+  io.'open'("$temp_file", 'w')
   print io, \$S0
-  close io
+  io.'close'()
   say "written"
 .end
 
@@ -399,7 +399,6 @@
 OUTPUT
 
 pir_output_is( <<"CODE", <<'OUTPUT', "eval.thaw", todo => 'TT #1142' );
-.loadlib 'io_ops'
 .sub main :main
     .local pmc io, e
     .local string file
@@ -407,9 +406,10 @@
     file = "$temp_file"
     .include "stat.pasm"
     size = stat file, .STAT_FILESIZE
-    io = open file, 'r'
+    io = new ['FileHandle']
+    io.'open'(file, 'r')
     \$S0 = read io, size
-    close io
+    io.'close'()
     e = thaw \$S0
     sweep 1 # ensure all of the object survives GC
     e()
@@ -422,15 +422,15 @@
 OUTPUT
 
 pir_output_is( <<"CODE", <<'OUTPUT', "eval.freeze+thaw" );
-.loadlib 'io_ops'
 .sub main :main
   .local pmc f, e
   .local pmc io
   f = compi("foo_1", "hello from foo_1")
   \$S0 = freeze f
-  io = open "$temp_file", 'w'
+  io = new ['FileHandle']
+  io.'open'("$temp_file", 'w')
   print io, \$S0
-  close io
+  io.'close'()
   say "written"
   "read"()
 .end
@@ -466,9 +466,9 @@
     file = "$temp_file"
     .include "stat.pasm"
     size = stat file, .STAT_FILESIZE
-    io = open file, 'r'
+    io.'open'(file, 'r')
     \$S0 = read io, size
-    close io
+    io.'close'()
     e = thaw \$S0
     e()
     e = get_global "foo_1"

Modified: branches/gc_massacre/t/pmc/packfile.t
==============================================================================
--- branches/gc_massacre/t/pmc/packfile.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/packfile.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -298,7 +298,8 @@
     .local string filename, first
     push_eh load_error
     $S0 = '_filename'()
-    $P0 = open $S0, 'r'
+    $P0 = new ['FileHandle']
+    $P0.'open'($S0, 'r')
 
     first = $P0.'readall'()
 

Modified: branches/gc_massacre/t/pmc/packfileannotations.t
==============================================================================
--- branches/gc_massacre/t/pmc/packfileannotations.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/packfileannotations.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -41,7 +41,8 @@
     .local pmc pf
 
     push_eh load_error
-    $P0 = open 't/native_pbc/annotations.pbc'
+    $P0 = new ['FileHandle']
+    $P0.'open'('t/native_pbc/annotations.pbc', 'r')
     $P0.'encoding'('binary')
     $S0 = $P0.'readall'()
     pf = new 'Packfile'

Modified: branches/gc_massacre/t/pmc/resizablebooleanarray.t
==============================================================================
--- branches/gc_massacre/t/pmc/resizablebooleanarray.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/resizablebooleanarray.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -24,7 +24,7 @@
 
     .include 'test_more.pir'
 
-    plan(65)
+    plan(67)
 
     setting_array_size()
     setting_first_element()
@@ -70,6 +70,16 @@
 
     $P0 = 7
     is($P0, 7, "shrinking via int assignment to RBA works")
+
+    new $P1, ['ExceptionHandler']
+    set_addr $P1, caught
+    $P1.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+    push_eh $P1
+    $P0 = -1
+    ok(0, "no exception caught for setting negative size")
+    .return()
+caught:
+    ok(1, "caught exception on setting negative size")
 .end
 
 
@@ -138,6 +148,17 @@
 
     set $I0, $P0[-1]
     is($I0, 0, "negative index retrieval is 0")
+
+    new $P1, ['ExceptionHandler']
+    set_addr $P1, caught
+    $P1.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
+    push_eh $P1
+    set $I0, $P0[-2]
+    ok(0, "no exception caught for negative index out of range access")
+    .return()
+caught:
+    pop_eh
+    ok(1, "caught exception on negative index out of range access")
 .end
 
 

Modified: branches/gc_massacre/t/pmc/resizableintegerarray.t
==============================================================================
Files branches/gc_massacre/t/pmc/resizableintegerarray.t	Tue Jun  1 06:33:41 2010	(r47246) and branches/gc_massacre/t/pmc/resizableintegerarray.t	Tue Jun  1 09:02:54 2010	(r47247) differ

Modified: branches/gc_massacre/t/pmc/resizablepmcarray.t
==============================================================================
--- branches/gc_massacre/t/pmc/resizablepmcarray.t	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/resizablepmcarray.t	Tue Jun  1 09:02:54 2010	(r47247)
@@ -21,7 +21,7 @@
     .include 'fp_equality.pasm'
     .include 'test_more.pir'
 
-    plan(137)
+    plan(139)
 
     resize_tests()
     negative_array_size()
@@ -901,6 +901,24 @@
     $S0 = get_array_string($P1)
     is($S0, "12A45", "splice with empty replacement")
 
+    $P1 = clone ar1
+    $P2 = clone ar2
+    splice $P1, $P2, -3, 2
+    $S0 = get_array_string($P1)
+    is($S0, "12ABCDE5", "splice with negative offset")
+
+    $P1 = clone ar1
+    $P2 = clone ar2
+    $I0 = 1
+    push_eh too_low
+    splice $P1, $P2, -10, 2
+    dec $I0
+    goto too_low_end
+too_low:
+    .get_results($P9)
+    finalize $P9
+too_low_end:
+    ok($I0, "splice with negative offset too low")
 .end
 
 

Modified: branches/gc_massacre/t/pmc/testlib/packfile_common.pir
==============================================================================
--- branches/gc_massacre/t/pmc/testlib/packfile_common.pir	Tue Jun  1 06:33:41 2010	(r47246)
+++ branches/gc_massacre/t/pmc/testlib/packfile_common.pir	Tue Jun  1 09:02:54 2010	(r47247)
@@ -7,8 +7,6 @@
 # Currently parrot doesn't support system independent PBCs. So, cross your
 # fingers and try different filename for binary-dependent tests...
 
-.loadlib 'io_ops'
-
 .sub '_filename'
     .local string filename
     filename = 't/native_pbc/number.pbc'
@@ -22,9 +20,10 @@
     .local pmc pf, pio
     pf   = new ['Packfile']
     $S0  = '_filename'()
-    pio  = open $S0, 'r'
+    pio  = new ['FileHandle']
+    pio.'open'($S0, 'r')
     $S0  = pio.'readall'()
-    close pio
+    pio.'close'()
     pf   = $S0
     .return(pf)
 .end


More information about the parrot-commits mailing list