[pypy-commit] pypy refactor-signature: remove some int_add's

fijal noreply at buildbot.pypy.org
Thu Dec 15 09:53:56 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: refactor-signature
Changeset: r50535:cd58a567d17d
Date: 2011-12-15 10:53 +0200
http://bitbucket.org/pypy/pypy/changeset/cd58a567d17d/

Log:	remove some int_add's

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
@@ -48,13 +48,15 @@
             interp = InterpreterState(codes[i])
             interp.run(space)
             w_res = interp.results[-1]
-            if isinstance(w_res, W_NDimArray):
+            if isinstance(w_res, BaseArray):
                 concr = w_res.get_concrete()
                 sig = concr.find_sig()
-                frame = sig.create_frame(w_res)
+                frame = sig.create_frame(concr)
                 w_res = sig.eval(frame, concr)
             if isinstance(w_res, interp_boxes.W_Float64Box):
                 return w_res.value
+            if isinstance(w_res, interp_boxes.W_Int64Box):
+                return float(w_res.value)
             elif isinstance(w_res, interp_boxes.W_BoolBox):
                 return float(w_res.value)
             raise TypeError(w_res)
@@ -108,7 +110,7 @@
         result = self.run("sum")
         assert result == 2 * sum(range(30))
         self.check_simple_loop({"getinteriorfield_raw": 2, "float_add": 2,
-                                "int_add": 2, "int_ge": 1, "guard_false": 1,
+                                "int_add": 1, "int_ge": 1, "guard_false": 1,
                                 "jump": 1})
 
     def define_prod():
@@ -125,7 +127,7 @@
             expected *= i * 2
         assert result == expected
         self.check_simple_loop({"getinteriorfield_raw": 2, "float_add": 1,
-                                "float_mul": 1, "int_add": 2,
+                                "float_mul": 1, "int_add": 1,
                                 "int_ge": 1, "guard_false": 1, "jump": 1})
 
     def test_max(self):
@@ -166,7 +168,7 @@
         result = self.run("any")
         assert result == 1
         self.check_simple_loop({"getinteriorfield_raw": 2, "float_add": 1,
-                                "float_ne": 1, "int_add": 2,
+                                "float_ne": 1, "int_add": 1,
                                 "int_ge": 1, "jump": 1,
                                 "guard_false": 2})
 
@@ -206,7 +208,7 @@
         result = self.run("ufunc")
         assert result == -6
         self.check_simple_loop({"getinteriorfield_raw": 2, "float_add": 1, "float_neg": 1,
-                                "setinteriorfield_raw": 1, "int_add": 3,
+                                "setinteriorfield_raw": 1, "int_add": 2,
                                 "int_ge": 1, "guard_false": 1, "jump": 1})
 
     def define_specialization():


More information about the pypy-commit mailing list