[pypy-svn] r35232 - pypy/branch/jit-real-world/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Sun Dec 3 23:18:39 CET 2006


Author: arigo
Date: Sun Dec  3 23:18:38 2006
New Revision: 35232

Modified:
   pypy/branch/jit-real-world/pypy/tool/error.py
Log:
Even without debugging info, blocked blocks can display meaningful
errors because the blocked operation is the first one whose result is
not annotated.



Modified: pypy/branch/jit-real-world/pypy/tool/error.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/tool/error.py	(original)
+++ pypy/branch/jit-real-world/pypy/tool/error.py	Sun Dec  3 23:18:38 2006
@@ -71,16 +71,26 @@
     msg = [""]
     msg.append('-+' * 30)
     from pypy.annotation import model
+    msg.append("Blocked block -- operation cannot succeed")
     if model.DEBUG:
-        msg.append("Blocked block -- operation cannot succeed")
         _, _, operindex = annotator.why_not_annotated[block][1].break_at
+    else:
+        # guess the blocked operation by the fact that its return value is
+        # not annotated
+        for operindex in range(len(block.operations)):
+            if block.operations[operindex].result not in annotator.bindings:
+                break
+        else:
+            operindex = None
+
+    if operindex is not None:
         oper = block.operations[operindex]
         msg.append(" " + str(oper))
     else:
-        msg.append("Blocked block")
-        operindex = None
+        oper = None
+        msg.append(" (inconsistency - the block is fully annotated??)")
     msg += source_lines(graph, block, operindex, long=True)
-    if model.DEBUG:
+    if oper is not None:
         if SHOW_ANNOTATIONS:
             msg.append("Known variable annotations:")
             for arg in oper.args + [oper.result]:
@@ -89,7 +99,7 @@
                         msg.append(" " + str(arg) + " = " + str(annotator.binding(arg)))
                     except KeyError:
                         pass
-        if SHOW_TRACEBACK:
+        if model.DEBUG and SHOW_TRACEBACK:
             msg.extend(traceback.format_exception(*annotator.why_not_annotated[block]))
     return "\n".join(msg)
 



More information about the Pypy-commit mailing list