[pypy-svn] r79838 - in pypy/branch/jit-unroll-loops/pypy/jit/metainterp: . test
hakanardo at codespeak.net
hakanardo at codespeak.net
Sun Dec 5 18:04:39 CET 2010
Author: hakanardo
Date: Sun Dec 5 18:04:37 2010
New Revision: 79838
Modified:
pypy/branch/jit-unroll-loops/pypy/jit/metainterp/pyjitpl.py
pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_basic.py
pypy/branch/jit-unroll-loops/pypy/jit/metainterp/warmspot.py
Log:
Always generate the full preambles, they are used as targets of the guards inlined from the short preamble
Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/pyjitpl.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/pyjitpl.py Sun Dec 5 18:04:37 2010
@@ -1849,7 +1849,7 @@
self.history.inputargs = original_boxes[num_green_args:]
greenkey = original_boxes[:num_green_args]
self.history.record(rop.JUMP, live_arg_boxes[num_green_args:], None)
- loop_token = compile.compile_new_loop(self, [], greenkey, start, False)
+ loop_token = compile.compile_new_loop(self, [], greenkey, start)
self.history.operations.pop() # remove the JUMP
if loop_token is None:
return
Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_basic.py Sun Dec 5 18:04:37 2010
@@ -1840,6 +1840,46 @@
'int_add': 1, 'int_mul': 1, 'int_sub': 2,
'int_gt': 2, 'jump': 2})
+ def test_multiple_specialied_versions_bridge(self):
+ myjitdriver = JitDriver(greens = [], reds = ['y', 'x', 'z', 'res'])
+ class Base:
+ def __init__(self, val):
+ self.val = val
+ def getval(self):
+ return self.val
+ class A(Base):
+ def binop(self, other):
+ return A(self.getval() + other.getval())
+ class B(Base):
+ def binop(self, other):
+ return B(self.getval() * other.getval())
+ def f(x, y, z):
+ res = x
+ while y > 0:
+ myjitdriver.can_enter_jit(y=y, x=x, z=z, res=res)
+ myjitdriver.jit_merge_point(y=y, x=x, z=z, res=res)
+ res = res.binop(x)
+ y -= 1
+ if y < 7:
+ x = z
+ return res
+ def g(x, y):
+ a1 = f(A(x), y, A(x))
+ a2 = f(A(x), y, A(x))
+ b1 = f(B(x), y, B(x))
+ b2 = f(B(x), y, B(x))
+ c1 = f(B(x), y, A(x))
+ c2 = f(B(x), y, A(x))
+ d1 = f(A(x), y, B(x))
+ d2 = f(A(x), y, B(x))
+ assert a1.val == a2.val
+ assert b1.val == b2.val
+ assert c1.val == c2.val
+ assert d1.val == d2.val
+ return a1.val + b1.val + c1.val + d1.val
+ res = self.meta_interp(g, [6, 14])
+ assert res == g(6, 14)
+
def test_specialied_bridge(self):
myjitdriver = JitDriver(greens = [], reds = ['y', 'x', 'res'])
class A:
Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/warmspot.py (original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/warmspot.py Sun Dec 5 18:04:37 2010
@@ -321,7 +321,7 @@
return 'DoneWithThisFrameVoid()'
class DoneWithThisFrameInt(JitException):
- def __init__(self, result):
+ def __init__(self, result):
assert lltype.typeOf(result) is lltype.Signed
self.result = result
def __str__(self):
More information about the Pypy-commit
mailing list