[pypy-svn] r49098 - pypy/dist/pypy/rpython/memory/gc

arigo at codespeak.net arigo at codespeak.net
Sun Nov 25 19:09:29 CET 2007


Author: arigo
Date: Sun Nov 25 19:09:29 2007
New Revision: 49098

Modified:
   pypy/dist/pypy/rpython/memory/gc/base.py
   pypy/dist/pypy/rpython/memory/gc/generation.py
Log:
Write some comments that took me a while to "rediscover".


Modified: pypy/dist/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc/base.py	(original)
+++ pypy/dist/pypy/rpython/memory/gc/base.py	Sun Nov 25 19:09:29 2007
@@ -100,6 +100,16 @@
     moving_gc = True
 
     def __init__(self):
+        # WaRnInG!  Putting GC objects as fields of the GC itself is
+        # basically *not* working in general!  When running tests with
+        # the gcwrapper, there is no way they can be returned from
+        # get_roots_from_llinterp().  When the whole GC goes through the
+        # gctransformer, though, it works if the fields are read-only
+        # (and thus only ever reference a prebuilt list or dict).  These
+        # prebuilt lists or dicts themselves can be mutated and point to
+        # more non-prebuild GC objects; this is fine because the
+        # internal GC ptr in the prebuilt list or dict is found by
+        # gctypelayout and listed in addresses_of_static_ptrs.
         self.wr_to_objects_with_id = []
         self.object_id_dict = {}
         self.object_id_dict_ends_at = 0

Modified: pypy/dist/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc/generation.py	(original)
+++ pypy/dist/pypy/rpython/memory/gc/generation.py	Sun Nov 25 19:09:29 2007
@@ -223,6 +223,10 @@
         self.old_objects_pointing_to_young = NULL
 
     def collect_roots_in_nursery(self):
+        # we don't need to trace prebuilt GcStructs during a minor collect:
+        # if a prebuilt GcStruct contains a pointer to a young object,
+        # then the write_barrier must have ensured that the prebuilt
+        # GcStruct is in the list self.old_objects_pointing_to_young.
         roots = self.get_roots(with_static=False)
         count = 0
         while 1:



More information about the Pypy-commit mailing list