[pypy-svn] r35518 - pypy/branch/temp/pypy/tool

arigo at codespeak.net arigo at codespeak.net
Sat Dec 9 02:31:26 CET 2006


Author: arigo
Date: Sat Dec  9 02:31:21 2006
New Revision: 35518

Modified:
   pypy/branch/temp/pypy/tool/error.py
Log:
merging of http://codespeak.net/svn/pypy/branch/jit-real-world/pypy/tool/error.py
revisions 35112 to 35513:

    ------------------------------------------------------------------------
    r35232 | arigo | 2006-12-03 23:18:38 +0100 (Sun, 03 Dec 2006) | 5 lines
    
    Even without debugging info, blocked blocks can display meaningful
    errors because the blocked operation is the first one whose result is
    not annotated.
    
    
    ------------------------------------------------------------------------
    r35118 | arigo | 2006-11-29 13:45:27 +0100 (Wed, 29 Nov 2006) | 7 lines
    
    (arre, pedronis, arigo)
    
    Be afraid.  Very afraid.  (pedronis)
    
    A branch to experiment with throwing PyPy at the JIT.  (arigo)
    
    
    ------------------------------------------------------------------------


Modified: pypy/branch/temp/pypy/tool/error.py
==============================================================================
--- pypy/branch/temp/pypy/tool/error.py	(original)
+++ pypy/branch/temp/pypy/tool/error.py	Sat Dec  9 02:31:21 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