[pypy-svn] r67666 - pypy/trunk/pypy/jit/metainterp/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Sep 14 11:19:04 CEST 2009
Author: cfbolz
Date: Mon Sep 14 11:19:03 2009
New Revision: 67666
Modified:
pypy/trunk/pypy/jit/metainterp/test/test_basic.py
Log:
Instantiating a class dynamically produces an indirect_call that the JIT cannot
look into at all. This is the reason why user-class instances in the Python
interpreter can never be virtual.
Modified: pypy/trunk/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_basic.py Mon Sep 14 11:19:03 2009
@@ -620,6 +620,30 @@
res = self.interp_operations(f, [13])
assert res == 72
+ @py.test.mark.xfail
+ def test_instantiate_does_not_call(self):
+ mydriver = JitDriver(reds = ['n', 'x'], greens = [])
+ class Base: pass
+ class A(Base): foo = 72
+ class B(Base): foo = 8
+
+ def f(n):
+ x = 0
+ while n > 0:
+ mydriver.can_enter_jit(n=n, x=x)
+ mydriver.jit_merge_point(n=n, x=x)
+ if n % 2 == 0:
+ cls = A
+ else:
+ cls = B
+ inst = cls()
+ x += inst.foo
+ n -= 1
+ return
+ res = self.meta_interp(f, [20])
+ assert res == f(20)
+ self.check_loops(call=0)
+
def test_zerodivisionerror(self):
# test the case of exception-raising operation that is not delegated
# to the backend at all: ZeroDivisionError
More information about the Pypy-commit
mailing list