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

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Jan 28 13:36:48 CET 2006


Author: cfbolz
Date: Sat Jan 28 13:36:46 2006
New Revision: 22780

Modified:
   pypy/dist/pypy/rpython/memory/gctransform.py
   pypy/dist/pypy/rpython/memory/test/test_gctransform.py
Log:
(mwh, cfbolz)
don't actually store the graphs on the transformer


Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py	(original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py	Sat Jan 28 13:36:46 2006
@@ -28,14 +28,17 @@
     return isinstance(vartype, lltype.Ptr) and vartype._needsgc()
 
 class GCTransformer:
-    def __init__(self, graphs):
-        self.graphs = graphs
+    def __init__(self):
+        self.seen_graphs = {}
 
-    def transform(self):
-        for graph in self.graphs:
+    def transform(self, graphs):
+        for graph in graphs:
             self.transform_graph(graph)
 
     def transform_graph(self, graph):
+        if graph in self.seen_graphs:
+            return
+        self.seen_graphs[graph] = True
         self.links_to_split = {} # link -> vars to pop_alive across the link
 
         newops = []

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	Sat Jan 28 13:36:46 2006
@@ -32,8 +32,8 @@
     t = TranslationContext()
     t.buildannotator().build_types(func, inputtypes)
     t.buildrtyper().specialize(t)
-    transformer = transformcls(t.graphs)
-    transformer.transform()
+    transformer = transformcls()
+    transformer.transform(t.graphs)
     t.checkgraphs()
     for graph in t.graphs:
         for block in graph.iterblocks():



More information about the Pypy-commit mailing list