[pypy-svn] r71045 - pypy/trunk/pypy/jit/backend/x86

arigo at codespeak.net arigo at codespeak.net
Mon Feb 1 22:06:54 CET 2010


Author: arigo
Date: Mon Feb  1 22:06:54 2010
New Revision: 71045

Modified:
   pypy/trunk/pypy/jit/backend/x86/viewcode.py
Log:
Speed up the --text case.


Modified: pypy/trunk/pypy/jit/backend/x86/viewcode.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/viewcode.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/viewcode.py	Mon Feb  1 22:06:54 2010
@@ -171,7 +171,7 @@
         self.symbols = {}
         self.logentries = {}
 
-    def parse(self, f):
+    def parse(self, f, textonly=True):
         for line in f:
             if line.startswith('CODE_DUMP '):
                 pieces = line.split()
@@ -205,6 +205,8 @@
                 filename = line[len('SYS_EXECUTABLE '):].strip()
                 self.symbols.update(load_symbols(filename))
         # find cross-references between blocks
+        if textonly:
+            return
         fnext = 0.1
         for i, r in enumerate(self.ranges):
             for lineno, targetaddr, _ in r.findjumps():
@@ -215,7 +217,7 @@
                     sys.stderr.write("%d%%" % int(f*100.0))
                     fnext += 0.1
                 sys.stderr.write(".")
-        sys.stderr.write("100%\n")
+        sys.stderr.write("100%")
         # split blocks at labeltargets
         t = self.labeltargets
         #print t
@@ -234,6 +236,7 @@
                         pass
                     break
         # hack hack hacked
+        sys.stderr.write("\n")
 
     def show(self, showtext=True, showgraph=True):
         if showgraph:
@@ -359,5 +362,5 @@
     else:
         f = open(sys.argv[1], 'r')
     world = World()
-    world.parse(f)
+    world.parse(f, textonly=not showgraph)
     world.show(showtext=True, showgraph=showgraph)



More information about the Pypy-commit mailing list