[pypy-svn] r76788 - pypy/branch/markcompact/pypy/rpython/memory/gc

arigo at codespeak.net arigo at codespeak.net
Sun Aug 29 16:27:59 CEST 2010


Author: arigo
Date: Sun Aug 29 16:27:57 2010
New Revision: 76788

Modified:
   pypy/branch/markcompact/pypy/rpython/memory/gc/markcompact.py
Log:
Write basic tests here.  Found a bug.


Modified: pypy/branch/markcompact/pypy/rpython/memory/gc/markcompact.py
==============================================================================
--- pypy/branch/markcompact/pypy/rpython/memory/gc/markcompact.py	(original)
+++ pypy/branch/markcompact/pypy/rpython/memory/gc/markcompact.py	Sun Aug 29 16:27:57 2010
@@ -593,8 +593,13 @@
             llmemory.raw_memcopy(fromaddr, toaddr, basesize)
 
     def debug_check_object(self, obj):
-        # not sure what to check here
-        pass
+        # Test that GCFLAG_MARKBIT is not set.  It should not be set at the
+        # very start or at the very end of a collection -- only temporarily
+        # during the collection.
+        tid = self.header(obj).tid
+        assert tid & GCFLAG_MARKBIT == 0
+        type_id = self.get_type_id(obj)
+        self.has_gcptr_in_varsize(type_id)   # checks that the type_id is valid
 
     def trace_from_objects_with_finalizers(self):
         if self.run_finalizers.non_empty():   # uncommon case



More information about the Pypy-commit mailing list