[pypy-svn] pypy default: unsafe case
hakanardo
commits-noreply at bitbucket.org
Sun Feb 6 12:58:27 CET 2011
Author: Hakan Ardo <hakan at debian.org>
Branch:
Changeset: r41641:1c988271728b
Date: 2011-02-06 10:57 +0100
http://bitbucket.org/pypy/pypy/changeset/1c988271728b/
Log: unsafe case
diff --git a/pypy/jit/metainterp/test/test_send.py b/pypy/jit/metainterp/test/test_send.py
--- a/pypy/jit/metainterp/test/test_send.py
+++ b/pypy/jit/metainterp/test/test_send.py
@@ -361,6 +361,46 @@
else:
self.check_tree_loop_count(2)
+ def test_indirect_call_unknown_object_3(self):
+ myjitdriver = JitDriver(greens = [], reds = ['x', 'y', 'z', 'state'])
+ def getvalue2():
+ return 2
+ def getvalue25():
+ return 25
+ def getvalue1001():
+ return -1001
+
+ class State:
+ count = 0
+ def externfn(self, n):
+ assert n == 198 - self.count
+ self.count += 1
+ if n % 5:
+ return getvalue2
+ elif n % 7:
+ return getvalue25
+ else:
+ return getvalue1001
+ def f(y):
+ state = State()
+ x = z = 0
+ while y > 0:
+ myjitdriver.can_enter_jit(x=x, y=y, z=z, state=state)
+ myjitdriver.jit_merge_point(x=x, y=y, z=z, state=state)
+ x += z
+ z = state.externfn(y)()
+ y -= 1
+ return x
+ res = self.meta_interp(f, [198],
+ policy=StopAtXPolicy(State.externfn.im_func))
+ assert res == f(198)
+ # we get two TreeLoops: an initial one, and one entering from
+ # the interpreter
+ if self.optimizer != OPTIMIZER_FULL:
+ self.check_tree_loop_count(1)
+ else:
+ self.check_tree_loop_count(2)
+
def test_two_behaviors(self):
py.test.skip("XXX fix me!!!!!!! problem in optimize.py")
myjitdriver = JitDriver(greens = [], reds = ['x', 'y'])
More information about the Pypy-commit
mailing list