Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r88638:4d39cedda3a1
Date: 2016-11-24 14:58 +0100
http://bitbucket.org/pypy/pypy/changeset/4d39cedda3a1/

Log:    passing test for exceptions raised by cond_call_value

diff --git a/rpython/jit/metainterp/test/test_call.py 
b/rpython/jit/metainterp/test/test_call.py
--- a/rpython/jit/metainterp/test/test_call.py
+++ b/rpython/jit/metainterp/test/test_call.py
@@ -276,6 +276,28 @@
         res = self.meta_interp(f, [21, 5, 0])
         assert res == -1
 
+    def test_cond_call_raises(self):
+        myjitdriver = jit.JitDriver(greens = [], reds = ['n', 'p', 'm'])
+        def externfn(x, m):
+            if m == 1 or m == 1008:
+                raise ValueError
+            return x + m
+        def f(n, m, p):
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n, p=p, m=m)
+                myjitdriver.jit_merge_point(n=n, p=p, m=m)
+                try:
+                    p = jit.conditional_call_elidable(p, externfn, n, m)
+                    p -= (n + m)   # => zero again
+                except ValueError:
+                    m += 1000
+                m += 1
+                n -= 2
+            return n * m
+        assert f(21, 0, 0) == -2011
+        res = self.meta_interp(f, [21, 0, 0])
+        assert res == -2011
+
 
 class TestCall(LLJitMixin, CallTest):
     pass
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to