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

mwh at codespeak.net mwh at codespeak.net
Sun Feb 19 01:32:30 CET 2006


Author: mwh
Date: Sun Feb 19 01:32:13 2006
New Revision: 23473

Modified:
   pypy/dist/pypy/rpython/memory/gctransform.py
   pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
fix really really really really really really really horrible bug in
refcounting: we decreffed even non-gc pointers!  this fixes the crashes in
module/stackless/test/test_interp_coroutine (guuuuuuh! what a place to find
it).



Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Sun Feb 19 01:32:13 2006
@@ -257,7 +257,7 @@
                 yield '    '*depth + v + '_' + name + ' = ' + v + '.' + name
                 for line in inner:
                     yield line
-    elif isinstance(TYPE, lltype.Ptr):
+    elif isinstance(TYPE, lltype.Ptr) and TYPE._needsgc():
         yield '    '*depth + 'pop_alive(%s)'%v
 
 counts = {}

Modified: pypy/dist/pypy/rpython/memory/test/test_gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_gctransform.py	Sun Feb 19 01:32:13 2006
@@ -489,6 +489,16 @@
     t, transformer = rtype_and_transform(
         f, [], gctransform.RefcountingGCTransformer, check=False)
 
+def test_dont_decref_nongc_pointers():
+    S = lltype.GcStruct('S',
+                        ('x', lltype.Ptr(lltype.Struct('T', ('x', lltype.Signed)))),
+                        ('y', lltype.Ptr(lltype.GcStruct('Y', ('x', lltype.Signed))))
+                        )
+    def f():
+        pass
+    graph, t = make_deallocator(S)
+    ops = getops(graph)
+    assert len(ops['direct_call']) == 1
 
 def test_boehm_finalizer_simple():
     S = lltype.GcStruct("S", ('x', lltype.Signed))



More information about the Pypy-commit mailing list