[pypy-svn] r67109 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test
pedronis at codespeak.net
pedronis at codespeak.net
Sun Aug 23 12:48:45 CEST 2009
Author: pedronis
Date: Sun Aug 23 12:48:44 2009
New Revision: 67109
Modified:
pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py
Log:
(cfbolz, pedronis)
passing test about virtualizable virtually created in the scope of another one
Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtualizable.py Sun Aug 23 12:48:44 2009
@@ -759,6 +759,38 @@
assert direct_calls(init_graph) == []
+ def test_virtual_child_frame(self):
+ myjitdriver = JitDriver(greens = [], reds = ['frame'],
+ virtualizables = ['frame'])
+
+ class Frame(object):
+ _virtualizable2_ = ['x', 'y']
+
+ def __init__(self, x, y):
+ self = hint(self, access_directly=True)
+ self.x = x
+ self.y = y
+
+ class SomewhereElse:
+ pass
+ somewhere_else = SomewhereElse()
+
+ def f(n):
+ frame = Frame(n, 0)
+ somewhere_else.top_frame = frame # escapes
+ frame = hint(frame, access_directly=True)
+ while frame.x > 0:
+ myjitdriver.can_enter_jit(frame=frame)
+ myjitdriver.jit_merge_point(frame=frame)
+ child_frame = Frame(frame.x, 1)
+ frame.y += child_frame.x
+ frame.x -= 1
+ return somewhere_else.top_frame.y
+
+ res = self.meta_interp(f, [10])
+ assert res == 55
+ self.check_loops(new_with_vtable=0)
+
class TestOOtype(#ExplicitVirtualizableTests,
ImplicitVirtualizableTests,
OOJitMixin):
More information about the Pypy-commit
mailing list