[pypy-svn] r23114 - in pypy/dist/pypy/rpython/memory: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Feb 7 17:22:17 CET 2006
Author: cfbolz
Date: Tue Feb 7 17:22:16 2006
New Revision: 23114
Modified:
pypy/dist/pypy/rpython/memory/gctransform.py
pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
duh! of course the precalculation of the graphs that are needed should
happen _after_ we cached the current graph
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Tue Feb 7 17:22:16 2006
@@ -283,9 +283,6 @@
if TYPE in self.static_deallocator_graphs:
return self.static_deallocator_graphs[TYPE]
PTRS = find_gc_ptrs_in_type(TYPE)
- for PTR in PTRS:
- # as a side effect the graphs are cached
- self.static_deallocation_graph_for_type(PTR.TO)
def compute_pop_alive_ll_ops(hop):
hop.llops.extend(self.pop_alive(hop.args_v[1]))
return hop.inputconst(hop.r_result.lowleveltype, hop.s_result.const)
@@ -349,11 +346,14 @@
for block in g.iterblocks():
opcount += len(block.operations)
if opcount == 0:
- self.static_deallocator_graphs[TYPE] = None
- return None
+ result = None
else:
- self.static_deallocator_graphs[TYPE] = g
- return g
+ result = g
+ self.static_deallocator_graphs[TYPE] = result
+ for PTR in PTRS:
+ # as a side effect the graphs are cached
+ self.static_deallocation_graph_for_type(PTR.TO)
+ return result
def dynamic_deallocation_graph_for_type(self, TYPE):
if TYPE in self.dynamic_deallocator_graphs:
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 Tue Feb 7 17:22:16 2006
@@ -415,3 +415,13 @@
TYPE = fgraph.startblock.operations[0].result.concretetype.TO
graph = transformer.dynamic_deallocation_graph_for_type(TYPE)
t.rtyper.specialize_more_blocks()
+
+def test_recursive_structure():
+ F = lltype.GcForwardReference()
+ S = lltype.GcStruct('abc', ('x', lltype.Ptr(F)))
+ F.become(S)
+ def f():
+ s1 = lltype.malloc(S)
+ s2 = lltype.malloc(S)
+ s1.x = s2
+ t, transformer = rtype_and_transform(f, [], gctransform.RefcountingGCTransformer, check=False)
More information about the Pypy-commit
mailing list