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

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Oct 31 12:59:18 UTC 2009


Author: bacek
Date: Sat Oct 31 12:59:17 2009
New Revision: 42186
URL: https://trac.parrot.org/parrot/changeset/42186

Log:
Rewrite examples/benchmarks/oo2.pasm into pir. Closes #1166

Added:
   trunk/examples/benchmarks/oo2.pir
      - copied, changed from r42185, trunk/examples/benchmarks/oo2.pasm
Deleted:
   trunk/examples/benchmarks/oo2.pasm
Modified:
   trunk/MANIFEST
   trunk/t/benchmark/benchmarks.t

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sat Oct 31 12:58:50 2009	(r42185)
+++ trunk/MANIFEST	Sat Oct 31 12:59:17 2009	(r42186)
@@ -592,7 +592,7 @@
 examples/benchmarks/oo1.pl                                  [examples]
 examples/benchmarks/oo1.py                                  [examples]
 examples/benchmarks/oo1.rb                                  [examples]
-examples/benchmarks/oo2.pasm                                [examples]
+examples/benchmarks/oo2.pir                                 [examples]
 examples/benchmarks/oo2.pl                                  [examples]
 examples/benchmarks/oo2.py                                  [examples]
 examples/benchmarks/oo2.rb                                  [examples]

Deleted: trunk/examples/benchmarks/oo2.pasm
==============================================================================
--- trunk/examples/benchmarks/oo2.pasm	Sat Oct 31 12:59:17 2009	(r42185)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,61 +0,0 @@
-# Copyright (C) 2004-2009, Parrot Foundation.
-# $Id$
-
-# all timings Athlon 800, gcc 2.95.2
-
-# parrot SVN-HEAD
-# perl 5.8.0
-# python 2.3.3
-
-# perl oo2.pl                                 4.0
-# python oo2.py                               2.9 (first time)
-# python oo2.py                               2.4
-
-# parrot -R cgp oo2.pasm            -g           -O3
-#   with reuse regsave mem                    6.15
-# anchor P1                                   6.7
-# Dan's new object layout                     5.1
-
-# parrot -R jit oo2.pasm            -g           -O3
-#   with reuse regsave mem                    6.1
-# anchor P1                                   6.5
-# Dan's new object layout                     4.9
-
-# parrot -R cgp oo2-prop.pasm                     2.8
-# parrot -R jit oo2-prop.pasm                     2.6
-
-.namespace [ "Foo" ]
-
-    newclass P1, "Foo"
-    addattribute P1, ".i"
-    addattribute P1, ".j"
-
-    set I10, 0
-    set I11, 50000
-loop:
-    new P3, "Foo"
-    inc I10
-    lt I10, I11, loop
-
-    new P3, "Foo"
-    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
-    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:

Copied and modified: trunk/examples/benchmarks/oo2.pir (from r42185, trunk/examples/benchmarks/oo2.pasm)
==============================================================================
--- trunk/examples/benchmarks/oo2.pasm	Sat Oct 31 12:58:50 2009	(r42185, copy source)
+++ trunk/examples/benchmarks/oo2.pir	Sat Oct 31 12:59:17 2009	(r42186)
@@ -25,34 +25,35 @@
 # parrot -R jit oo2-prop.pasm                     2.6
 
 .namespace [ "Foo" ]
+.sub 'main'
+    newclass $P1, "Foo"
+    addattribute $P1, ".i"
+    addattribute $P1, ".j"
 
-    newclass P1, "Foo"
-    addattribute P1, ".i"
-    addattribute P1, ".j"
-
-    set I10, 0
-    set I11, 50000
+    $I10 = 0
+    $I11 = 50000
 loop:
-    new P3, "Foo"
-    inc I10
-    lt I10, I11, loop
-
-    new P3, "Foo"
-    getattribute P2, P3, ".i"
-    print P2
+    new $P3, "Foo"
+    inc $I10
+    if $I10 < $I11 goto loop
+
+    new $P3, "Foo"
+    getattribute $P2, $P3, ".i"
+    print $P2
     print "\n"
-    end
+.end
 
-.pcc_sub __init:
+.sub 'init' :vtable
 .include "interpinfo.pasm"
-    interpinfo P2, .INTERPINFO_CURRENT_OBJECT
-    new P10, 'Integer'
-    set P10, 10
-    setattribute P2, ".i", P10
-    new P10, 'Integer'
-    set P10, 20
-    setattribute P2, ".j", P10
-    returncc
+    interpinfo $P2, .INTERPINFO_CURRENT_OBJECT
+    $P10 = new 'Integer'
+    $P10 = 10
+    setattribute $P2, ".i", $P10
+    $P10 = new 'Integer'
+    $P10 = 20
+    setattribute $P2, ".j", $P10
+    .return ()
+.end
 
 # Local Variables:
 #   mode: pir

Modified: trunk/t/benchmark/benchmarks.t
==============================================================================
--- trunk/t/benchmark/benchmarks.t	Sat Oct 31 12:58:50 2009	(r42185)
+++ trunk/t/benchmark/benchmarks.t	Sat Oct 31 12:59:17 2009	(r42186)
@@ -154,7 +154,7 @@
 #        Elapsed\stime:\s\s\d+\.\d+\n
 #        M\sop\/s:\s\s\s\s\s\s\s\s\d+\.\d+\n$/x,
     q{oo1.pir}      => qq(10\n),
-    q{oo2.pasm}     => qq(10\n),
+    q{oo2.pir}      => qq(10\n),
     q{oo3.pasm}     => qq(10\n),
     q{oo4.pasm}     => qq(500000\n),
     q{oo5.pir}      => qq(10\n),


More information about the parrot-commits mailing list