Carl Friedrich Bolz committed 3dbbdca

add some helpful comments

  • Participants
  • Parent commits 604e55d
  • Branches improve-heap-caching-tracing

Comments (0)

Files changed (1)

File pypy/jit/metainterp/

         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
+        # 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