[pypy-svn] r49861 - in pypy/dist/pypy/rpython/memory: . test

arigo at codespeak.net arigo at codespeak.net
Mon Dec 17 10:10:12 CET 2007


Author: arigo
Date: Mon Dec 17 10:10:11 2007
New Revision: 49861

Modified:
   pypy/dist/pypy/rpython/memory/gctypelayout.py
   pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
Log:
Fix test and add comment.


Modified: pypy/dist/pypy/rpython/memory/gctypelayout.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctypelayout.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctypelayout.py	Mon Dec 17 10:10:11 2007
@@ -203,6 +203,9 @@
         self.addresses_of_static_ptrs = []
         # this lists contains pointers in raw Structs and Arrays
         self.addresses_of_static_ptrs_in_nongc = []
+        # if not gc.prebuilt_gc_objects_are_static_roots, then
+        # additional_roots_sources counts the number of locations
+        # within prebuilt GC objects that are of type Ptr(Gc)
         self.additional_roots_sources = 0
         self.finalizer_funcptrs = {}
         self.offsettable_cache = {}

Modified: pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py	Mon Dec 17 10:10:11 2007
@@ -890,7 +890,17 @@
         run, transformer = self.runner(f, nbargs=2, transformer=True)
         run([1, 4])
         assert len(transformer.layoutbuilder.addresses_of_static_ptrs) == 0
-        assert transformer.layoutbuilder.additional_roots_sources == 5
+        assert transformer.layoutbuilder.additional_roots_sources >= 4
+        # NB. Remember that additional_roots_sources does not count
+        # the number of prebuilt GC objects, but the number of locations
+        # within prebuilt GC objects that are of type Ptr(Gc).
+        # At the moment we get additional_roots_sources == 6:
+        #  * all[0]
+        #  * all[1]
+        #  * parent.sub
+        #  * parent2.sub
+        #  * the GcArray pointer from gc.wr_to_objects_with_id
+        #  * the GcArray pointer from gc.object_id_dict.
 
 class TestGenerationalNoFullCollectGC(GCTest):
     # test that nursery is doing its job and that no full collection



More information about the Pypy-commit mailing list