[pypy-svn] r39665 - in pypy/dist/pypy/rpython/memory/gctransform: . test
mwh at codespeak.net
mwh at codespeak.net
Fri Mar 2 13:21:33 CET 2007
Author: mwh
Date: Fri Mar 2 13:21:29 2007
New Revision: 39665
Modified:
pypy/dist/pypy/rpython/memory/gctransform/framework.py
pypy/dist/pypy/rpython/memory/gctransform/test/test_framework.py
Log:
(mwh, rxe)
fix the "rdict bug": it turned out that the framework gc didn't recognize
zero_malloc and zero_malloc_varsize as being operations that could collect, and
dictionary resizing was a function that only allocated via these operations.
what was special about the test cases was that they did most of their
allocations during resizing when there were no other references to the dict,
most programs never see a collect there.
this may just be a bug that could crash pypy-c, but it seems unlikely.
Modified: pypy/dist/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/framework.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform/framework.py Fri Mar 2 13:21:29 2007
@@ -16,7 +16,7 @@
class CollectAnalyzer(graphanalyze.GraphAnalyzer):
def operation_is_true(self, op):
return op.opname in ("malloc", "malloc_varsize", "gc__collect",
- "gc_x_become")
+ "gc_x_become", "zero_malloc_varsize", "zero_malloc")
ADDRESS_VOID_FUNC = lltype.FuncType([llmemory.Address], lltype.Void)
Modified: pypy/dist/pypy/rpython/memory/gctransform/test/test_framework.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform/test/test_framework.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform/test/test_framework.py Fri Mar 2 13:21:29 2007
@@ -1,5 +1,5 @@
from pypy.rpython.memory.gctransform.test.test_transform import rtype
-from pypy.rpython.memory.gctransform.framework import FrameworkGCTransformer
+from pypy.rpython.memory.gctransform.framework import FrameworkGCTransformer, CollectAnalyzer
from pypy.rpython.lltypesystem import lltype
from pypy.translator.c.gc import FrameworkGcPolicy
from pypy.translator.translator import TranslationContext, graphof
@@ -45,3 +45,11 @@
res = llinterp.eval_graph(entrygraph, [ll_argv])
assert ''.join(res.chars) == "2"
+
+def test_cancollect():
+ S = lltype.GcStruct('S', ('x', lltype.Signed))
+ def g():
+ lltype.malloc(S, zero=True)
+ t = rtype(g, [])
+ gg = graphof(t, g)
+ assert CollectAnalyzer(t).analyze_direct_call(gg)
More information about the Pypy-commit
mailing list