[pypy-svn] r70943 - pypy/branch/gc-huge-list/pypy/rpython/memory/gc

fijal at codespeak.net fijal at codespeak.net
Thu Jan 28 12:03:11 CET 2010


Author: fijal
Date: Thu Jan 28 12:03:10 2010
New Revision: 70943

Modified:
   pypy/branch/gc-huge-list/pypy/rpython/memory/gc/generation.py
   pypy/branch/gc-huge-list/pypy/rpython/memory/gc/hybrid.py
Log:
Try to start writebarrier_before_copy, by enumerating possibilities


Modified: pypy/branch/gc-huge-list/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/gc-huge-list/pypy/rpython/memory/gc/generation.py	(original)
+++ pypy/branch/gc-huge-list/pypy/rpython/memory/gc/generation.py	Thu Jan 28 12:03:10 2010
@@ -486,22 +486,28 @@
             objhdr.tid &= ~GCFLAG_NO_HEAP_PTRS
             self.last_generation_root_objects.append(addr_struct)
 
+    def _writebarrier_before_copy(self, source_addr, dest_addr):
+        """ A hook for hybrid gc
+        """
+        source_hdr = self.header(source_addr)
+        dest_hdr = self.header(dest_addr)
+        if source_hdr.tid & GCFLAG_NO_YOUNG_PTRS == 0:
+            # there might be an object in source that is in nursery
+            self.old_objects_pointing_to_young.append(dest_addr)
+            dest_hdr.tid &= ~GCFLAG_NO_YOUNG_PTRS
+
     def writebarrier_before_copy(self, source_addr, dest_addr):
         """ This has the same effect as calling writebarrier over
         each element in dest copied from source, except it might reset
         one of the following flags a bit too eagerly, which means we'll have
         a bit more objects to track, but being on the safe side.
         """
-        XXXX
         source_hdr = self.header(source_addr)
         dest_hdr = self.header(dest_addr)
         if dest_hdr.tid & GCFLAG_NO_YOUNG_PTRS == 0:
             return True
         # ^^^ a fast path of write-barrier
-        if source_hdr.tid & GCFLAG_NO_YOUNG_PTRS == 0:
-            # there might be an object in source that is in nursery
-            self.old_objects_pointing_to_young.append(dest_addr)
-            dest_hdr.tid &= ~GCFLAG_NO_YOUNG_PTRS
+        self._writebarrier_before_copy(source_addr, dest_addr)
         if dest_hdr.tid & GCFLAG_NO_HEAP_PTRS:
             if source_hdr.tid & GCFLAG_NO_HEAP_PTRS == 0:
                 # ^^^ equivalend of addr from source not being in last

Modified: pypy/branch/gc-huge-list/pypy/rpython/memory/gc/hybrid.py
==============================================================================
--- pypy/branch/gc-huge-list/pypy/rpython/memory/gc/hybrid.py	(original)
+++ pypy/branch/gc-huge-list/pypy/rpython/memory/gc/hybrid.py	Thu Jan 28 12:03:10 2010
@@ -675,6 +675,26 @@
             nextaddr.char[0] = chr(0)
             i += 1
 
+    def _writebarrier_before_copy(self, source_addr, dest_addr):
+        """ A hook for hybrid gc
+        """
+        source_hdr = self.header(source_addr)
+        dest_hdr = self.header(dest_addr)
+        if source_hdr.tid & GCFLAG_NO_YOUNG_PTRS == 0:
+            if dest_hdr.tid & GCFLAG_CARDMARKS:
+                xxx # we copy from small -> larg list, set all cards
+            # there might be an object in source that is in nursery
+            self.old_objects_pointing_to_young.append(dest_addr)
+            dest_hdr.tid &= ~GCFLAG_NO_YOUNG_PTRS
+        if source_hdr.tid & GCFLAG_CARDMARK_SET:
+            if dest_adr.tid & GCFLAG_CARDMARK_SET:
+                # large -> large, copy cardmarks
+                xxx
+            else:
+                # large -> small
+                self.old_objects_pointing_to_young.append(dest_addr)
+                dest_hdr.tid &= ~GCFLAG_NO_YOUNG_PTRS
+
     def debug_check_object_no_nursery_pointer(self, obj):
         tid = self.header(obj).tid
         if tid & GCFLAG_CARDMARKS:



More information about the Pypy-commit mailing list