[pypy-commit] pypy vecopt: all tests zjit test passing again

plan_rich noreply at buildbot.pypy.org
Thu Jul 9 16:43:46 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt
Changeset: r78510:a3f009cd3dc4
Date: 2015-07-09 16:43 +0200
http://bitbucket.org/pypy/pypy/changeset/a3f009cd3dc4/

Log:	all tests zjit test passing again

diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -307,7 +307,7 @@
     def locs_for_fail(self, guard_op):
         faillocs = []
         descr = guard_op.getdescr()
-        for arg in guard_op.getfailargs():
+        for i,arg in enumerate(guard_op.getfailargs()):
             if arg is None:
                 faillocs.append(None)
                 continue
@@ -315,13 +315,13 @@
             if accum:
                 loc = self.loc(accum.getoriginalbox())
                 faillocs.append(loc)
-                self.update_accumulation_loc(arg, accum, descr)
+                self.update_accumulation_loc(arg, accum, descr, i)
             else:
                 faillocs.append(self.loc(arg))
 
         return faillocs
 
-    def update_accumulation_loc(self, arg, accum, descr):
+    def update_accumulation_loc(self, arg, accum, descr, pos):
         """
         Faillocs saved on the guard can only represent one value.
         Accumulation has the accumulation box which need to updated uppon
@@ -333,6 +333,7 @@
         while accum_info:
             if accum_info.box is accum.getoriginalbox():
                 accum_info.loc = self.loc(arg)
+                accum_info.position = pos
                 break
             accum_info = accum_info.prev
         else:
diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -746,7 +746,7 @@
 
 class LoopVersion(object):
 
-    def __init__(self, operations, opt_ops, aligned=False):
+    def __init__(self, operations, opt_ops, invariant_arg_count=0, aligned=False):
         self.operations = operations
         self.aligned = aligned
         self.faildescrs = []
@@ -759,6 +759,14 @@
         idx = index_of_first(rop.LABEL, opt_ops)
         assert idx >= 0
         version_failargs = opt_ops[idx].getarglist()
+        if invariant_arg_count > 0:
+            # constant/variable expansion append arguments to the label
+            # if they are not removed, the register allocator cannot
+            # reconstruct the binding if len(inputargs) != len(faillocs)
+            to = len(version_failargs) - invariant_arg_count
+            assert to >= 0
+            version_failargs = version_failargs[:to]
+
         for op in opt_ops:
             if op.is_guard():
                 descr = op.getdescr()
diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py b/rpython/jit/metainterp/optimizeopt/vectorize.py
--- a/rpython/jit/metainterp/optimizeopt/vectorize.py
+++ b/rpython/jit/metainterp/optimizeopt/vectorize.py
@@ -54,7 +54,7 @@
         gso = GuardStrengthenOpt(opt.dependency_graph.index_vars)
         gso.propagate_all_forward(opt.loop)
         # loop versioning
-        loop.versions = [LoopVersion(orig_ops, loop.operations)]
+        loop.versions = [LoopVersion(orig_ops, loop.operations, opt.appended_arg_count)]
         #
         #
         end = time.clock()
@@ -116,6 +116,7 @@
         self.sched_data = None
         self.cpu = metainterp_sd.cpu
         self.costmodel = X86_CostModel(cost_threshold, self.cpu.vector_register_size)
+        self.appended_arg_count = 0
 
     def propagate_all_forward(self, clear=True):
         self.clear_newoperations()
@@ -470,6 +471,7 @@
             return
         if vector:
             # add accumulation info to the descriptor
+            self.appended_arg_count = len(sched_data.invariant_vector_vars)
             for guard_node in self.dependency_graph.guards:
                 op = guard_node.getoperation()
                 failargs = op.getfailargs()


More information about the pypy-commit mailing list