[pypy-svn] r11973 - pypy/dist/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Thu May 5 19:09:37 CEST 2005


Author: arigo
Date: Thu May  5 19:09:36 2005
New Revision: 11973

Modified:
   pypy/dist/pypy/annotation/classdef.py
Log:
annotator's optimization.

Modified: pypy/dist/pypy/annotation/classdef.py
==============================================================================
--- pypy/dist/pypy/annotation/classdef.py	(original)
+++ pypy/dist/pypy/annotation/classdef.py	Thu May  5 19:09:36 2005
@@ -91,8 +91,15 @@
     def add_source_for_attribute(self, attr, source, clsdef=None):
         attrdef = self.find_attribute(attr)
         attrdef.sources[source] = clsdef
-        for position in attrdef.read_locations:
-            self.bookkeeper.annotator.reflowfromposition(position)
+        if attrdef.read_locations:
+            # we should reflow from all the reader's position,
+            # but as an optimization we try to see if the attribute
+            # has really been generalized
+            s_prev_value = attrdef.s_value
+            s_next_value = attrdef.getvalue()
+            if s_prev_value != s_next_value:
+                for position in attrdef.read_locations:
+                    self.bookkeeper.annotator.reflowfromposition(position)
 
     def locate_attribute(self, attr):
         for cdef in self.getmro():



More information about the Pypy-commit mailing list