Author: Maciej Fijalkowski <fij...@gmail.com> Branch: optresult-unroll Changeset: r78913:838e242ff7a9 Date: 2015-08-11 16:38 +0200 http://bitbucket.org/pypy/pypy/changeset/838e242ff7a9/
Log: hack hack hack diff --git a/rpython/jit/metainterp/optimizeopt/pure.py b/rpython/jit/metainterp/optimizeopt/pure.py --- a/rpython/jit/metainterp/optimizeopt/pure.py +++ b/rpython/jit/metainterp/optimizeopt/pure.py @@ -146,8 +146,11 @@ old_op = self.optimizer._newoperations[pos] if self.optimize_call_pure(op, old_op): return - for old_op in self.extra_call_pure: + for i, old_op in enumerate(self.extra_call_pure): if self.optimize_call_pure(op, old_op): + if isinstance(old_op, PreambleOp): + old_op = self.optimizer.force_op_from_preamble(old_op) + self.extra_call_pure[i] = old_op return # replace CALL_PURE with just CALL @@ -181,6 +184,9 @@ # all identical # this removes a CALL_PURE that has the same (non-constant) # arguments as a previous CALL_PURE. + if isinstance(old_op, PreambleOp): + # xxx obscure, it's dealt with in the caller + old_op = old_op.op self.make_equal_to(op, old_op) self.last_emitted_operation = REMOVED return True @@ -226,11 +232,9 @@ if op.is_ovf() and ops[i + 1].getopnum() == rop.GUARD_NO_OVERFLOW: sb.add_pure_op(op) for i in self.call_pure_positions: - yyy op = ops[i] - assert op.getopnum() == rop.CALL - op = op.copy_and_change(rop.CALL_PURE) - sb.add_potential(op) + assert op.is_call() + sb.add_pure_op(op) dispatch_opt = make_dispatcher_method(OptPure, 'optimize_', default=OptPure.optimize_default) diff --git a/rpython/jit/metainterp/optimizeopt/shortpreamble.py b/rpython/jit/metainterp/optimizeopt/shortpreamble.py --- a/rpython/jit/metainterp/optimizeopt/shortpreamble.py +++ b/rpython/jit/metainterp/optimizeopt/shortpreamble.py @@ -20,6 +20,12 @@ self.op = op self.preamble_op = preamble_op + def numargs(self): + return self.op.numargs() + + def getarglist(self): + return self.op.getarglist() + def getarg(self, i): return self.op.getarg(i) @@ -68,7 +74,10 @@ if optpure is None: return op = self.res - opt.pure(op.getopnum(), PreambleOp(op, preamble_op)) + if op.is_call(): + optpure.extra_call_pure.append(PreambleOp(op, preamble_op)) + else: + opt.pure(op.getopnum(), PreambleOp(op, preamble_op)) def __repr__(self): return "PureOp(%r)" % (self.res,) 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 @@ -3653,7 +3653,6 @@ setfield_gc(p1, i1, descr=valuedescr) i3 = call_assembler_i(i1, descr=asmdescr) setfield_gc(p1, i3, descr=valuedescr) - i143 = same_as(i3) # Should be killed by backend jump(p1, i4, i3) ''' self.optimize_loop(ops, ops, preamble) @@ -3678,18 +3677,16 @@ jump(p1, i4, i3) ''' expected = ''' - [p1, i4, i3, i5] - setfield_gc(p1, i5, descr=valuedescr) - jump(p1, i3, i5, i5) + [p1, i4, i3] + setfield_gc(p1, i3, descr=valuedescr) + jump(p1, i3, i3) ''' preamble = ''' [p1, i1, i4] setfield_gc(p1, i1, descr=valuedescr) i3 = call_i(p1, descr=elidablecalldescr) setfield_gc(p1, i3, descr=valuedescr) - i148 = same_as(i3) - i147 = same_as(i3) - jump(p1, i4, i3, i148) + jump(p1, i4, i3) ''' self.optimize_loop(ops, expected, preamble) @@ -3706,9 +3703,9 @@ jump(p1, i4, i3) ''' expected = ''' - [p1, i4, i3, i5] - setfield_gc(p1, i5, descr=valuedescr) - jump(p1, i3, i5, i5) + [p1, i4, i3] + setfield_gc(p1, i3, descr=valuedescr) + jump(p1, i3, i3) ''' preamble = ''' [p1, i1, i4] @@ -3716,9 +3713,9 @@ i3 = call_i(p1, descr=elidable2calldescr) guard_no_exception() [] setfield_gc(p1, i3, descr=valuedescr) - i148 = same_as(i3) - i147 = same_as(i3) - jump(p1, i4, i3, i148) + #i148 = same_as(i3) + #i147 = same_as(i3) + jump(p1, i4, i3) #, i148) ''' self.optimize_loop(ops, expected, preamble) @@ -3957,7 +3954,7 @@ [p0, i1] p3 = force_token() # - p2 = new_with_vtable(ConstClass(jit_virtual_ref_vtable)) + p2 = new_with_vtable(descr=vref_descr) setfield_gc(p2, NULL, descr=virtualforceddescr) setfield_gc(p2, p3, descr=virtualtokendescr) setfield_gc(p0, p2, descr=nextdescr) 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 @@ -21,6 +21,7 @@ def force_op_from_preamble(self, preamble_op): if isinstance(preamble_op, PreambleOp): op = preamble_op.op + self.optimizer.inparg_dict[op] = None # XXX ARGH self.optunroll.short_preamble_producer.use_box(op, self) self.optunroll.potential_extra_ops[op] = preamble_op return op @@ -34,12 +35,6 @@ if i is not None: self.setinfo_from_preamble(item, i, infos) - def is_inputarg(self, op): - if self.optunroll.short_preamble_producer is None: - return op in self.inparg_dict - return (op in self.inparg_dict or - op in self.optunroll.short_preamble_producer.used_boxes) - def setinfo_from_preamble(self, op, preamble_info, exported_infos): op = self.get_box_replacement(op) if isinstance(preamble_info, info.PtrInfo): @@ -76,7 +71,6 @@ become the preamble or entry bridge (don't think there is a distinction anymore)""" - ops_to_import = None short_preamble_producer = None def __init__(self, metainterp_sd, jitdriver_sd, optimizations): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit