[pypy-svn] r78021 - pypy/branch/rsre-jit/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Sat Oct 16 17:50:30 CEST 2010


Author: arigo
Date: Sat Oct 16 17:50:28 2010
New Revision: 78021

Modified:
   pypy/branch/rsre-jit/pypy/jit/metainterp/warmspot.py
Log:
Bug fix: backend optimizations may remove some operations and invalidate
the 'index' of an existing operation inside its block.


Modified: pypy/branch/rsre-jit/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/rsre-jit/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/rsre-jit/pypy/jit/metainterp/warmspot.py	Sat Oct 16 17:50:28 2010
@@ -211,9 +211,9 @@
                 "there are multiple jit_merge_points with the same jitdriver"
 
     def split_graph_and_record_jitdriver(self, graph, block, pos):
-        jd = JitDriverStaticData()
-        jd._jit_merge_point_pos = (graph, block, pos)
         op = block.operations[pos]
+        jd = JitDriverStaticData()
+        jd._jit_merge_point_pos = (graph, op)
         args = op.args[2:]
         s_binding = self.translator.annotator.binding
         jd._portal_args_s = [s_binding(v) for v in args]
@@ -457,8 +457,7 @@
             self.make_args_specification(jd)
 
     def make_args_specification(self, jd):
-        graph, block, index = jd._jit_merge_point_pos
-        op = block.operations[index]
+        graph, op = jd._jit_merge_point_pos
         greens_v, reds_v = support.decode_hp_hint_args(op)
         ALLARGS = [v.concretetype for v in (greens_v + reds_v)]
         jd._green_args_spec = [v.concretetype for v in greens_v]
@@ -709,8 +708,14 @@
         # ____________________________________________________________
         # Now mutate origportalgraph to end with a call to portal_runner_ptr
         #
-        _, origblock, origindex = jd._jit_merge_point_pos
-        op = origblock.operations[origindex]
+        _, op = jd._jit_merge_point_pos
+        for origblock in origportalgraph.iterblocks():
+            if op in origblock.operations:
+                break
+        else:
+            assert False, "lost the operation %r in the graph %r" % (
+                op, origportalgraph)
+        origindex = origblock.operations.index(op)
         assert op.opname == 'jit_marker'
         assert op.args[0].value == 'jit_merge_point'
         greens_v, reds_v = support.decode_hp_hint_args(op)



More information about the Pypy-commit mailing list