[pypy-commit] pypy default: Passing test with two unrelated virtualizables
arigo
noreply at buildbot.pypy.org
Thu Jul 31 12:13:02 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72622:b1e750df0a3e
Date: 2014-07-31 12:12 +0200
http://bitbucket.org/pypy/pypy/changeset/b1e750df0a3e/
Log: Passing test with two unrelated virtualizables
diff --git a/rpython/jit/metainterp/test/test_virtualizable.py b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -1611,6 +1611,40 @@
op.getopnum() == rop.GUARD_NOT_FORCED_2]
assert len(l) == 0
+ def test_two_virtualizable_types(self):
+ class A:
+ _virtualizable_ = ['x']
+ def __init__(self, x):
+ self.x = x
+
+ class B:
+ _virtualizable_ = ['lst[*]']
+ def __init__(self, lst):
+ self.lst = lst
+
+ driver_a = JitDriver(greens=[], reds=['a'], virtualizables=['a'])
+ driver_b = JitDriver(greens=[], reds=['b'], virtualizables=['b'])
+
+ def foo_a(a):
+ while a.x > 0:
+ driver_a.jit_merge_point(a=a)
+ a.x -= 2
+ return a.x
+
+ def foo_b(b):
+ while b.lst[0] > 0:
+ driver_b.jit_merge_point(b=b)
+ b.lst[0] -= 2
+ return b.lst[0]
+
+ def f():
+ return foo_a(A(13)) * 100 + foo_b(B([13]))
+
+ assert f() == -101
+ res = self.meta_interp(f, [], listops=True)
+ assert res == -101
+
+
class TestLLtype(ExplicitVirtualizableTests,
ImplicitVirtualizableTests,
LLJitMixin):
More information about the pypy-commit
mailing list