[pypy-commit] pypy default: Revert most of f47785c0df50, using check_simple_loop() instead.

arigo noreply at buildbot.pypy.org
Mon Nov 28 19:15:17 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49930:26e7aaccc675
Date: 2011-11-28 19:14 +0100
http://bitbucket.org/pypy/pypy/changeset/26e7aaccc675/

Log:	Revert most of f47785c0df50, using check_simple_loop() instead.

diff --git a/pypy/module/micronumpy/test/test_zjit.py b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -78,10 +78,9 @@
 
     def test_add(self):
         result = self.run("add")
-        self.check_resops({'setarrayitem_raw': 2, 'getfield_gc': 19, 'guard_class': 11,
-                           'int_add': 6, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 2,
-                           'guard_value': 1})
+        self.check_simple_loop({'getarrayitem_raw': 2, 'float_add': 1,
+                          'setarrayitem_raw': 1, 'int_add': 3,
+                          'int_ge': 1, 'guard_false': 1, 'jump': 1})
         assert result == 3 + 3
 
     def define_float_add():
@@ -93,10 +92,9 @@
     def test_floatadd(self):
         result = self.run("float_add")
         assert result == 3 + 3
-        self.check_resops({'setarrayitem_raw': 2, 'getfield_gc': 17, 'guard_class': 11,
-                           'int_add': 4, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 2, 'float_add': 2, 'guard_false': 2,
-                           'guard_value': 1})
+        self.check_simple_loop({"getarrayitem_raw": 1, "float_add": 1,
+                          "setarrayitem_raw": 1, "int_add": 2,
+                          "int_ge": 1, "guard_false": 1, "jump": 1})
 
     def define_sum():
         return """
@@ -108,9 +106,9 @@
     def test_sum(self):
         result = self.run("sum")
         assert result == 2 * sum(range(30))
-        self.check_resops({'guard_class': 10, 'getfield_gc': 17, 'jump': 2,
-                           'getarrayitem_raw': 4, 'guard_value': 2, 'int_add': 4,
-                           'guard_isnull': 1, 'int_ge': 2, 'float_add': 4, 'guard_false': 2})
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 2,
+                          "int_add": 2,
+                          "int_ge": 1, "guard_false": 1, "jump": 1})
 
     def define_prod():
         return """
@@ -125,11 +123,9 @@
         for i in range(30):
             expected *= i * 2
         assert result == expected
-        self.check_resops({'guard_class': 10, 'getfield_gc': 17, 'int_add': 4,
-                           'float_mul': 2, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 2,
-                           'guard_value': 2})
-
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 1,
+                          "float_mul": 1, "int_add": 2,
+                          "int_ge": 1, "guard_false": 1, "jump": 1})
 
     def test_max(self):
         py.test.skip("broken, investigate")
@@ -140,7 +136,7 @@
         max(b)
         """)
         assert result == 256
-        self.check_loops({"getarrayitem_raw": 2, "float_add": 1,
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 1,
                           "float_mul": 1, "int_add": 1,
                           "int_lt": 1, "guard_true": 1, "jump": 1})
 
@@ -153,10 +149,9 @@
         min(b)
         """)
         assert result == -24
-        self.check_resops({'guard_class': 10, 'getfield_gc': 15, 'guard_value': 1,
-                           'int_add': 4, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 4,
-                           'float_ne': 2})
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 1,
+                          "float_mul": 1, "int_add": 1,
+                          "int_lt": 1, "guard_true": 1, "jump": 1})
 
     def define_any():
         return """
@@ -169,10 +164,10 @@
     def test_any(self):
         result = self.run("any")
         assert result == 1
-        self.check_resops({'guard_class': 10, 'getfield_gc': 15, 'guard_value': 1,
-                           'int_add': 4, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 4,
-                           'float_ne': 2})
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 1,
+                          "float_ne": 1, "int_add": 2,
+                          "int_ge": 1, "jump": 1,
+                          "guard_false": 2})
 
     def define_already_forced():
         return """
@@ -189,13 +184,14 @@
         # This is the sum of the ops for both loops, however if you remove the
         # optimization then you end up with 2 float_adds, so we can still be
         # sure it was optimized correctly.
+        # XXX the comment above is wrong now.  We need preferrably a way to
+        # count the two loops separately
         self.check_resops({'setarrayitem_raw': 4, 'guard_nonnull': 1, 'getfield_gc': 35,
                            'guard_class': 22, 'int_add': 8, 'float_mul': 2,
                            'guard_isnull': 2, 'jump': 4, 'int_ge': 4,
                            'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 4,
                            'guard_value': 2})
 
-
     def define_ufunc():
         return """
         a = |30|
@@ -207,11 +203,10 @@
     def test_ufunc(self):
         result = self.run("ufunc")
         assert result == -6
-        self.check_resops({'setarrayitem_raw': 2, 'getfield_gc': 24, 'guard_class': 14,
-                           'int_add': 6, 'float_neg': 2, 'guard_isnull': 2, 'jump': 2,
-                           'int_ge': 2, 'getarrayitem_raw': 4, 'float_add': 2,
-                           'guard_false': 2, 'guard_value': 2})
-
+        self.check_simple_loop({"getarrayitem_raw": 2, "float_add": 1, "float_neg": 1,
+                          "setarrayitem_raw": 1, "int_add": 3,
+                          "int_ge": 1, "guard_false": 1, "jump": 1,
+        })
 
     def define_specialization():
         return """
@@ -250,7 +245,7 @@
         result = self.run("slice")
         assert result == 18
         py.test.skip("Few remaining arraylen_gc left")
-        self.check_loops({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
+        self.check_simple_loop({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
                           'setarrayitem_raw': 1, 'int_add': 3,
                           'int_lt': 1, 'guard_true': 1, 'jump': 1})
 
@@ -264,10 +259,9 @@
     def test_multidim(self):
         result = self.run('multidim')
         assert result == 8
-        self.check_resops({'setarrayitem_raw': 2, 'getfield_gc': 19, 'guard_class': 11,
-                           'int_add': 6, 'guard_isnull': 1, 'jump': 2, 'int_ge': 2,
-                           'getarrayitem_raw': 4, 'float_add': 2, 'guard_false': 2,
-                           'guard_value': 1})
+        self.check_simple_loop({'float_add': 1, 'getarrayitem_raw': 2,
+                          'guard_false': 1, 'int_add': 3, 'int_ge': 1,
+                          'jump': 1, 'setarrayitem_raw': 1})
         # int_add might be 1 here if we try slightly harder with
         # reusing indexes or some optimization
 
@@ -285,7 +279,7 @@
         py.test.skip("improve")
         # XXX the bridge here is scary. Hopefully jit-targets will fix that,
         #     otherwise it looks kind of good
-        self.check_loops({})
+        self.check_simple_loop({})
 
     def define_broadcast():
         return """
@@ -299,7 +293,7 @@
         result = self.run("broadcast")
         assert result == 10
         py.test.skip("improve")
-        self.check_loops({})
+        self.check_simple_loop({})
 
 class TestNumpyOld(LLJitMixin):
     def setup_class(cls):
@@ -327,7 +321,7 @@
             return v.get_concrete().eval(3).val
 
         result = self.meta_interp(f, [5], listops=True, backendopt=True)
-        self.check_loops({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
+        self.check_simple_loop({'int_mul': 2, 'getarrayitem_raw': 2, 'float_add': 1,
                           'setarrayitem_raw': 1, 'int_add': 1,
                           'int_lt': 1, 'guard_true': 1, 'jump': 1})
         assert result == f(5)
@@ -346,7 +340,7 @@
             return ar.get_concrete().eval(3).val
 
         result = self.meta_interp(f, [5], listops=True, backendopt=True)
-        self.check_loops({'getarrayitem_raw': 2,
+        self.check_simple_loop({'getarrayitem_raw': 2,
                           'float_add' : 1,
                           'setarrayitem_raw': 1, 'int_add': 2,
                           'int_lt': 1, 'guard_true': 1, 'jump': 1})


More information about the pypy-commit mailing list