[pypy-commit] pypy heapcache-refactor: next test

arigo pypy.commits at gmail.com
Thu Mar 17 07:32:11 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: heapcache-refactor
Changeset: r83105:da988ce66739
Date: 2016-03-17 12:29 +0100
http://bitbucket.org/pypy/pypy/changeset/da988ce66739/

Log:	next test

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
@@ -32,7 +32,7 @@
 
 class CacheEntry(object):
     def __init__(self, heapcache):
-        # both are {from_value: to_value} dicts
+        # both are {from_ref_box: to_field_box} dicts
         # the first is for boxes where we did not see the allocation, the
         # second for anything else. the reason that distinction makes sense is
         # because if we saw the allocation, we know it cannot alias with
@@ -72,9 +72,9 @@
         self._invalidate_unescaped(self.cache_seen_allocation)
 
     def _invalidate_unescaped(self, d):
-        for value in d.keys():
-            if not value.is_unescaped:
-                del d[value]
+        for ref_box in d.keys():
+            if not self.heapcache._check_flag(ref_box, HF_IS_UNESCAPED):
+                del d[ref_box]
 
 
 class FieldUpdater(object):
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
@@ -314,6 +314,9 @@
 
     def test_invalidate_cache(self):
         h = HeapCache()
+        box1 = RefFrontendOp(1)
+        box2 = RefFrontendOp(2)
+        box4 = RefFrontendOp(4)
         h.setfield(box1, box2, descr1)
         h.setarrayitem(box1, index1, box2, descr1)
         h.setarrayitem(box1, index2, box4, descr1)


More information about the pypy-commit mailing list