Author: Maciej Fijalkowski <fij...@gmail.com> Branch: optresult Changeset: r77619:bab2d31d5723 Date: 2015-05-27 10:59 +0200 http://bitbucket.org/pypy/pypy/changeset/bab2d31d5723/
Log: simple whacking at the backend diff --git a/rpython/jit/backend/llsupport/regalloc.py b/rpython/jit/backend/llsupport/regalloc.py --- a/rpython/jit/backend/llsupport/regalloc.py +++ b/rpython/jit/backend/llsupport/regalloc.py @@ -633,7 +633,7 @@ locs = [] base_ofs = self.assembler.cpu.get_baseofs_of_frame_field() for box in inputargs: - assert isinstance(box, Box) + assert not isinstance(box, Const) loc = self.fm.get_new_loc(box) locs.append(loc.value - base_ofs) if looptoken.compiled_loop_token is not None: @@ -641,9 +641,8 @@ looptoken.compiled_loop_token._ll_initial_locs = locs def can_merge_with_next_guard(self, op, i, operations): - if (op.getopnum() == rop.CALL_MAY_FORCE or - op.getopnum() == rop.CALL_ASSEMBLER or - op.getopnum() == rop.CALL_RELEASE_GIL): + if (op.is_call_may_force() or op.is_call_assembler() or + op.is_call_release_gil()): assert operations[i + 1].getopnum() == rop.GUARD_NOT_FORCED return True if not op.is_comparison(): @@ -682,16 +681,13 @@ # never appear in the assembler or it does not matter if they appear on # stack or in registers. Main example is loop arguments that go # only to guard operations or to jump or to finish - produced = {} last_used = {} last_real_usage = {} for i in range(len(operations)-1, -1, -1): op = operations[i] - if op.result: - if op.result not in last_used and op.has_no_side_effect(): + if op.type != 'v': + if op not in last_used and op.has_no_side_effect(): continue - assert op.result not in produced - produced[op.result] = i opnum = op.getopnum() for j in range(op.numargs()): arg = op.getarg(j) @@ -711,14 +707,14 @@ last_used[arg] = i # longevity = {} - for arg in produced: - if arg in last_used: + for i, arg in enumerate(operations): + if arg.type != 'v' and arg in last_used: assert isinstance(arg, Box) - assert produced[arg] < last_used[arg] - longevity[arg] = (produced[arg], last_used[arg]) + assert i < last_used[arg] + longevity[arg] = (i, last_used[arg]) del last_used[arg] for arg in inputargs: - assert isinstance(arg, Box) + assert not isinstance(arg, Const) if arg not in last_used: longevity[arg] = (-1, -1) else: diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -187,8 +187,8 @@ var = op.getarg(i) if var is not None: # xxx kludgy self.possibly_free_var(var) - if op.result: - self.possibly_free_var(op.result) + if op.type != 'v': + self.possibly_free_var(op) def possibly_free_vars(self, vars): for var in vars: @@ -316,7 +316,7 @@ self.assembler.mc.mark_op(op) self.rm.position = i self.xrm.position = i - if op.has_no_side_effect() and op.result not in self.longevity: + if op.has_no_side_effect() and op not in self.longevity: i += 1 self.possibly_free_vars_for_op(op) continue diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -269,7 +269,14 @@ return (opnum == rop.CALL_PURE_I or opnum == rop.CALL_PURE_R or opnum == rop.CALL_PURE_N or - opnum == rop.CALL_PURE_F) + opnum == rop.CALL_PURE_F) + + def is_call_release_gil(self): + opnum = self.opnum + # no R returning call_release_gil + return (opnum == rop.CALL_RELEASE_GIL_I or + opnum == rop.CALL_RELEASE_GIL_F or + opnum == rop.CALL_RELEASE_GIL_N) def is_ovf(self): return rop._OVF_FIRST <= self.getopnum() <= rop._OVF_LAST _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit