[pypy-svn] r52796 - pypy/branch/jit-hotpath/pypy/jit/rainbow/test
arigo at codespeak.net
arigo at codespeak.net
Fri Mar 21 11:06:38 CET 2008
Author: arigo
Date: Fri Mar 21 11:06:36 2008
New Revision: 52796
Modified:
pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py
Log:
Argh! All these tests are testing something else that what
was originally intended in test_virtualizable. The remaining
tests have the same issue: the portal is the wrong function
(it should be f(), not main()).
Modified: pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py (original)
+++ pypy/branch/jit-hotpath/pypy/jit/rainbow/test/test_hp_virtualizable.py Fri Mar 21 11:06:36 2008
@@ -128,11 +128,7 @@
greens = []
reds = ['i', 'tot', 'xy']
- def main(x, y):
- xy = lltype.malloc(XY)
- xy.vable_access = lltype.nullptr(XY_ACCESS)
- xy.x = x
- xy.y = y
+ def f(xy):
tot = 0
i = 1024
while i:
@@ -144,6 +140,13 @@
MyJitDriver.can_enter_jit(tot=tot, i=i, xy=xy)
return tot
+ def main(x, y):
+ xy = lltype.malloc(XY)
+ xy.vable_access = lltype.nullptr(XY_ACCESS)
+ xy.x = x
+ xy.y = y
+ return f(xy)
+
res = self.run(main, [20, 22], 2, policy=P_OOPSPEC)
assert res == 42 * 11
self.check_insns_in_loops(getfield=0)
@@ -161,12 +164,7 @@
greens = []
reds = ['i', 'tot', 'xy']
-
- def main(x, y):
- xy = lltype.malloc(XY)
- xy.vable_access = lltype.nullptr(XY_ACCESS)
- xy.x = x
- xy.y = y
+ def f(xy):
tot = 0
i = 1024
while i:
@@ -179,6 +177,13 @@
MyJitDriver.can_enter_jit(tot=tot, i=i, xy=xy)
return tot
+ def main(x, y):
+ xy = lltype.malloc(XY)
+ xy.vable_access = lltype.nullptr(XY_ACCESS)
+ xy.x = x
+ xy.y = y
+ return f(xy)
+
res = self.run(main, [20, 22], 2, policy=P_OOPSPEC)
assert res == 21 * 11
self.check_insns_in_loops(getfield=0)
@@ -195,28 +200,29 @@
reds = ['i', 'tot', 'xy']
def f(xy):
- x = xy_get_x(xy)
- xy_set_y(xy, 3)
- y = xy_get_y(xy)
- return x+y
-
- def main(x, y):
- xy = lltype.malloc(XY)
- xy.vable_access = lltype.nullptr(XY_ACCESS)
- xy.x = x
- xy.y = y
tot = 0
i = 1024
while i:
i >>= 1
- v = f(xy)
- tot += v + xy.y
+ x = xy_get_x(xy)
+ xy_set_y(xy, i)
+ y = xy_get_y(xy)
+ v = x + y
+ tot += v
MyJitDriver.jit_merge_point(tot=tot, i=i, xy=xy)
MyJitDriver.can_enter_jit(tot=tot, i=i, xy=xy)
return tot
+ def main(x, y):
+ xy = lltype.malloc(XY)
+ xy.vable_access = lltype.nullptr(XY_ACCESS)
+ xy.x = x
+ xy.y = y
+ v = f(xy)
+ return v + xy.y
+
res = self.run(main, [20, 22], 2)
- assert res == 26 * 11
+ assert res == main(20, 22)
self.check_insns_in_loops(getfield=0)
if self.on_llgraph:
residual_graph = self.get_residual_graph()
@@ -229,11 +235,16 @@
class MyJitDriver(JitDriver):
greens = []
reds = ['i', 'xy', 'e']
-
+
def f(e, xy):
- xy_set_y(xy, xy_get_y(xy) + 3)
- e.xy = xy
- return 0
+ i = 1024
+ while i:
+ i >>= 1
+ xy_set_y(xy, xy_get_y(xy) + 3)
+ e.xy = xy
+ MyJitDriver.jit_merge_point(i=i, xy=xy, e=e)
+ MyJitDriver.can_enter_jit(i=i, xy=xy, e=e)
+ return e.xy.y
def main(x, y):
xy = lltype.malloc(XY)
@@ -241,13 +252,8 @@
xy.x = x
xy.y = y
e = lltype.malloc(E)
- i = 1024
- while i:
- i >>= 1
- f(e, xy)
- MyJitDriver.jit_merge_point(i=i, xy=xy, e=e)
- MyJitDriver.can_enter_jit(i=i, xy=xy, e=e)
- return e.xy.y
+ f(e, xy)
+ return e.xy.x+e.xy.y
res = self.run(main, [20, 22], 2)
assert res == main(20, 22)
More information about the Pypy-commit
mailing list