Author: Armin Rigo <[email protected]>
Branch: heapcache-refactor
Changeset: r83101:f99d4404477b
Date: 2016-03-17 11:43 +0100
http://bitbucket.org/pypy/pypy/changeset/f99d4404477b/
Log: Test and fix for the interaction between the two families of flags
diff --git a/rpython/jit/metainterp/heapcache.py
b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -152,7 +152,7 @@
@always_inline
def test_likely_virtual_version(self, ref_frontend_op):
- return (r_uint(ref_frontend_op._heapc_version) ==
+ return (r_uint(ref_frontend_op._heapc_version) >=
self.likely_virtual_version)
def update_version(self, ref_frontend_op):
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
@@ -639,3 +639,29 @@
h._escape_box(box1)
assert not h.is_unescaped(box1)
assert not h.is_likely_virtual(box1)
+
+ def test_is_likely_virtual_2(self):
+ h = HeapCache()
+ box1 = RefFrontendOp(1)
+ h.new(box1)
+ assert h.is_unescaped(box1)
+ assert h.is_likely_virtual(box1)
+ h.reset_keep_likely_virtuals()
+ assert not h.is_unescaped(box1)
+ assert h.is_likely_virtual(box1)
+ h.reset() # reset everything
+ assert not h.is_unescaped(box1)
+ assert not h.is_likely_virtual(box1)
+
+ def test_is_likely_virtual_3(self):
+ h = HeapCache()
+ box1 = RefFrontendOp(1)
+ h.new(box1)
+ assert h.is_unescaped(box1)
+ assert h.is_likely_virtual(box1)
+ h.reset_keep_likely_virtuals()
+ assert not h.is_unescaped(box1)
+ assert h.is_likely_virtual(box1)
+ h.class_now_known(box1) # interaction of the two families of flags
+ assert not h.is_unescaped(box1)
+ assert h.is_likely_virtual(box1)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit