[svn:parrot] r42187 - in trunk: . examples/benchmarks t/benchmark

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Oct 31 13:04:27 UTC 2009


Author: bacek
Date: Sat Oct 31 13:04:23 2009
New Revision: 42187
URL: https://trac.parrot.org/parrot/changeset/42187

Log:
Rewrite examples/benchmars/oo3.pasm into pir.

Added:
   trunk/examples/benchmarks/oo3.pir
Deleted:
   trunk/examples/benchmarks/oo3.pasm
Modified:
   trunk/MANIFEST
   trunk/t/benchmark/benchmarks.t

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sat Oct 31 12:59:17 2009	(r42186)
+++ trunk/MANIFEST	Sat Oct 31 13:04:23 2009	(r42187)
@@ -596,7 +596,7 @@
 examples/benchmarks/oo2.pl                                  [examples]
 examples/benchmarks/oo2.py                                  [examples]
 examples/benchmarks/oo2.rb                                  [examples]
-examples/benchmarks/oo3.pasm                                [examples]
+examples/benchmarks/oo3.pir                                 [examples]
 examples/benchmarks/oo3.pl                                  [examples]
 examples/benchmarks/oo3.py                                  [examples]
 examples/benchmarks/oo3.rb                                  [examples]

Deleted: trunk/examples/benchmarks/oo3.pasm
==============================================================================
--- trunk/examples/benchmarks/oo3.pasm	Sat Oct 31 13:04:23 2009	(r42186)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,44 +0,0 @@
-# Copyright (C) 2004-2009, Parrot Foundation.
-# $Id$
-
-.namespace [ "Foo" ]
-
-    newclass P1, "Foo"
-    addattribute P1, ".i"
-    addattribute P1, ".j"
-
-    set I10, 0
-    set I11, 500000
-    new P3, "Foo"
-loop:
-    getattribute P2, P3, ".i"
-    new P10, 'Integer'	# x = Foo.i
-    assign P10, P2
-    getattribute P2, P3, ".j"
-    new P11, 'Integer'	# y = Foo.j
-    assign P11, P2
-    inc I10
-    lt I10, I11, loop
-
-    getattribute P2, P3, ".i"
-    print P2
-    print "\n"
-    end
-
-.pcc_sub __init:
-.include "interpinfo.pasm"
-    interpinfo P2, .INTERPINFO_CURRENT_OBJECT
-    new P10, 'Integer'
-    set P10, 10
-    setattribute P2, ".i", P10
-    inc I0
-    new P10, 'Integer'
-    set P10, 20
-    setattribute P2, ".j", P10
-    returncc
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Added: trunk/examples/benchmarks/oo3.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/examples/benchmarks/oo3.pir	Sat Oct 31 13:04:23 2009	(r42187)
@@ -0,0 +1,45 @@
+# Copyright (C) 2004-2009, Parrot Foundation.
+# $Id$
+
+.namespace [ "Foo" ]
+.sub 'main'
+    newclass $P1, "Foo"
+    addattribute $P1, ".i"
+    addattribute $P1, ".j"
+
+    $I10 = 0
+    $I11 = 500000
+    $P3  = new "Foo"
+loop:
+    getattribute $P2, $P3, ".i"
+    $P10 = new 'Integer'	# x = Foo.i
+    assign $P10, $P2
+    getattribute $P2, $P3, ".j"
+    $P11 = new 'Integer'	# y = Foo.j
+    assign $P11, $P2
+    inc $I10
+    if $I10 < $I11 goto loop
+
+    getattribute $P2, $P3, ".i"
+    print $P2
+    print "\n"
+.end
+
+.sub init :vtable
+.include "interpinfo.pasm"
+    interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+    $P10 = new 'Integer'
+    $P10 = 10
+    setattribute $P2, ".i", $P10
+    inc $I0
+    $P10 = new 'Integer'
+    $P10 = 20
+    setattribute $P2, ".j", $P10
+    .return ()
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:

Modified: trunk/t/benchmark/benchmarks.t
==============================================================================
--- trunk/t/benchmark/benchmarks.t	Sat Oct 31 12:59:17 2009	(r42186)
+++ trunk/t/benchmark/benchmarks.t	Sat Oct 31 13:04:23 2009	(r42187)
@@ -155,7 +155,7 @@
 #        M\sop\/s:\s\s\s\s\s\s\s\s\d+\.\d+\n$/x,
     q{oo1.pir}      => qq(10\n),
     q{oo2.pir}      => qq(10\n),
-    q{oo3.pasm}     => qq(10\n),
+    q{oo3.pir}      => qq(10\n),
     q{oo4.pasm}     => qq(500000\n),
     q{oo5.pir}      => qq(10\n),
     q{oo6.pir}      => qq(500000\n),


More information about the parrot-commits mailing list