Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: improve-heap-caching-tracing
Changeset: r47059:38b764f137a9
Date: 2011-09-04 11:20 +0200
http://bitbucket.org/pypy/pypy/changeset/38b764f137a9/

Log:    change array cache layout

diff --git a/pypy/jit/metainterp/heapcache.py b/pypy/jit/metainterp/heapcache.py
--- a/pypy/jit/metainterp/heapcache.py
+++ b/pypy/jit/metainterp/heapcache.py
@@ -16,7 +16,7 @@
         # maps descrs to {from_box, to_box} dicts
         self.heap_cache = {}
         # heap array cache
-        # maps descrs to {index: (from_box, to_box)} dicts
+        # maps descrs to {index: {from_box: to_box}} dicts
         self.heap_array_cache = {}
 
     def invalidate_caches(self, opnum, descr):
@@ -87,9 +87,9 @@
         index = indexbox.getint()
         cache = self.heap_array_cache.get(descr, None)
         if cache:
-            frombox, tobox = cache.get(index, (None, None))
-            if frombox is box:
-                return tobox
+            indexcache = cache.get(index, None)
+            if indexcache is not None:
+                return indexcache.get(box, None)
 
     def setarrayitem(self, box, descr, indexbox, valuebox):
         if not isinstance(indexbox, ConstInt):
@@ -97,9 +97,9 @@
             if cache is not None:
                 cache.clear()
             return
+        index = indexbox.getint()
         cache = self.heap_array_cache.setdefault(descr, {})
-        index = indexbox.getint()
-        cache[index] = box, valuebox
+        cache[index] = {box: valuebox}
 
     def replace_box(self, oldbox, newbox):
         for descr, d in self.heap_cache.iteritems():
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to