Author: Carl Friedrich Bolz <[email protected]>
Branch: improve-heap-caching-tracing
Changeset: r47023:3dbbdca31951
Date: 2011-09-02 15:25 +0200
http://bitbucket.org/pypy/pypy/changeset/3dbbdca31951/

Log:    add some helpful comments

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
@@ -63,12 +63,20 @@
         self.heap_cache.setdefault(descr, {})[box] = fieldbox
 
     def setfield(self, box, descr, fieldbox):
+        # slightly subtle logic here
         d = self.heap_cache.get(descr, None)
         new_d = {box: fieldbox}
+        # a write to an arbitrary box, all other boxes can alias this one
         if not d or box not in self.new_boxes:
+            # therefore we throw away the cache
             self.heap_cache[descr] = new_d
             return
+        # the object we are writing to is freshly allocated
+        # only remove some boxes from the cache
         for frombox, tobox in d.iteritems():
+            # the other box is *also* freshly allocated
+            # therefore frombox and box *must* contain different objects
+            # thus we can keep it in the cache
             if frombox in self.new_boxes:
                 new_d[frombox] = tobox
         self.heap_cache[descr] = new_d
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to