Author: David Schneider <david.schnei...@picle.org>
Branch: ppc-jit-backend
Changeset: r51456:7a455997891c
Date: 2012-01-18 09:48 -0800
http://bitbucket.org/pypy/pypy/changeset/7a455997891c/

Log:    (arigo, bivab) Add tests for finish and guard that check that
        fail/finish args pased to the loop on the stack are decoded as they
        should

diff --git a/pypy/jit/backend/test/runner_test.py 
b/pypy/jit/backend/test/runner_test.py
--- a/pypy/jit/backend/test/runner_test.py
+++ b/pypy/jit/backend/test/runner_test.py
@@ -3359,6 +3359,27 @@
         fail = self.cpu.execute_token(looptoken2, -9)
         assert fail.identifier == 42
 
+    def test_finish_with_long_arglist(self):
+        boxes = [BoxInt(i) for i in range(30)]
+        ops = [ResOperation(rop.FINISH, boxes, None, descr=BasicFailDescr(1))]
+        looptoken = JitCellToken()
+        self.cpu.compile_loop(boxes, ops, looptoken)
+        fail = self.cpu.execute_token(looptoken, *range(30))
+        assert fail.identifier == 1
+        for i in range(30):
+            assert self.cpu.get_latest_value_int(i) == i
+
+    def test_guard_with_long_arglist(self):
+        boxes = [BoxInt(i) for i in range(30)]
+        ops = [ResOperation(rop.GUARD_FALSE, [boxes[1]], None, 
descr=BasicFailDescr(1)),
+               ResOperation(rop.FINISH, [], None, descr=BasicFailDescr(2))]
+       ops[0].setfailargs(boxes)
+        looptoken = JitCellToken()
+        self.cpu.compile_loop(boxes, ops, looptoken)
+        fail = self.cpu.execute_token(looptoken, *range(30))
+        assert fail.identifier == 1
+        for i in range(30):
+            assert self.cpu.get_latest_value_int(i) == i
 
 class OOtypeBackendTest(BaseBackendTest):
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to