[pypy-svn] r40813 - pypy/dist/pypy/translator/backendopt

xoraxax at codespeak.net xoraxax at codespeak.net
Tue Mar 20 10:52:46 CET 2007


Author: xoraxax
Date: Tue Mar 20 10:52:45 2007
New Revision: 40813

Modified:
   pypy/dist/pypy/translator/backendopt/removeassert.py
Log:
Only print counts for asserts in non-verbose mode.

Modified: pypy/dist/pypy/translator/backendopt/removeassert.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/removeassert.py	(original)
+++ pypy/dist/pypy/translator/backendopt/removeassert.py	Tue Mar 20 10:52:45 2007
@@ -12,6 +12,7 @@
     clsdef = translator.annotator.bookkeeper.getuniqueclassdef(AssertionError)
     r_AssertionError = rclass.getclassrepr(rtyper, clsdef)
     ll_AssertionError = r_AssertionError.convert_const(AssertionError)
+    total_count = [0, 0]
 
     for graph in graphs:
         count = 0
@@ -29,14 +30,18 @@
                         morework = True
                         break
                     else:
-                        log.removeassert("cannot remove an assert from %s" % (graph.name,))
+                        total_count[0] += 1
+                        if translator.config.translation.verbose:
+                            log.removeassert("cannot remove an assert from %s" % (graph.name,))
         if count:
             # now melt away the (hopefully) dead operation that compute
             # the condition
+            total_count[1] += count
             if translator.config.translation.verbose:
                 log.removeassert("removed %d asserts in %s" % (count, graph.name))
             checkgraph(graph)
             #transform_dead_op_vars(graph, translator)
+    log.removeassert("Could not remove %d asserts, but removed %d asserts." % tuple(total_count))
 
 
 def kill_assertion_link(graph, link):



More information about the Pypy-commit mailing list