[pypy-svn] r24542 - in pypy/dist/pypy: rpython/memory translator/c/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Mar 18 23:20:11 CET 2006


Author: cfbolz
Date: Sat Mar 18 23:20:09 2006
New Revision: 24542

Modified:
   pypy/dist/pypy/rpython/memory/gctransform.py
   pypy/dist/pypy/translator/c/test/test_newgc.py
Log:
handle arrays of Voids correctly in the gc


Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Sat Mar 18 23:20:09 2006
@@ -900,6 +900,9 @@
                     offsets = offsets_to_gc_pointers(ARRAY.OF)
                     info["varofstoptrs"] = self.offsets2table(offsets)
                     info["varitemsize"] = llmemory.sizeof(ARRAY.OF)
+                else:
+                    info["varofstoptrs"] = self.offsets2table(())
+                    info["varitemsize"] = 0
             return type_id
 
     def consider_constant(self, TYPE, value):

Modified: pypy/dist/pypy/translator/c/test/test_newgc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_newgc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_newgc.py	Sat Mar 18 23:20:09 2006
@@ -301,3 +301,15 @@
             return len(a) + a[0]
         fn = self.getcompiled(f)
         py.test.raises(MemoryError, fn)
+
+    def test_framework_array_of_void(self):
+        def f():
+            a = [None] * 43
+            b = []
+            for i in range(1000000):
+                a.append(None)
+                b.append(len(a))
+            return b[-1]
+        fn = self.getcompiled(f)
+        res = fn()
+        assert res == 43 + 1000000



More information about the Pypy-commit mailing list