[pypy-svn] r47390 - pypy/dist/pypy/rpython/memory

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Oct 11 11:33:23 CEST 2007


Author: cfbolz
Date: Thu Oct 11 11:33:22 2007
New Revision: 47390

Modified:
   pypy/dist/pypy/rpython/memory/gc.py
Log:
small optimization about weakrefs: don't add the weakref object to the list of
weakrefs if it is invalidated


Modified: pypy/dist/pypy/rpython/memory/gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc.py	(original)
+++ pypy/dist/pypy/rpython/memory/gc.py	Thu Oct 11 11:33:22 2007
@@ -1115,11 +1115,9 @@
                 if self.is_forwarded(pointing_to):
                     (obj + offset).address[0] = self.get_forwarding_address(
                         pointing_to)
+                    new_with_weakref.append(obj)
                 else:
                     (obj + offset).address[0] = NULL
-            # XXX the next line can be indented? only do after weakref
-            # tests pass
-            new_with_weakref.append(obj)
         self.objects_with_weakrefs.delete()
         self.objects_with_weakrefs = new_with_weakref
         if self.run_finalizers.non_empty():
@@ -1177,7 +1175,6 @@
     def trace_and_copy(self, obj):
         gc_info = self.header(obj)
         typeid = gc_info.typeid
-##         print "scanning", obj, typeid
         offsets = self.offsets_to_gc_pointers(typeid)
         i = 0
         while i < len(offsets):



More information about the Pypy-commit mailing list