[pypy-svn] r67350 - in pypy/branch/pyjitpl5/pypy/jit: backend metainterp

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Aug 31 11:35:57 CEST 2009


Author: cfbolz
Date: Mon Aug 31 11:35:55 2009
New Revision: 67350

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/loopparser.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py
Log:
don't show the "boring" fail blocks by default. makes graphs a lot smaller in
the common case.


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/loopparser.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/loopparser.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/loopparser.py	Mon Aug 31 11:35:55 2009
@@ -5,6 +5,7 @@
 
 import autopath
 import sys, py, re
+from pypy.jit.metainterp.resoperation import rop
 
 def count_indent(s):
     indent = 0
@@ -60,6 +61,7 @@
         return "Comment: %r" % (self.text,)
 
 class ByteCodeRef(Comment):
+    opnum = rop.DEBUG_MERGE_POINT
     def __init__(self, text):
         Comment.__init__(self, text)
         self.address = int(text.rsplit('#')[1])
@@ -67,6 +69,7 @@
 class Operation(BaseOperation):
     def __init__(self, opname, args, result=None, descr=None):
         self.opname = opname
+        self.opnum = getattr(rop, opname.upper(), -41)
         self.args   = args
         self.result = result
         self.descr = descr

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/graphpage.py	Mon Aug 31 11:35:55 2009
@@ -4,6 +4,8 @@
 from pypy.jit.metainterp.history import Box
 from pypy.jit.metainterp.resoperation import rop
 
+SHOW_FAILS = False
+
 class SubGraph:
     def __init__(self, suboperations):
         self.suboperations = suboperations
@@ -16,11 +18,22 @@
     graphs = [(loop, loop in highlight_loops) for loop in loops]
     for graph, highlight in graphs:
         for op in graph.get_operations():
-            if op.is_guard():
+            if is_interesting_guard(op):
                 graphs.append((SubGraph(op.suboperations), highlight))
     graphpage = ResOpGraphPage(graphs, errmsg)
     graphpage.display()
 
+def is_interesting_guard(op):
+    if not op.is_guard():
+        return False
+    if SHOW_FAILS:
+        return True
+    if len(op.suboperations) > 1:
+        return True
+    if op.suboperations[0].opnum == rop.FAIL:
+        return False
+    return True
+
 
 class ResOpGraphPage(GraphPage):
 
@@ -63,9 +76,16 @@
         for graphindex in range(len(self.graphs)):
             self.block_starters[graphindex] = {0: True}
         for graphindex, graph in enumerate(self.graphs):
+            last_was_mergepoint = False
             for i, op in enumerate(graph.get_operations()):
-                if op.is_guard():
+                if is_interesting_guard(op):
                     self.mark_starter(graphindex, i+1)
+                if op.opnum == rop.DEBUG_MERGE_POINT:
+                    if not last_was_mergepoint:
+                        last_was_mergepoint = True
+                        self.mark_starter(graphindex, i)
+                else:
+                    last_was_mergepoint = False
 
     def set_errmsg(self, errmsg):
         self.errmsg = errmsg
@@ -138,7 +158,7 @@
         while True:
             op = operations[opindex]
             lines.append(repr(op))
-            if op.is_guard():
+            if is_interesting_guard(op):
                 tgt = op.suboperations[0]
                 tgt_g, tgt_i = self.all_operations[tgt]
                 self.genedge((graphindex, opstartindex),



More information about the Pypy-commit mailing list