Author: Armin Rigo <[email protected]>
Branch:
Changeset: r44297:d9715c8e37eb
Date: 2011-05-19 11:14 +0200
http://bitbucket.org/pypy/pypy/changeset/d9715c8e37eb/
Log: A test that passes. (Not trying to find a bug, rather trying to re-
understand how this test can possibly pass :-)
diff --git a/pypy/jit/metainterp/test/test_virtualref.py
b/pypy/jit/metainterp/test/test_virtualref.py
--- a/pypy/jit/metainterp/test/test_virtualref.py
+++ b/pypy/jit/metainterp/test/test_virtualref.py
@@ -512,6 +512,42 @@
assert res == main(10, 2)
self.check_aborted_count(0)
+ def test_alloc_virtualref_and_then_alloc_structure(self):
+ myjitdriver = JitDriver(greens = [], reds = ['n'])
+ #
+ class XY:
+ pass
+ class ExCtx:
+ pass
+ exctx = ExCtx()
+ @dont_look_inside
+ def escapexy(xy):
+ print 'escapexy:', xy.n
+ if xy.n % 5 == 0:
+ vr = exctx.vr
+ print 'accessing via vr:', vr()
+ assert vr() is xy
+ #
+ def f(n):
+ while n > 0:
+ myjitdriver.jit_merge_point(n=n)
+ xy = XY()
+ xy.n = n
+ vr = virtual_ref(xy)
+ # force the virtualref to be allocated
+ exctx.vr = vr
+ # force xy to be allocated
+ escapexy(xy)
+ # clean up
+ exctx.vr = vref_None
+ virtual_ref_finish(xy)
+ n -= 1
+ return 1
+ #
+ res = self.meta_interp(f, [15])
+ assert res == 1
+ self.check_loops(new_with_vtable=2) # vref, xy
+
class TestLLtype(VRefTests, LLJitMixin):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit