[pypy-commit] pypy jit-short_from_state: test that snapshot within start_resumedescr is properly cloned before modified

hakanardo noreply at buildbot.pypy.org
Wed Jul 13 10:16:47 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r45521:6020d95d4fa7
Date: 2011-07-12 20:27 +0200
http://bitbucket.org/pypy/pypy/changeset/6020d95d4fa7/

Log:	test that snapshot within start_resumedescr is properly cloned
	before modified

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
@@ -153,8 +153,6 @@
             new_snapshot_args.append(a)
         prev = self.fix_snapshot(loop, jump_args, snapshot.prev)
         return Snapshot(prev, new_snapshot_args)
-        #snapshot.boxes = new_snapshot_args
-        #return snapshot
             
     def propagate_all_forward(self):
         loop = self.optimizer.loop
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
@@ -2758,6 +2758,32 @@
         assert res == -2
         #self.check_loops(getarrayitem_gc=0, setarrayitem_gc=0) -- xxx?
 
+    def test_continue_tracing_with_boxes_in_start_snapshot_replaced_by_optimizer(self):
+        myjitdriver = JitDriver(greens = [], reds = ['sa', 'n', 'a', 'b'])
+        def f(n):
+            sa = a = 0
+            b = 10
+            while n:
+                myjitdriver.jit_merge_point(sa=sa, n=n, a=a, b=b)
+                sa += b
+                b += 1
+                if b > 7:
+                    pass
+                if a == 0:
+                    a = 1
+                elif a == 1:
+                    a = 2
+                elif a == 2:
+                    a = 0
+                sa += a
+                sa += 0
+                n -= 1
+            return sa
+        res = self.meta_interp(f, [16])
+        assert res == f(16)
+
+
+
 class TestOOtype(BasicTests, OOJitMixin):
 
     def test_oohash(self):


More information about the pypy-commit mailing list