[pypy-svn] r73908 - pypy/branch/blackhole-improvement/pypy/jit/codewriter

arigo at codespeak.net arigo at codespeak.net
Tue Apr 20 14:57:25 CEST 2010


Author: arigo
Date: Tue Apr 20 14:57:24 2010
New Revision: 73908

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/regalloc.py
Log:
Fix.


Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/regalloc.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/regalloc.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/regalloc.py	Tue Apr 20 14:57:24 2010
@@ -36,21 +36,26 @@
             for link in block.exits:
                 for v in link.args:
                     die_at.pop(v, None)
-            # Add the variables of this block to the dependency graph
-            for i, v in enumerate(block.inputargs):
-                dg.add_node(v)
-                for j in range(i):
-                    dg.add_edge(block.inputargs[j], v)
             die_at = [(value, key) for (key, value) in die_at.items()]
             die_at.sort()
             die_at.append((sys.maxint,))
             # Done.  XXX the code above this line runs 3 times
             # (for kind in KINDS) to produce the same result...
-            livevars = set(block.inputargs)
+            livevars = [v for v in block.inputargs
+                          if getkind(v.concretetype) == self.kind]
+            # Add the variables of this block to the dependency graph
+            for i, v in enumerate(livevars):
+                dg.add_node(v)
+                for j in range(i):
+                    dg.add_edge(livevars[j], v)
+            livevars = set(livevars)
             die_index = 0
             for i, op in enumerate(block.operations):
                 while die_at[die_index][0] == i:
-                    livevars.remove(die_at[die_index][1])
+                    try:
+                        livevars.remove(die_at[die_index][1])
+                    except KeyError:
+                        pass
                     die_index += 1
                 if getkind(op.result.concretetype) == self.kind:
                     livevars.add(op.result)



More information about the Pypy-commit mailing list