[pypy-svn] r55328 - pypy/branch/oo-jit/pypy/jit/codegen/cli

antocuni at codespeak.net antocuni at codespeak.net
Wed May 28 11:00:43 CEST 2008


Author: antocuni
Date: Wed May 28 11:00:41 2008
New Revision: 55328

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
Log:
(antocuni, cfbolz)

Don't create new variables unless needed (might be better)



Modified: pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/cli/rgenop.py	Wed May 28 11:00:41 2008
@@ -477,10 +477,15 @@
         self.appendop(op)
 
     def enter_next_block(self, args_gv):
+        seen = {}
         for i in range(len(args_gv)):
-            op = ops.SameAs(self, args_gv[i])
-            self.appendop(op)
-            args_gv[i] = op.gv_res()
+            gv = args_gv[i]
+            if isinstance(gv, GenConst) or gv in seen:
+                op = ops.SameAs(self, gv)
+                self.appendop(op)
+                args_gv[i] = op.gv_res()
+            else:
+                seen[gv] = None
         label = self.graphbuilder.il.DefineLabel()
         self.appendop(ops.MarkLabel(self, label))
         return Label(label, args_gv)



More information about the Pypy-commit mailing list