[pypy-svn] r62510 - pypy/branch/pyjitpl5/pypy/jit/metainterp

fijal at codespeak.net fijal at codespeak.net
Wed Mar 4 10:47:39 CET 2009


Author: fijal
Date: Wed Mar  4 10:47:37 2009
New Revision: 62510

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/dump.py
Log:
Add a possibility to dump to a stream


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/dump.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/dump.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/dump.py	Wed Mar  4 10:47:37 2009
@@ -1,5 +1,5 @@
 from pypy.jit.metainterp import codewriter
-
+import sys
 
 class SourceIterator:
 
@@ -134,7 +134,9 @@
     if src.pc != len(jitcode.code):
         print >> file, 'WARNING: the pc column is bogus! fix dump.py!'
 
-def dump_call_history(call_history):
+def dump_call_history(call_history, outfile=None):
+    if outfile is None:
+        outfile = sys.stderr
     indent = 0
     for ev, code, args in call_history:
         if ev == 'enter':
@@ -142,7 +144,7 @@
                 args_s = [str(a) for a in args]
             else:
                 args_s = []
-            print "%s%s(%s)" % (" "*indent, code.name, ','.join(args_s))
+            print >>outfile, "%s%s(%s)" % (" "*indent, code.name, ','.join(args_s))
             indent += 2
         elif ev.startswith('leave'):
             indent -= 2



More information about the Pypy-commit mailing list