[pypy-svn] r68296 - pypy/branch/gc-compress/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Fri Oct 9 21:43:25 CEST 2009


Author: arigo
Date: Fri Oct  9 21:43:24 2009
New Revision: 68296

Modified:
   pypy/branch/gc-compress/pypy/rpython/memory/gctransform/transform.py
Log:
Experimental: constant-folding here appears to
be needed to remove a number of expressions.
No clue how much it slows down a PyPy translation.


Modified: pypy/branch/gc-compress/pypy/rpython/memory/gctransform/transform.py
==============================================================================
--- pypy/branch/gc-compress/pypy/rpython/memory/gctransform/transform.py	(original)
+++ pypy/branch/gc-compress/pypy/rpython/memory/gctransform/transform.py	Fri Oct  9 21:43:24 2009
@@ -10,6 +10,7 @@
 from pypy.translator.backendopt import graphanalyze
 from pypy.translator.backendopt.canraise import RaiseAnalyzer
 from pypy.translator.backendopt.ssa import DataFlowFamilyBuilder
+from pypy.translator.backendopt.constfold import constant_fold_graph
 from pypy.annotation import model as annmodel
 from pypy.rpython import rmodel, annlowlevel
 from pypy.rpython.memory import gc
@@ -144,16 +145,20 @@
         if self.inline:
             raise_analyzer = RaiseAnalyzer(self.translator)
             to_enum = self.graph_dependencies.get(graph, self.graphs_to_inline)
+            must_constfold = False
             for inline_graph in to_enum:
                 try:
                     inline.inline_function(self.translator, inline_graph, graph,
                                            self.lltype_to_classdef,
                                            raise_analyzer,
                                            cleanup=False)
+                    must_constfold = True
                 except inline.CannotInline, e:
                     print 'CANNOT INLINE:', e
                     print '\t%s into %s' % (inline_graph, graph)
             cleanup_graph(graph)
+            if must_constfold:
+                constant_fold_graph(graph)
 
     def compute_borrowed_vars(self, graph):
         # the input args are borrowed, and stay borrowed for as long as they



More information about the Pypy-commit mailing list