[pypy-commit] pypy jit-short_from_state: testcase where intbounds are kept

hakanardo noreply at buildbot.pypy.org
Mon May 16 16:20:02 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r44213:8d008fafba58
Date: 2011-05-16 14:10 +0200
http://bitbucket.org/pypy/pypy/changeset/8d008fafba58/

Log:	testcase where intbounds are kept

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
@@ -2389,7 +2389,7 @@
         assert self.meta_interp(f, [20]) == f(20)
         self.check_loops(int_gt=1, int_lt=2, int_ge=0, int_le=0)
 
-    def test_intbounds_not_generalized(self):
+    def test_intbounds_not_generalized1(self):
         myjitdriver = JitDriver(greens = [], reds = ['n', 'i', 'sa'])
 
         def f(n):
@@ -2406,6 +2406,26 @@
         assert self.meta_interp(f, [20]) == f(20)
         self.check_loops(int_gt=1, int_lt=3, int_ge=3, int_le=1)
 
+    def test_intbounds_not_generalized2(self):
+        myjitdriver = JitDriver(greens = [], reds = ['n', 'i', 'sa', 'node'])
+        class A(object):
+            def __init__(self, val):
+                self.val = val
+        def f(n):
+            sa = i = 0
+            node = A(n)
+            while i < n:
+                myjitdriver.jit_merge_point(n=n, i=i, sa=sa, node=node)
+                if i > n/2:
+                    sa += 1
+                else:
+                    sa += 2
+                    assert  -100 <= node.val <= 100
+                i += 1
+            return sa
+        assert self.meta_interp(f, [20]) == f(20)
+        self.check_loops(int_gt=1, int_lt=2, int_ge=1, int_le=1)
+
     def test_retrace_ending_up_retrazing_another_loop(self):
         # FIXME
         assert False


More information about the pypy-commit mailing list