Commits

Hakan Ardo committed 0f1ddcb

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

  • Participants
  • Parent commits 496a110
  • Branches jit-usable_retrace_3

Comments (0)

Files changed (1)

pypy/jit/metainterp/compile.py

         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] + \