[pypy-svn] r76778 - in pypy/branch/markcompact/pypy: rpython/memory/test translator translator/c/test

arigo at codespeak.net arigo at codespeak.net
Sun Aug 29 11:55:32 CEST 2010


Author: arigo
Date: Sun Aug 29 11:55:30 2010
New Revision: 76778

Modified:
   pypy/branch/markcompact/pypy/rpython/memory/test/test_transformed_gc.py
   pypy/branch/markcompact/pypy/translator/c/test/test_newgc.py
   pypy/branch/markcompact/pypy/translator/exceptiontransform.py
Log:
* Finish to port mark&compact.
* Add tests about tagged pointers in test_transformed_gc.


Modified: pypy/branch/markcompact/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/markcompact/pypy/rpython/memory/test/test_transformed_gc.py	(original)
+++ pypy/branch/markcompact/pypy/rpython/memory/test/test_transformed_gc.py	Sun Aug 29 11:55:30 2010
@@ -1144,6 +1144,10 @@
             GC_PARAMS = {'space_size': 4096*WORD}
             root_stack_depth = 200
 
+    def test_writebarrier_before_copy(self):
+        py.test.skip("Not relevant, and crashes because llarena does not "
+                     "support empty GcStructs")
+
 class TestGenerationGC(GenericMovingGCTests):
     gcname = "generation"
     GC_CAN_SHRINK_ARRAY = True
@@ -1533,3 +1537,12 @@
             GC_PARAMS = {'space_size': 512*WORD,
                          'nursery_size': 32*WORD}
             root_stack_depth = 200
+
+class TestMarkCompactTaggedpointerGC(TaggedPointerGCTests):
+    gcname = 'markcompact'
+
+    class gcpolicy(gc.FrameworkGcPolicy):
+        class transformerclass(framework.FrameworkGCTransformer):
+            from pypy.rpython.memory.gc.markcompact import MarkCompactGC as GCClass
+            GC_PARAMS = {'space_size': 4096*WORD}
+            root_stack_depth = 200

Modified: pypy/branch/markcompact/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/branch/markcompact/pypy/translator/c/test/test_newgc.py	(original)
+++ pypy/branch/markcompact/pypy/translator/c/test/test_newgc.py	Sun Aug 29 11:55:30 2010
@@ -67,9 +67,8 @@
             if not fullname.startswith('define'):
                 continue
             keyword = conftest.option.keyword
-            if keyword:
-                if keyword.startswith('test_'):
-                    keyword = keyword[len('test_'):]
+            if keyword.startswith('test_'):
+                keyword = keyword[len('test_'):]
                 if keyword not in fullname:
                     continue
             prefix, name = fullname.split('_', 1)
@@ -1072,12 +1071,12 @@
     should_be_moving = True
     GC_CAN_SHRINK_ARRAY = False
 
-    def setup_class(cls):
-        py.test.skip("Disabled for now")
-
     def test_gc_set_max_heap_size(self):
         py.test.skip("not implemented")
 
+    def test_gc_heap_stats(self):
+        py.test.skip("not implemented")
+
     def test_finalizer_order(self):
         py.test.skip("not implemented")
 

Modified: pypy/branch/markcompact/pypy/translator/exceptiontransform.py
==============================================================================
--- pypy/branch/markcompact/pypy/translator/exceptiontransform.py	(original)
+++ pypy/branch/markcompact/pypy/translator/exceptiontransform.py	Sun Aug 29 11:55:30 2010
@@ -197,7 +197,7 @@
         for graph in self.translator.graphs:
             self.create_exception_handling(graph)
 
-    def create_exception_handling(self, graph, always_exc_clear=False):
+    def create_exception_handling(self, graph):
         """After an exception in a direct_call (or indirect_call), that is not caught
         by an explicit
         except statement, we need to reraise the exception. So after this
@@ -212,7 +212,6 @@
             self.raise_analyzer.analyze_direct_call(graph)
             graph.exceptiontransformed = self.exc_data_ptr
 
-        self.always_exc_clear = always_exc_clear
         join_blocks(graph)
         # collect the blocks before changing them
         n_need_exc_matching_blocks = 0
@@ -455,13 +454,18 @@
         block.recloseblock(l0, l)
 
         insert_zeroing_op = False
-        # XXX this is not right. it also inserts zero_gc_pointers_inside
-        # XXX on a path that malloc_nonmovable returns null, but does not raise
-        # XXX which might end up with a segfault. But we don't have such gc now
-        if spaceop.opname == 'malloc' or spaceop.opname == 'malloc_nonmovable':
+        if spaceop.opname == 'malloc':
             flavor = spaceop.args[1].value['flavor']
             if flavor == 'gc':
                 insert_zeroing_op = True
+        elif spaceop.opname == 'malloc_nonmovable':
+            # xxx we cannot insert zero_gc_pointers_inside after
+            # malloc_nonmovable, because it can return null.  For now
+            # we simply always force the zero=True flag on
+            # malloc_nonmovable.
+            c_flags = spaceop.args[1]
+            c_flags.value = c_flags.value.copy()
+            spaceop.args[1].value['zero'] = True
 
         if insert_zeroing_op:
             if normalafterblock is None:
@@ -479,16 +483,6 @@
                                   [v_result_after],
                                   varoftype(lltype.Void)))
 
-        if self.always_exc_clear:
-            # insert code that clears the exception even in the non-exceptional
-            # case...  this is a hint for the JIT, but pointless otherwise
-            if normalafterblock is None:
-                normalafterblock = insert_empty_block(None, l0)
-            llops = rtyper.LowLevelOpList(None)
-            self.gen_setfield('exc_value', self.c_null_evalue, llops)
-            self.gen_setfield('exc_type',  self.c_null_etype,  llops)
-            normalafterblock.operations[:0] = llops
-
 
 class LLTypeExceptionTransformer(BaseExceptionTransformer):
 



More information about the Pypy-commit mailing list