[pypy-svn] r17920 - in pypy/dist/pypy/translator: goal tool

pedronis at codespeak.net pedronis at codespeak.net
Tue Sep 27 21:34:33 CEST 2005


Author: pedronis
Date: Tue Sep 27 21:34:31 2005
New Revision: 17920

Modified:
   pypy/dist/pypy/translator/goal/query.py
   pypy/dist/pypy/translator/goal/translate_pypy.py
   pypy/dist/pypy/translator/goal/translate_pypy_new.py
   pypy/dist/pypy/translator/tool/util.py
Log:
make worstblocks_topten a user-invoked query



Modified: pypy/dist/pypy/translator/goal/query.py
==============================================================================
--- pypy/dist/pypy/translator/goal/query.py	(original)
+++ pypy/dist/pypy/translator/goal/query.py	Tue Sep 27 21:34:31 2005
@@ -537,3 +537,24 @@
     visit(t.entrypoint, [t.entrypoint])
 
     return back
+
+#
+
+def worstblocks_topten(t, n=10):
+    from pypy.tool.ansi_print import ansi_print
+    ann = t.annotator
+    h = [(count, block) for block, count in ann.reflowcounter.iteritems()]
+    h.sort()
+    if not h:
+        print "annotator should have been run with debug collecting enabled"
+        return
+    print
+    ansi_print(',-----------------------  Top %d Most Reflown Blocks  -----------------------.' % n, 36)
+    for i in range(n):
+        if not h:
+            break
+        count, block = h.pop()
+        ansi_print('                                                      #%3d: reflown %d times  |' % (i+1, count), 36)
+        t.about(block)
+    ansi_print("`----------------------------------------------------------------------------'", 36)
+    print

Modified: pypy/dist/pypy/translator/goal/translate_pypy.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy.py	(original)
+++ pypy/dist/pypy/translator/goal/translate_pypy.py	Tue Sep 27 21:34:31 2005
@@ -135,7 +135,6 @@
         lost = query.sanity_check_methods(t)
         assert not lost, "lost methods, something gone wrong with the annotation of method defs"
         print "*** No lost method defs."
-        worstblocks_topten(a, 3)
         find_someobjects(t)
     if a: #and not options['-no-s']:
         print 'Simplifying...'
@@ -252,23 +251,6 @@
             someobjnum, num) 
         print "=" * 70
 
-def worstblocks_topten(ann, n=10):
-    h = [(count, block) for block, count in ann.reflowcounter.iteritems()]
-    h.sort()
-    if not h:
-        return
-    print
-    ansi_print(',-----------------------  Top %d Most Reflown Blocks  -----------------------.' % n, 36)
-    for i in range(n):
-        if not h:
-            break
-        count, block = h.pop()
-        ansi_print('                                                      #%3d: reflown %d times  |' % (i+1, count), 36)
-        ann.translator.about(block)
-    ansi_print("`----------------------------------------------------------------------------'", 36)
-    print
-
-
 def update_usession_dir(stabledir = udir.dirpath('usession')): 
     from py import path 
     try:

Modified: pypy/dist/pypy/translator/goal/translate_pypy_new.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate_pypy_new.py	(original)
+++ pypy/dist/pypy/translator/goal/translate_pypy_new.py	Tue Sep 27 21:34:31 2005
@@ -89,7 +89,7 @@
 # XXX this tries to make compiling faster
 from pypy.translator.tool import cbuild
 cbuild.enable_fast_compilation()
-from pypy.translator.tool.util import worstblocks_topten, find_someobjects 
+from pypy.translator.tool.util import find_someobjects 
 from pypy.translator.tool.util import sanity_check_exceptblocks, update_usession_dir
 from pypy.translator.tool.util import assert_rpython_mostly_not_imported, mkexename
 
@@ -114,7 +114,6 @@
         lost = query.sanity_check_methods(t)
         assert not lost, "lost methods, something gone wrong with the annotation of method defs"
         print "*** No lost method defs."
-        worstblocks_topten(a, 3)
         find_someobjects(t)
     if a: #and not options['-no-s']:
         print 'Simplifying...'

Modified: pypy/dist/pypy/translator/tool/util.py
==============================================================================
--- pypy/dist/pypy/translator/tool/util.py	(original)
+++ pypy/dist/pypy/translator/tool/util.py	Tue Sep 27 21:34:31 2005
@@ -119,20 +119,4 @@
             someobjnum, num) 
         print "=" * 70
 
-def worstblocks_topten(ann, n=10):
-    from pypy.tool.ansi_print import ansi_print
-    h = [(count, block) for block, count in ann.reflowcounter.iteritems()]
-    h.sort()
-    if not h:
-        return
-    print
-    ansi_print(',-----------------------  Top %d Most Reflown Blocks  -----------------------.' % n, 36)
-    for i in range(n):
-        if not h:
-            break
-        count, block = h.pop()
-        ansi_print('                                                      #%3d: reflown %d times  |' % (i+1, count), 36)
-        ann.translator.about(block)
-    ansi_print("`----------------------------------------------------------------------------'", 36)
-    print
 



More information about the Pypy-commit mailing list