Author: Armin Rigo <[email protected]>
Branch:
Changeset: r72086:e2b1cc741f76
Date: 2014-06-17 10:01 +0200
http://bitbucket.org/pypy/pypy/changeset/e2b1cc741f76/
Log: Fix the test
diff --git a/rpython/jit/metainterp/test/test_heapcache.py
b/rpython/jit/metainterp/test/test_heapcache.py
--- a/rpython/jit/metainterp/test/test_heapcache.py
+++ b/rpython/jit/metainterp/test/test_heapcache.py
@@ -1,6 +1,6 @@
from rpython.jit.metainterp.heapcache import HeapCache
from rpython.jit.metainterp.resoperation import rop
-from rpython.jit.metainterp.history import ConstInt, BoxInt
+from rpython.jit.metainterp.history import ConstInt, BoxInt, BasicFailDescr
box1 = "box1"
box2 = "box2"
@@ -550,7 +550,7 @@
assert h.is_unescaped(box2)
assert h.getfield(box1, descr1) is box2
- def test_bug_heap_cache_is_cleared_but_not_is_unescaped(self):
+ def test_bug_heap_cache_is_cleared_but_not_is_unescaped_1(self):
# bug if only the getfield() link is cleared (heap_cache) but not
# the is_unescaped() flags: we can do later a GETFIELD(box1) which
# will give us a fresh box3, which is actually equal to box2. This
@@ -564,6 +564,27 @@
h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2])
assert h.getfield(box1, descr1) is box2
h.invalidate_caches(rop.CALL_MAY_FORCE, None, [])
+ assert not h.is_unescaped(box1)
+ assert not h.is_unescaped(box2)
+ assert h.getfield(box1, descr1) is None
+
+ def test_bug_heap_cache_is_cleared_but_not_is_unescaped_2(self):
+ h = HeapCache()
+ h.new(box1)
+ h.new(box2)
+ h.setfield(box1, box2, descr1)
+ h.invalidate_caches(rop.SETFIELD_GC, None, [box1, box2])
+ assert h.getfield(box1, descr1) is box2
+ descr = BasicFailDescr()
+ class XTra:
+ oopspecindex = 0
+ OS_ARRAYCOPY = 42
+ extraeffect = 5
+ EF_LOOPINVARIANT = 1
+ EF_ELIDABLE_CANNOT_RAISE = 2
+ EF_ELIDABLE_CAN_RAISE = 3
+ descr.get_extra_info = XTra
+ h.invalidate_caches(rop.CALL, descr, [])
assert h.is_unescaped(box1)
assert h.is_unescaped(box2)
assert h.getfield(box1, descr1) is box2
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit