Commits

Maciej Fijalkowski committed 1f54758

(fijal, rguillebert) fix enough to pass the first test of test_loop (again)

Comments (0)

Files changed (5)

rpython/jit/metainterp/optimizeopt/util.py

 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib.unroll import unrolling_iterable
 from rpython.jit.metainterp import resoperation
+from rpython.jit.metainterp.history import Box
 from rpython.rlib.debug import make_sure_not_resized
 from rpython.jit.metainterp.resoperation import rop
 from rpython.rlib.objectmodel import we_are_translated
         for i in range(op1.numargs()):
             x = op1.getarg(i)
             y = op2.getarg(i)
-            if cache and y not in remap:
+            if cache and isinstance(y, Box) and y not in remap:
                 remap[y] = x
             assert x.same_box(remap.get(y, y))
         if op2.result in remap:

rpython/jit/metainterp/pyjitpl.py

         # but we should not follow calls to that graph
         return self.do_residual_call(funcbox, argboxes, calldescr, pc)
 
-    def emit_resume_data(self, pos, in_call):
-        i = 0
-        history = self.metainterp.history
-        boxes = self.get_list_of_active_boxes(in_call)
-        #xxx
-        #xxx
-        for i in range(self.jitcode.num_regs_i()):
-            box = self.registers_i[i]
-            if box is not None and (box, pos, i) not in self.resume_cache:
-                history.record(rop.RESUME_PUT,
-                               [box, ConstInt(pos), ConstInt(i)], None)
-                self.resume_cache[(box, pos, i)] = None
-        start = self.jitcode.num_regs_i()
-        for i in range(self.jitcode.num_regs_r()):
-            box = self.registers_r[i]
-            if box is not None and (box, pos, i) not in self.resume_cache:
-                history.record(rop.RESUME_PUT,
-                               [box, ConstInt(pos), ConstInt(i + start)], None)
-                self.resume_cache[(box, pos, i)] = None
-        start = self.jitcode.num_regs_i() + self.jitcode.num_regs_r()
-        for i in range(self.jitcode.num_regs_f()):
-            box = self.registers_f[i]
-            if box is not None and (box, pos, i) not in self.resume_cache:
-                history.record(rop.RESUME_PUT,
-                               [box, ConstInt(pos), ConstInt(i + start)], None)
-                self.resume_cache[(box, pos, i)] = None
-        history.record(rop.RESUME_SET_PC, [ConstInt(self.pc)], None)
-
 # ____________________________________________________________
 
 class MetaInterpStaticData(object):

rpython/jit/metainterp/resume2.py

             self.process_box(index + start_f, frame_pos,
                              frame.registers_i[index])
 
-        history = self.metainterp.history
+        mi_history = self.metainterp.history
         cache = self.cachestack[frame_pos]
         for i in range(len(self.marked)):
             if self.marked[i] is None and cache[i] is not None:
                 cache[i] = None
-                history.record(rop.RESUME_CLEAR, [ConstInt(frame_pos),
+                mi_history.record(rop.RESUME_CLEAR, [ConstInt(frame_pos),
                                                   ConstInt(i)], None)
-        history.record(rop.RESUME_SET_PC, [ConstInt(resume_pc)], None)
+        if resume_pc == -1:
+            resume_pc = self.metainterp.framestack[-1].pc
+        mi_history.record(rop.RESUME_SET_PC, [ConstInt(resume_pc)], None)
         self.marked = None

rpython/jit/metainterp/test/test_resume2.py

         expected = parse("""
         [i0, i1, i2]
         enter_frame(-1, descr=jitcode)
-        resume_put(i0, 0, 0)
+        resume_put(i0, 0, 2)
         resume_put(i1, 0, 1)
-        resume_put(i2, 0, 2)
+        resume_put(i2, 0, 0)
         resume_set_pc(24)
         """, namespace={'jitcode': jitcode})
         equaloplists(resume_ops, expected.operations, cache=True)
         expected = parse("""
         [i0, i1, i2]
         enter_frame(-1, descr=jitcode)
-        resume_put(i0, 0, 0)
-        resume_put(i1, 0, 1)
+        resume_put(i0, 0, 1)
+        resume_put(i1, 0, 0)
         resume_set_pc(16)
         leave_frame()
         """, namespace={'jitcode': jitcode})
         expected = parse("""
         [i0, i1, i2]
         enter_frame(-1, descr=jitcode)
-        resume_put(i0, 0, 0)
+        resume_put(i0, 0, 2)
         resume_put(i1, 0, 1)
-        resume_put(i2, 0, 2)
-        resume_set_pc(-1)
+        resume_put(i2, 0, 0)
+        resume_set_pc(16)
         resume_clear(0, 1)
-        resume_set_pc(-1)
+        resume_set_pc(21)
         leave_frame()
         """, namespace={'jitcode': jitcode})
         equaloplists(resume_ops, expected.operations, cache=True)

rpython/jit/metainterp/warmspot.py

                 len(self.jitdrivers_sd)), \
                 "there are multiple jit_merge_points with the same jitdriver"
 
-    def split_graph_and_record_jitdriver(self, graph, block, pos):
+    def split_graph_and_record_jitdriver(self, orig_graph, block, pos):
         op = block.operations[pos]
         args = op.args[2:]
         s_binding = self.translator.annotator.binding
-        graph = copygraph(graph)
+        graph = copygraph(orig_graph)
         [jmpp] = find_jit_merge_points([graph])
         graph.startblock = support.split_before_jit_merge_point(*jmpp)
         # XXX this is incredibly obscure, but this is sometiems necessary
         assert hasattr(graph, "func")
         graph.func._dont_inline_ = True
         graph.func._jit_unroll_safe_ = True
-        result_type = history.getkind(graph.getreturnvar().concretetype)[0]
+        result_type = history.getkind(orig_graph.getreturnvar().concretetype)[0]
         jd = JitDriverStaticData(block.operations[pos].args[1].value, graph,
                                  result_type)
         jd._portal_args_s = [s_binding(v) for v in args]
-        jd._jit_merge_point_in = graph
+        jd._jit_merge_point_in = orig_graph
         jd.portal_runner_ptr = "<not set so far>"
         self.jitdrivers_sd.append(jd)