[pypy-svn] r36545 - pypy/dist/pypy/jit/timeshifter/test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Jan 12 11:55:58 CET 2007
Author: pedronis
Date: Fri Jan 12 11:55:56 2007
New Revision: 36545
Modified:
pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
Log:
(arre, pedronis)
new test about virtualizable used across residual calls
Modified: pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py
==============================================================================
--- pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py (original)
+++ pypy/dist/pypy/jit/timeshifter/test/test_virtualizable.py Fri Jan 12 11:55:56 2007
@@ -512,3 +512,54 @@
res = self.timeshift_from_portal(main, f, [0, 21],
policy=StopAtGPolicy())
assert res == 42
+
+ def test_explicit_residual_red_call(self):
+ py.test.skip("WIP")
+
+ def g(e):
+ xy = e.xy
+ xy_access = xy.access
+ if xy_access:
+ y = xy_access.get_y(xy)
+ else:
+ y = xy.y
+ e.w = y
+
+ def f(e):
+ xy = e.xy
+ xy_access = xy.access
+ if xy_access:
+ y = xy_access.get_y(xy)
+ else:
+ y = xy.y
+ xy_access = xy.access
+ newy = 2*y
+ if xy_access:
+ xy_access.set_y(xy, newy)
+ else:
+ xy.y = newy
+ g(e)
+ return xy.x
+
+ def main(x, y):
+ xy = lltype.malloc(XY)
+ xy.access = lltype.nullptr(XY_ACCESS)
+ xy.x = x
+ xy.y = y
+ e = lltype.malloc(E)
+ e.xy = xy
+ v = f(e)
+ return v+e.w
+
+
+ class StopAtGPolicy(HintAnnotatorPolicy):
+ novirtualcontainer = True
+
+ def look_inside_graph(self, graph):
+ if graph.name == 'g':
+ return False
+ return True
+
+ res = self.timeshift_from_portal(main, f, [2, 20],
+ policy=StopAtGPolicy())
+ assert res == 42
More information about the Pypy-commit
mailing list