[pypy-commit] pypy default: fix tests and improve signature

fijal noreply at buildbot.pypy.org
Thu Jul 21 10:41:23 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r45799:2c43451adecb
Date: 2011-07-21 10:41 +0200
http://bitbucket.org/pypy/pypy/changeset/2c43451adecb/

Log:	fix tests and improve signature

diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -444,12 +444,10 @@
 
     def _sliceloop1(self, start, stop, step, arr):
         storage = self.parent.storage
-        signature = Signature()
-        new_sig = self.signature.transition(signature)
         i = start
         j = 0
         while i < stop:
-            slice_driver1.jit_merge_point(signature=signature, self=self,
+            slice_driver1.jit_merge_point(signature=arr.signature, self=self,
                     step=step, stop=stop, i=i, j=j, arr=arr)
             storage[i] = arr.eval(j)
             j += 1
@@ -457,12 +455,10 @@
 
     def _sliceloop2(self, start, stop, step, arr):
         storage = self.parent.storage
-        signature = Signature()
-        new_sig = self.signature.transition(signature)
         i = start
         j = 0
         while i > stop:
-            slice_driver2.jit_merge_point(signature=signature, self=self,
+            slice_driver2.jit_merge_point(signature=arr.signature, self=self,
                     step=step, stop=stop, i=i, j=j, arr=arr)
             storage[i] = arr.eval(j)
             j += 1
@@ -516,7 +512,7 @@
         i = start
         j = 0
         while i < stop:
-            slice_driver1.jit_merge_point(signature=self.signature, self=self,
+            slice_driver1.jit_merge_point(signature=arr.signature, self=self,
                     step=step, stop=stop, i=i, j=j, arr=arr)
             self.storage[i] = arr.eval(j)
             j += 1
@@ -526,7 +522,7 @@
         i = start
         j = 0
         while i > stop:
-            slice_driver2.jit_merge_point(signature=self.signature, self=self,
+            slice_driver2.jit_merge_point(signature=arr.signature, self=self,
                     step=step, stop=stop, i=i, j=j, arr=arr)
             self.storage[i] = arr.eval(j)
             j += 1
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
@@ -49,8 +49,6 @@
         assert result == f(5)
 
     def test_neg(self):
-        space = self.space
-
         def f(i):
             ar = SingleDimArray(i)
             v = Call1(neg, ar, Signature())
@@ -105,6 +103,7 @@
                           "float_gt": 1, "int_add": 1,
                           "int_lt": 1, "guard_true": 1, 
                           "guard_false": 1, "jump": 1})
+        assert result == f(5)
 
     def test_min(self):
         space = self.space
@@ -122,6 +121,7 @@
                            "float_lt": 1, "int_add": 1,
                            "int_lt": 1, "guard_true": 2,
                            "jump": 1})
+        assert result == f(5)
 
     def test_argmin(self):
         space = self.space
@@ -139,6 +139,7 @@
                            "float_lt": 1, "int_add": 1,
                            "int_lt": 1, "guard_true": 2,
                            "jump": 1})
+        assert result == f(5)
 
     def test_all(self):
         space = self.space
@@ -154,6 +155,7 @@
         self.check_loops({"getarrayitem_raw": 2, "float_add": 1,
                           "int_add": 1, "float_ne": 1,
                           "int_lt": 1, "guard_true": 2, "jump": 1})
+        assert result == f(5)
 
     def test_any(self):
         space = self.space
@@ -166,6 +168,7 @@
         self.check_loops({"getarrayitem_raw": 2, "float_add": 1,
                           "int_add": 1, "float_ne": 1, "guard_false": 1,
                           "int_lt": 1, "guard_true": 1, "jump": 1})
+        assert result == f(5)
 
     def test_already_forecd(self):
         def f(i):
@@ -257,7 +260,11 @@
             ar = SingleDimArray(step*i)
             ar2 = SingleDimArray(i)
             ar2.storage[1] = 5.5
-            ar.setslice(space, 0, step*i, step, i, ar2.descr_add(space, ar2))
+            if NonConstant(False):
+                arg = ar2
+            else:
+                arg = ar2.descr_add(space, ar2)
+            ar.setslice(space, 0, step*i, step, i, arg)
             return ar.get_concrete().storage[3]
 
         result = self.meta_interp(f, [5], listops=True, backendopt=True)


More information about the pypy-commit mailing list