[pypy-svn] r25746 - pypy/dist/pypy/translator/c

pedronis at codespeak.net pedronis at codespeak.net
Wed Apr 12 23:20:38 CEST 2006


Author: pedronis
Date: Wed Apr 12 23:20:36 2006
New Revision: 25746

Modified:
   pypy/dist/pypy/translator/c/funcgen.py
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/node.py
Log:
don't leak variables or blocks in the case the original function graph has been copied to inline gc helpers



Modified: pypy/dist/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/funcgen.py	(original)
+++ pypy/dist/pypy/translator/c/funcgen.py	Wed Apr 12 23:20:36 2006
@@ -96,6 +96,10 @@
             newgraph = copygraph(self.graph, shallow=True)
             self.oldgraph = self.graph
             self.graph = newgraph
+            ## protect
+            #for block in self.oldgraph.iterblocks():
+            #    for op in block.operations:
+            #        op.args = tuple(op.args)
             self.db.gctransformer.inline_helpers(newgraph)
             self.collect_var_and_types()
         else:
@@ -113,7 +117,9 @@
 
     def implementation_end(self):
         self.lltypes = None
+        self.vars = None
         self.blocknum = None
+        self.currentblock = None
         self.graph = self.oldgraph
         del self.oldgraph
 

Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Wed Apr 12 23:20:36 2006
@@ -309,6 +309,7 @@
                     continue
                 cost = len(impl) + nbetween
                 yield node, impl
+                del impl
                 if used + cost > split_criteria:
                     # split if criteria met, unless we would produce nothing.
                     raise StopIteration

Modified: pypy/dist/pypy/translator/c/node.py
==============================================================================
--- pypy/dist/pypy/translator/c/node.py	(original)
+++ pypy/dist/pypy/translator/c/node.py	Wed Apr 12 23:20:36 2006
@@ -603,6 +603,7 @@
             yield line
 
         yield '}'
+        del bodyiter
         funcgen.implementation_end()
 
 assert not USESLOTS or '__dict__' not in dir(FuncNode)



More information about the Pypy-commit mailing list