Author: Richard Plangger <planri...@gmail.com> Branch: ppc-vsx-support Changeset: r85773:7991ed15f296 Date: 2016-07-19 17:00 +0200 http://bitbucket.org/pypy/pypy/changeset/7991ed15f296/
Log: resolve another issue, regalloc must free var if it is a ref type diff --git a/rpython/jit/backend/llsupport/rewrite.py b/rpython/jit/backend/llsupport/rewrite.py --- a/rpython/jit/backend/llsupport/rewrite.py +++ b/rpython/jit/backend/llsupport/rewrite.py @@ -1,5 +1,5 @@ from rpython.rlib import rgc -from rpython.rlib.objectmodel import we_are_translated, r_dict +from rpython.rlib.objectmodel import we_are_translated, r_dict, always_inline from rpython.rlib.rarithmetic import ovfcheck, highest_bit from rpython.rtyper.lltypesystem import llmemory, lltype, rstr from rpython.rtyper.annlowlevel import cast_instance_to_gcref @@ -159,8 +159,8 @@ def _emit_mul_if_factor_offset_not_supported(self, index_box, factor, offset): - factor, offset, new_index_box = cpu_simplify_scale(self.cpu, index_box, factor, offset) - if new_index_box is not None and index_box is not new_index_box: + factor, offset, new_index_box, emit = cpu_simplify_scale(self.cpu, index_box, factor, offset) + if emit: self.emit_op(new_index_box) return factor, offset, new_index_box @@ -956,11 +956,12 @@ self.gcrefs_recently_loaded[index] = load_op return load_op +@always_inline def cpu_simplify_scale(cpu, index_box, factor, offset): # Returns (factor, offset, index_box, [ops]) where index_box is either # a non-constant BoxInt or None. if isinstance(index_box, ConstInt): - return 1, index_box.value * factor + offset, None + return 1, index_box.value * factor + offset, None, False else: if factor != 1 and factor not in cpu.load_supported_factors: # the factor is supported by the cpu @@ -972,6 +973,6 @@ else: index_box = ResOperation(rop.INT_MUL, [index_box, ConstInt(factor)]) - factor = 1 - return factor, offset, index_box + return 1, offset, index_box, True + return factor, offset, index_box, False diff --git a/rpython/jit/backend/llsupport/vector_ext.py b/rpython/jit/backend/llsupport/vector_ext.py --- a/rpython/jit/backend/llsupport/vector_ext.py +++ b/rpython/jit/backend/llsupport/vector_ext.py @@ -114,8 +114,8 @@ opnum in (rop.GETARRAYITEM_RAW_I, rop.GETARRAYITEM_RAW_F): itemsize, ofs, sign = unpack_arraydescr(op.getdescr()) index_box = op.getarg(1) - _, _, changed = cpu_simplify_scale(state.cpu, index_box, itemsize, ofs) - if changed is not index_box: + _, _, changed, emit = cpu_simplify_scale(state.cpu, index_box, itemsize, ofs) + if emit: state.oplist.append(changed) op.setarg(1, changed) @@ -133,8 +133,8 @@ if opnum in (rop.SETARRAYITEM_GC, rop.SETARRAYITEM_RAW): itemsize, basesize, _ = unpack_arraydescr(op.getdescr()) index_box = op.getarg(1) - _, _, changed = cpu_simplify_scale(state.cpu, index_box, itemsize, basesize) - if changed is not index_box: + _, _, changed, emit = cpu_simplify_scale(state.cpu, index_box, itemsize, basesize) + if emit: state.oplist.append(changed) op.setarg(1, changed) diff --git a/rpython/jit/backend/ppc/regalloc.py b/rpython/jit/backend/ppc/regalloc.py --- a/rpython/jit/backend/ppc/regalloc.py +++ b/rpython/jit/backend/ppc/regalloc.py @@ -274,7 +274,7 @@ self.vrm.possibly_free_var(var) elif var.type == FLOAT: self.fprm.possibly_free_var(var) - elif var.type == INT: + else: self.rm.possibly_free_var(var) def possibly_free_vars(self, vars): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit