[pypy-commit] pypy default: Simplify a bit

arigo pypy.commits at gmail.com
Thu Nov 29 06:35:55 EST 2018


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r95384:ddf5bd822a68
Date: 2018-11-29 13:35 +0200
http://bitbucket.org/pypy/pypy/changeset/ddf5bd822a68/

Log:	Simplify a bit

diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -4703,7 +4703,7 @@
         assert res == f(10)
 
     def test_issue2904(self):
-        driver = JitDriver(greens=['codepos'],
+        driver = JitDriver(greens = [],
                            reds=['iterations', 'total', 'c', 'height', 'h'])
 
         class IntVal:
@@ -4714,26 +4714,20 @@
         def f(height, iterations):
             height = IntVal(height)
             c = IntVal(0)
-            h = IntVal(0)
+            h = height
             total = IntVal(0)
-            codepos = 1
 
             while True:
-                driver.jit_merge_point(codepos=codepos, iterations=iterations,
+                driver.jit_merge_point(iterations=iterations,
                         total=total, c=c, height=height, h=h)
-                if codepos == 1:
+                if h.intval > 0:
+                    h = IntVal(h.intval - 1)
+                    total = IntVal(total.intval + 1)
+                else:
+                    c = IntVal(c.intval + 1)
                     if c.intval >= iterations:
                         return total.intval
-                    else:
-                        h = height
-                        codepos = 2
-                else:
-                    if h.intval > 0:
-                        h = IntVal(h.intval - 1)
-                        total = IntVal(total.intval + 1)
-                    else:
-                        c = IntVal(c.intval + 1)
-                        codepos = 1
+                    h = height
 
         res = self.meta_interp(f, [2, 200])
         assert res == f(2, 200)


More information about the pypy-commit mailing list