Author: Hakan Ardo <ha...@debian.org>
Branch: jit-usable_retrace_3
Changeset: r59613:0f1ddcb9d612
Date: 2012-12-28 16:32 +0100
http://bitbucket.org/pypy/pypy/changeset/0f1ddcb9d612/

Log:    reuse preamble boxnames as far as possible to reduce the amount of
        SAME_AS ops

diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -252,14 +252,20 @@
         assert jumpop.getopnum() == rop.JUMP
         preamble.operations = preamble.operations[1:-1]
         
-        newargs = [a.clonebox() for a in jumpop.getarglist()]
+        usedboxes = {}
+        newargs = [None] * jumpop.numargs()
         for i in range(jumpop.numargs()):
-            a1, a2 = jumpop.getarg(i), newargs[i]
-            preamble.operations.append(ResOperation(rop.SAME_AS, [a1], a2))
+            arg = jumpop.getarg(i)
+            if isinstance(arg, Const) or arg in usedboxes:
+                newargs[i] = arg.clonebox()
+                preamble.operations.append(ResOperation(rop.SAME_AS, [arg], 
newargs[i]))
+            else:
+                newargs[i] = arg
+                usedboxes[arg] = True
 
         inliner = Inliner(loop.operations[0].getarglist(), newargs)
         loop.operations = [inliner.inline_op(op, clone=False) for op in 
loop.operations]
-        
+
 
     except InvalidLoop:
         preamble.operations = [orignial_label] + \
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to