[pypy-commit] pypy exctrans: merge generate_graphs() into db.complete()

rlamy pypy.commits at gmail.com
Fri Jan 8 11:10:30 EST 2016


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: exctrans
Changeset: r81622:ecb9259b9257
Date: 2016-01-06 03:07 +0100
http://bitbucket.org/pypy/pypy/changeset/ecb9259b9257/

Log:	merge generate_graphs() into db.complete()

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,6 +346,7 @@
             break     # database is now complete
 
         assert not self.delayedfunctionptrs
+        self.inline_gc_helpers()
         self.completed = True
         if show_progress:
             dump()
@@ -378,7 +379,9 @@
             produce(node)
         return result
 
-    def prepare_inline_helpers(self):
+    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 = []
@@ -386,6 +389,9 @@
             for graph in node.graphs_to_patch():
                 graphs.append(graph)
         self.gctransformer.prepare_inline_helpers(graphs)
+        for node in funcnodes:
+            if getattr(node, 'funcgen', None):
+                node.funcgen.patch_graph()
 
     def all_graphs(self):
         graphs = []
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -195,19 +195,10 @@
     DEBUG_DEFINES = {'RPY_ASSERT': 1,
                      'RPY_LL_ASSERT': 1}
 
-    def generate_graphs(self, db):
-        """"Prepare the graphs."""
-        db.prepare_inline_helpers()
-        for node in db.containerlist:
-            if getattr(node, 'funcgen', None):
-                node.funcgen.patch_graph()
-        return db
-
     def generate_source(self, db=None, defines={}, exe_name=None):
         assert self.c_source_filename is None
         if db is None:
             db = self.build_database()
-        self.generate_graphs(db)
         pf = self.getentrypointptr()
         if self.modulename is None:
             self.modulename = uniquemodulename('testing')
diff --git a/rpython/translator/c/test/test_database.py b/rpython/translator/c/test/test_database.py
--- a/rpython/translator/c/test/test_database.py
+++ b/rpython/translator/c/test/test_database.py
@@ -9,8 +9,6 @@
 
 
 def dump_on_stdout(database):
-    if database.gctransformer:
-        database.prepare_inline_helpers()
     print '/*********************************/'
     structdeflist = database.getstructdeflist()
     for node in structdeflist:


More information about the pypy-commit mailing list