[pypy-svn] r47200 - in pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Oct 5 20:44:55 CEST 2007


Author: cfbolz
Date: Fri Oct  5 20:44:53 2007
New Revision: 47200

Modified:
   pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/refcounting.py
   pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/test/test_refcounting.py
Log:
fix the failing refcounting test: perform a malloc removal on the deallocators,
since they could contain malloc through accessing internal arrays.


Modified: pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/refcounting.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/refcounting.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/refcounting.py	Fri Oct  5 20:44:53 2007
@@ -120,6 +120,19 @@
         self.dynamic_deallocator_funcptrs = {}
         self.queryptr2dynamic_deallocator_funcptr = {}
 
+    def finish_helpers(self):
+        GCTransformer.finish_helpers(self)
+        from pypy.translator.backendopt.malloc import remove_mallocs
+        seen = {}
+        graphs = []
+        for fptr in self.static_deallocator_funcptrs.itervalues():
+            graph = fptr._obj.graph
+            if graph in seen:
+                continue
+            seen[graph] = True
+            graphs.append(graph)
+        remove_mallocs(self.translator, graphs)
+
     def var_needs_set_transform(self, var):
         return var_needsgc(var)
 

Modified: pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/test/test_refcounting.py
==============================================================================
--- pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/test/test_refcounting.py	(original)
+++ pypy/branch/kill-keepalives-again/pypy/rpython/memory/gctransform/test/test_refcounting.py	Fri Oct  5 20:44:53 2007
@@ -169,8 +169,9 @@
     dgraph, t = make_deallocator(S)
     ops = getops(dgraph)
     assert len(ops['direct_call']) == 4
-    assert len(ops['getfield']) == 4
-    assert len(ops['getarraysubstruct']) == 1
+    assert len(ops['getfield']) == 2
+    assert len(ops['getinteriorfield']) == 2
+    assert len(ops['getinteriorarraysize']) == 1
     assert len(ops['gc_free']) == 1
 
 def test_deallocator_with_destructor():


More information about the pypy-svn mailing list