[pypy-commit] pypy vecopt2: unrolling now keeps track of the fail arguments and renames them correctly
plan_rich
noreply at buildbot.pypy.org
Tue May 5 09:45:32 CEST 2015
Author: Richard Plangger <rich at pasra.at>
Branch: vecopt2
Changeset: r77084:c458f6903d68
Date: 2015-03-18 17:22 +0100
http://bitbucket.org/pypy/pypy/changeset/c458f6903d68/
Log: unrolling now keeps track of the fail arguments and renames them
correctly
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
@@ -105,18 +105,13 @@
except KeyError:
pass
-
- #if copied_op.is_guard():
- # self.store_final_boxes_in_guard(copied_op, [])
- #failargs = copied_op.getfailargs()
- #if failargs:
- # for i, arg in enumerate(failargs):
- # try:
- # value = rename_map[arg]
- # print(type(copied_op))
- # copied_op.setfailarg(i, value)
- # except KeyError:
- # pass
+ # not only the arguments, but also the fail args need
+ # to be adjusted. rd_snapshot stores the live variables
+ # that are needed to resume.
+ if copied_op.is_guard():
+ new_snapshot = self.clone_snapshot(copied_op.rd_snapshot,
+ rename_map)
+ copied_op.rd_snapshot = new_snapshot
self.emit_unrolled_operation(copied_op)
self.vec_info.inspect_operation(copied_op)
@@ -140,6 +135,23 @@
self._newoperations.append(self.last_debug_merge_point)
self.emit_unrolled_operation(jump_op)
+ def clone_snapshot(self, snapshot, rename_map):
+ # snapshots are nested like the MIFrames
+ if snapshot is None:
+ return None
+ boxes = snapshot.boxes
+ new_boxes = boxes[:]
+ for i,box in enumerate(boxes):
+ try:
+ value = rename_map[box]
+ new_boxes[i] = value
+ except KeyError:
+ pass
+
+ snapshot = Snapshot(self.clone_snapshot(snapshot.prev, rename_map),
+ new_boxes)
+ return snapshot
+
def _gather_trace_information(self, loop, track_memref = False):
self.vec_info.track_memory_refs = track_memref
for i,op in enumerate(loop.operations):
More information about the pypy-commit
mailing list