[pypy-commit] pypy exctrans: Don't create the database automagically in .generate_graphs()

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


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

Log:	Don't create the database automagically in .generate_graphs()

diff --git a/rpython/memory/gctransform/test/test_framework.py b/rpython/memory/gctransform/test/test_framework.py
--- a/rpython/memory/gctransform/test/test_framework.py
+++ b/rpython/memory/gctransform/test/test_framework.py
@@ -40,7 +40,8 @@
     t.config.translation.gc = "minimark"
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
-    db = cbuild.generate_graphs()
+    db = cbuild.build_database()
+    cbuild.generate_graphs(db)
     entrypointptr = cbuild.getentrypointptr()
     entrygraph = entrypointptr._obj.graph
 
@@ -115,7 +116,8 @@
     t.config.translation.gc = "minimark"
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
-    db = cbuild.generate_graphs()
+    db = cbuild.build_database()
+    cbuild.generate_graphs(db)
 
 def test_no_collect_detection():
     from rpython.rlib import rgc
@@ -140,7 +142,7 @@
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
     with py.test.raises(Exception) as f:
-        cbuild.generate_graphs()
+        cbuild.build_database()
     expected = "'no_collect' function can trigger collection: <function g at "
     assert str(f.value).startswith(expected)
 
@@ -165,7 +167,7 @@
     cbuild = CStandaloneBuilder(t, entrypoint, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
     with py.test.raises(Exception) as f:
-        cbuild.generate_graphs()
+        cbuild.build_database()
     assert 'can cause the GC to be called' in str(f.value)
     assert 'trace_func' in str(f.value)
     assert 'MyStructure' in str(f.value)
@@ -254,7 +256,8 @@
     t.config.translation.gc = "minimark"
     cbuild = CStandaloneBuilder(t, g, t.config,
                                 gcpolicy=FrameworkGcPolicy2)
-    db = cbuild.generate_graphs()
+    db = cbuild.build_database()
+    cbuild.generate_graphs(db)
 
     ff = graphof(t, f)
     #ff.show()
diff --git a/rpython/memory/test/test_transformed_gc.py b/rpython/memory/test/test_transformed_gc.py
--- a/rpython/memory/test/test_transformed_gc.py
+++ b/rpython/memory/test/test_transformed_gc.py
@@ -110,7 +110,8 @@
 
         cbuild = CStandaloneBuilder(t, entrypoint, config=t.config,
                                     gcpolicy=cls.gcpolicy)
-        db = cbuild.generate_graphs()
+        db = cbuild.build_database()
+        cbuild.generate_graphs(db)
         entrypointptr = cbuild.getentrypointptr()
         entrygraph = entrypointptr._obj.graph
         if option.view:
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,10 +195,8 @@
     DEBUG_DEFINES = {'RPY_ASSERT': 1,
                      'RPY_LL_ASSERT': 1}
 
-    def generate_graphs(self, db=None):
+    def generate_graphs(self, db):
         """"Prepare the graphs."""
-        if db is None:
-            db = self.build_database()
         db.prepare_inline_helpers()
         for node in db.containerlist:
             if getattr(node, 'funcgen', None):
@@ -207,7 +205,9 @@
 
     def generate_source(self, db=None, defines={}, exe_name=None):
         assert self.c_source_filename is None
-        db = self.generate_graphs(db)
+        if db is None:
+            db = self.build_database()
+        self.generate_graphs(db)
         pf = self.getentrypointptr()
         if self.modulename is None:
             self.modulename = uniquemodulename('testing')


More information about the pypy-commit mailing list