Author: fijal Branch: jit-leaner-frontend Changeset: r82842:c6a2a4c8c114 Date: 2016-03-07 11:15 +0200 http://bitbucket.org/pypy/pypy/changeset/c6a2a4c8c114/
Log: get to the point of running into problems with unrolling diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -48,7 +48,7 @@ def optimize_loop(self, ops, expected, expected_preamble=None, call_pure_results=None, expected_short=None, jump_values=None): - loop = self.parse(ops, postprocess=self.postprocess) + loop = self.parse(ops) self.set_values(loop.operations, jump_values) if expected != "crash!": expected = self.parse(expected) diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py --- a/rpython/jit/metainterp/optimizeopt/test/test_util.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py @@ -516,7 +516,7 @@ def add_guard_future_condition(self, res): # invent a GUARD_FUTURE_CONDITION to not have to change all tests if res.operations[-1].getopnum() == rop.JUMP: - guard = ResOperation(rop.GUARD_FUTURE_CONDITION, [], None) + guard = ResOperation(rop.GUARD_FUTURE_CONDITION, []) guard.rd_snapshot = resume.TopSnapshot(None, [], []) res.operations.insert(-1, guard) @@ -553,13 +553,19 @@ call_pure_results[list(k)] = v return call_pure_results - def convert_loop_to_packed(self, loop): + def convert_loop_to_packed(self, loop, skip_last=False): from rpython.jit.metainterp.opencoder import Trace trace = Trace(loop.inputargs) - for op in loop.operations: + ops = loop.operations + if skip_last: + ops = ops[:-1] + for op in ops: newop = trace.record_op(op.getopnum(), op.getarglist(), op.getdescr()) if rop.is_guard(op.getopnum()): - frame = FakeFrame(op.getfailargs()) + failargs = [] + if op.getfailargs(): + failargs = op.getfailargs() + frame = FakeFrame(failargs) resume.capture_resumedata([frame], None, [], trace) op.position = newop.position return trace @@ -568,18 +574,18 @@ self.add_guard_future_condition(loop) jump_op = loop.operations[-1] assert jump_op.getopnum() == rop.JUMP - ops = loop.operations[:-1] jump_op.setdescr(JitCellToken()) start_label = ResOperation(rop.LABEL, loop.inputargs, - jump_op.getdescr()) + descr=jump_op.getdescr()) end_label = jump_op.copy_and_change(opnum=rop.LABEL) call_pure_results = self._convert_call_pure_results(call_pure_results) - preamble_data = compile.LoopCompileData(start_label, end_label, ops, + t = self.convert_loop_to_packed(loop, skip_last=True) + preamble_data = compile.LoopCompileData(start_label, end_label, t, call_pure_results) start_state, preamble_ops = self._do_optimize_loop(preamble_data) preamble_data.forget_optimization_info() loop_data = compile.UnrolledLoopData(start_label, jump_op, - ops, start_state, + t, start_state, call_pure_results) loop_info, ops = self._do_optimize_loop(loop_data) preamble = TreeLoop('preamble') diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py b/rpython/jit/metainterp/optimizeopt/unroll.py --- a/rpython/jit/metainterp/optimizeopt/unroll.py +++ b/rpython/jit/metainterp/optimizeopt/unroll.py @@ -115,6 +115,7 @@ return modifier.get_virtual_state(args) def _check_no_forwarding(self, lsts, check_newops=True): + return for lst in lsts: for op in lst: assert op.get_forwarded() is None @@ -134,9 +135,9 @@ self.optimizer._clean_optimization_info(self.optimizer._newoperations) return exported_state, self.optimizer._newoperations - def optimize_peeled_loop(self, start_label, end_jump, ops, state, + def optimize_peeled_loop(self, start_label, end_jump, trace, state, call_pure_results, inline_short_preamble=True): - self._check_no_forwarding([[start_label, end_jump], ops]) + #self._check_no_forwarding([[start_label, end_jump], ops]) try: label_args = self.import_state(start_label, state) except VirtualStatesCantMatch: @@ -145,11 +146,11 @@ self.optimizer.init_inparg_dict_from(label_args) try: info, _ = self.optimizer.propagate_all_forward( - start_label.getarglist()[:], ops, call_pure_results, False, - flush=False) + trace, call_pure_results, flush=False) except SpeculativeError: raise InvalidLoop("Speculative heap access would be ill-typed") - label_op = ResOperation(rop.LABEL, label_args, start_label.getdescr()) + label_op = ResOperation(rop.LABEL, label_args, + descr=start_label.getdescr()) for a in end_jump.getarglist(): self.optimizer.force_box_for_end_of_preamble( self.optimizer.get_box_replacement(a)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit