[pypy-svn] pypy jit-short_from_state: added test_loop_variant_mul1_ovf

hakanardo commits-noreply at bitbucket.org
Wed Apr 13 21:19:27 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r43336:4b26e5e188f5
Date: 2011-04-13 21:14 +0200
http://bitbucket.org/pypy/pypy/changeset/4b26e5e188f5/

Log:	added test_loop_variant_mul1_ovf

diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -298,8 +298,7 @@
                             guard = ResOperation(rop.GUARD_NO_OVERFLOW, [], None)
                             short.append(guard)
                             # FIXME: Emit a proper guard here in case it is not
-                            #        removed by the optimizer.
-                            #        add test_loop_variant_mul1_ovf
+                            #        removed by the optimizer. Can that happen?
                             self.optimizer.send_extra_operation(guard)
                             assert self.optimizer.newoperations[-1] is not guard
                         

diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -107,6 +107,23 @@
         self.check_loop_count(1)
         self.check_loops(int_mul=1)
         
+    def test_loop_variant_mul_ovf(self):
+        myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])
+        def f(x, y):
+            res = 0
+            while y > 0:
+                myjitdriver.can_enter_jit(x=x, y=y, res=res)
+                myjitdriver.jit_merge_point(x=x, y=y, res=res)
+                res += ovfcheck(x * x)
+                x += 1
+                res += ovfcheck(x * x)
+                y -= 1
+            return res
+        res = self.meta_interp(f, [6, 7])
+        assert res == 1323
+        self.check_loop_count(1)
+        self.check_loops(int_mul_ovf=1)
+
     def test_loop_invariant_mul1(self):
         myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])
         def f(x, y):


More information about the Pypy-commit mailing list