[pypy-svn] r22846 - in pypy/dist/pypy: annotation jit translator/tool translator/tool/pygame

arigo at codespeak.net arigo at codespeak.net
Sun Jan 29 16:19:24 CET 2006


Author: arigo
Date: Sun Jan 29 16:19:19 2006
New Revision: 22846

Modified:
   pypy/dist/pypy/annotation/model.py
   pypy/dist/pypy/jit/hintmodel.py
   pypy/dist/pypy/translator/tool/graphpage.py
   pypy/dist/pypy/translator/tool/pygame/drawgraph.py
   pypy/dist/pypy/translator/tool/pygame/graphdisplay.py
Log:
(arre, pedronis, arigo)

Nice colors in the pygame flow graph viewer :-)


Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Sun Jan 29 16:19:19 2006
@@ -447,6 +447,7 @@
     """The empty set.  Instances are placeholders for objects that
     will never show up at run-time, e.g. elements of an empty list."""
     immutable = True
+    annotationcolor = (160,160,160)
 
     def can_be_none(self):
         return False

Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py	(original)
+++ pypy/dist/pypy/jit/hintmodel.py	Sun Jan 29 16:19:19 2006
@@ -59,13 +59,24 @@
             lst.append(s)
         return '<%s>' % (', '.join(lst),)
 
+    def annotationcolor(self):
+        """Compute the color of the variables with this annotation
+        for the pygame viewer
+        """
+        for o in self.origins:
+            if not o.fixed:
+                return None
+        return (50,140,0)
+    annotationcolor = property(annotationcolor)
+
 class SomeLLConcreteValue(SomeLLAbstractValue):
-    pass
+    annotationcolor = (0,100,0)
 
 class SomeLLAbstractVariable(SomeLLAbstractValue):
     pass
 
 class SomeLLAbstractContainer(SomeLLAbstractValue):
+    annotationcolor = (0,60,160)
 
     def __init__(self, contentdef):
         self.contentdef = contentdef

Modified: pypy/dist/pypy/translator/tool/graphpage.py
==============================================================================
--- pypy/dist/pypy/translator/tool/graphpage.py	(original)
+++ pypy/dist/pypy/translator/tool/graphpage.py	Sun Jan 29 16:19:19 2006
@@ -143,7 +143,8 @@
         if self.annotator:
             for var, s_value in self.annotator.bindings.items():
                 info = '%s: %s' % (var.name, s_value)
-                self.links[var.name] = info
+                annotationcolor = getattr(s_value, 'annotationcolor', None)
+                self.links[var.name] = info, annotationcolor
                 self.current_value[var.name] = s_value
                 self.caused_by[var.name] = (
                     self.annotator.binding_caused_by.get(var))
@@ -151,6 +152,10 @@
                 cause_history = (
                     self.annotator.binding_cause_history.get(var, []))
                 self.binding_history[var.name] = zip(history, cause_history)
+                    
+        from pypy.jit import hintannotator
+        if isinstance(self.annotator, hintannotator.HintAnnotator):
+            return
 
         def visit(node):
             if isinstance(node, Block):
@@ -165,11 +170,6 @@
                     #info = '(%s) %s' % (var.concretetype, info)
                     info = str(var.concretetype)
                     self.links[var.name] = info
-                    
-        from pypy.jit import hintannotator
-
-        if isinstance(self.annotator, hintannotator.HintAnnotator):
-            return
 
         for graph in graphs:
             traverse(visit, graph)

Modified: pypy/dist/pypy/translator/tool/pygame/drawgraph.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pygame/drawgraph.py	(original)
+++ pypy/dist/pypy/translator/tool/pygame/drawgraph.py	Sun Jan 29 16:19:19 2006
@@ -264,10 +264,17 @@
         self.visibleedges = []
 
     def wordcolor(self, word):
+        info = self.highlightwords[word]
+        if isinstance(info, tuple) and len(info) >= 2:
+            color = info[1]
+        else:
+            color = None
+        if color is None:
+            color = (128,0,0)
         if word == self.highlight_word:
-            return ((255,255,80), (128,0,0))
+            return ((255,255,80), color)
         else:
-            return ((128,0,0), None)
+            return (color, None)
 
     def setscale(self, scale):
         scale = max(min(scale, self.SCALEMAX), self.SCALEMIN)

Modified: pypy/dist/pypy/translator/tool/pygame/graphdisplay.py
==============================================================================
--- pypy/dist/pypy/translator/tool/pygame/graphdisplay.py	(original)
+++ pypy/dist/pypy/translator/tool/pygame/graphdisplay.py	Sun Jan 29 16:19:19 2006
@@ -451,6 +451,8 @@
         word = self.viewer.at_position(pos)
         if word in self.layout.links:
             info = self.layout.links[word]
+            if isinstance(info, tuple):
+                info = info[0]
             self.setstatusbar(info)
             self.sethighlight(word)
             return



More information about the Pypy-commit mailing list