[pypy-svn] r7387 - in pypy/trunk/src/pypy: annotation translator/tool/pygame

arigo at codespeak.net arigo at codespeak.net
Thu Nov 18 16:31:42 CET 2004


Author: arigo
Date: Thu Nov 18 16:31:41 2004
New Revision: 7387

Modified:
   pypy/trunk/src/pypy/annotation/model.py
   pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py
Log:
Debugging: for SomeObjects created by unionof(), remember the objects that
this one is the union of.



Modified: pypy/trunk/src/pypy/annotation/model.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/model.py	(original)
+++ pypy/trunk/src/pypy/annotation/model.py	Thu Nov 18 16:31:41 2004
@@ -62,11 +62,17 @@
         except AttributeError:
             pass
         else:
-            SomeObject._coming_from[id(self)] = position_key
+            SomeObject._coming_from[id(self)] = position_key, None
         return self
     def origin(self):
-        return SomeObject._coming_from.get(id(self), None)
+        return SomeObject._coming_from.get(id(self), (None, None))[0]
     origin = property(origin)
+    def caused_by_merge(self):
+        return SomeObject._coming_from.get(id(self), (None, None))[1]
+    def set_caused_by_merge(self, nvalue):
+        SomeObject._coming_from[id(self)] = self.origin, nvalue
+    caused_by_merge = property(caused_by_merge, set_caused_by_merge)
+    del set_caused_by_merge
 
 
 class SomeInteger(SomeObject):
@@ -190,6 +196,8 @@
     for s2 in somevalues:
         if s1 != s2:
             s1 = pair(s1, s2).union()
+    if s1.caused_by_merge is None and len(somevalues) > 1:
+        s1.caused_by_merge = somevalues
     return s1
 
 def ishashable(x):

Modified: pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/pygame/flowviewer.py	Thu Nov 18 16:31:41 2004
@@ -30,6 +30,10 @@
             label += "\\n" + self.createlink(info.origin, 'Originated at')
         if caused_by is not None:
             label += '\\n' + self.createlink(caused_by.position_key)
+        if info.caused_by_merge is not None:
+            data = 'unionof%r' % (info.caused_by_merge,)
+            label += '\\n%s' % nottoowide(data)
+        
         dotgen.emit_node('0', shape="box", color="red", label=label)
         for n, (data, caused_by) in zip(range(len(history)), history):
             label = nottoowide(data)



More information about the Pypy-commit mailing list