Author: Ronan Lamy <[email protected]>
Branch: exctrans
Changeset: r81625:c1d9d612f60e
Date: 2016-01-06 14:53 +0100
http://bitbucket.org/pypy/pypy/changeset/c1d9d612f60e/

Log:    merge prepare_inline_helpers() and inline_helpers(); simplify

diff --git a/rpython/memory/gctransform/transform.py 
b/rpython/memory/gctransform/transform.py
--- a/rpython/memory/gctransform/transform.py
+++ b/rpython/memory/gctransform/transform.py
@@ -113,21 +113,14 @@
         self.seen_graphs.add(graph)
         self.minimal_transform.add(graph)
 
-    def prepare_inline_helpers(self, graphs):
+    def inline_helpers(self, graphs):
         from rpython.translator.backendopt.inline import iter_callsites
+        raise_analyzer = RaiseAnalyzer(self.translator)
         for graph in graphs:
-            self.graph_dependencies[graph] = {}
+            to_enum = []
             for called, block, i in iter_callsites(graph, None):
                 if called in self.graphs_to_inline:
-                    self.graph_dependencies[graph][called] = True
-        self.prepared = True
-
-    def inline_helpers(self, graph):
-        if not self.prepared:
-            raise Exception("Need to call prepare_inline_helpers first")
-        if self.inline:
-            raise_analyzer = RaiseAnalyzer(self.translator)
-            to_enum = self.graph_dependencies.get(graph, self.graphs_to_inline)
+                    to_enum.append(called)
             must_constfold = False
             for inline_graph in to_enum:
                 try:
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -346,8 +346,9 @@
             break     # database is now complete
 
         assert not self.delayedfunctionptrs
-        self.inline_gc_helpers()
         self.completed = True
+        if self.gctransformer is not None and self.gctransformer.inline:
+            self.gctransformer.inline_helpers(self.all_graphs())
         if show_progress:
             dump()
         log.database("Completed")
@@ -379,20 +380,6 @@
             produce(node)
         return result
 
-    def inline_gc_helpers(self):
-        if self.gctransformer is None:
-            return
-        all_nodes = self.globalcontainers()
-        funcnodes = [node for node in all_nodes if node.nodekind == 'func']
-        graphs = []
-        for node in funcnodes:
-            for graph in node.graphs_to_patch():
-                graphs.append(graph)
-        self.gctransformer.prepare_inline_helpers(graphs)
-        if self.gctransformer.inline:
-            for graph in graphs:
-                self.gctransformer.inline_helpers(graph)
-
     def all_graphs(self):
         graphs = []
         for node in self.containerlist:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to