[pypy-svn] r51224 - in pypy/dist/pypy: annotation jit/hintannotator tool/algo tool/algo/test translator/backendopt

xoraxax at codespeak.net xoraxax at codespeak.net
Sun Feb 3 11:59:57 CET 2008


Author: xoraxax
Date: Sun Feb  3 11:59:55 2008
New Revision: 51224

Modified:
   pypy/dist/pypy/annotation/description.py
   pypy/dist/pypy/annotation/specialize.py
   pypy/dist/pypy/jit/hintannotator/bookkeeper.py
   pypy/dist/pypy/tool/algo/test/test_unionfind.py
   pypy/dist/pypy/tool/algo/unionfind.py
   pypy/dist/pypy/translator/backendopt/malloc.py
Log:
Refactor UnionFind API. It calls absorb instead of update now.


Modified: pypy/dist/pypy/annotation/description.py
==============================================================================
--- pypy/dist/pypy/annotation/description.py	(original)
+++ pypy/dist/pypy/annotation/description.py	Sun Feb  3 11:59:55 2008
@@ -26,6 +26,7 @@
         for shape, table in other.calltables.items():
             for row in table:
                 self.calltable_add_row(shape, row)
+    absorb = update # UnionFind API
 
     def calltable_lookup_row(self, callshape, row):
         # this code looks up a table of which graph to
@@ -63,6 +64,7 @@
         self.descs.update(other.descs)
         self.read_locations.update(other.read_locations)
         self.attrs.update(other.attrs)
+    absorb = update # UnionFind API
 
     def get_s_value(self, attrname):
         try:
@@ -100,6 +102,7 @@
         self.descs.update(other.descs)
         self.read_locations.update(other.read_locations)
         self.s_value = unionof(self.s_value, other.s_value)
+    absorb = update # UnionFind API
 
     def get_s_value(self, attrname):
         return self.s_value

Modified: pypy/dist/pypy/annotation/specialize.py
==============================================================================
--- pypy/dist/pypy/annotation/specialize.py	(original)
+++ pypy/dist/pypy/annotation/specialize.py	Sun Feb  3 11:59:55 2008
@@ -102,12 +102,10 @@
         bookkeeper = self.funcdesc.bookkeeper
         bookkeeper.pending_specializations.append(self.finish)
 
-    def update(self, other):
+    def absorb(self, other):
         self.table.update(other.table)
         self.graph = None   # just in case
-
-    def cleanup(self):
-        self.do_not_process = True
+        other.do_not_process = True
 
     fieldnamecounter = 0
 

Modified: pypy/dist/pypy/jit/hintannotator/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/jit/hintannotator/bookkeeper.py	(original)
+++ pypy/dist/pypy/jit/hintannotator/bookkeeper.py	Sun Feb  3 11:59:55 2008
@@ -110,6 +110,7 @@
 
     def update(self, other):
         self.tsgraphs.update(other.tsgraphs)
+    absorb = update # UnionFind API
 
 
 class ImpurityAnalyzer(graphanalyze.GraphAnalyzer):

Modified: pypy/dist/pypy/tool/algo/test/test_unionfind.py
==============================================================================
--- pypy/dist/pypy/tool/algo/test/test_unionfind.py	(original)
+++ pypy/dist/pypy/tool/algo/test/test_unionfind.py	Sun Feb  3 11:59:55 2008
@@ -8,11 +8,8 @@
             state.append(self)
             self.obj = obj
 
-        def update(self, other):
-            pass
-
-        def cleanup(self):
-            state.remove(self)
+        def absorb(self, other):
+            state.remove(other)
 
     uf = UnionFind(ReferencedByExternalState)
     uf.find(1)

Modified: pypy/dist/pypy/tool/algo/unionfind.py
==============================================================================
--- pypy/dist/pypy/tool/algo/unionfind.py	(original)
+++ pypy/dist/pypy/tool/algo/unionfind.py	Sun Feb  3 11:59:55 2008
@@ -82,13 +82,11 @@
             rep1, rep2, info1, info2, = rep2, rep1, info2, info1
 
         if info1 is not None:
-            info1.update(info2)
+            info1.absorb(info2)
 
         self.link_to_parent[rep2] = rep1
 
         del self.weight[rep2]
-        if hasattr(info2, "cleanup"):
-            info2.cleanup()
         del self.root_info[rep2]
 
         self.weight[rep1] = w

Modified: pypy/dist/pypy/translator/backendopt/malloc.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/malloc.py	(original)
+++ pypy/dist/pypy/translator/backendopt/malloc.py	Sun Feb  3 11:59:55 2008
@@ -15,11 +15,12 @@
         self.creationpoints = {}   # set of ("type of creation point", ...)
         self.usepoints = {}        # set of ("type of use point",      ...)
 
-    def update(self, other):
+    def absorb(self, other):
         self.variables.update(other.variables)
         self.creationpoints.update(other.creationpoints)
         self.usepoints.update(other.usepoints)
 
+
 class BaseMallocRemover(object):
 
     IDENTITY_OPS = ('same_as',)



More information about the Pypy-commit mailing list