Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: py3k Changeset: r64901:df0e09e9a5a7 Date: 2013-06-13 18:24 +0200 http://bitbucket.org/pypy/pypy/changeset/df0e09e9a5a7/
Log: merge default diff --git a/lib_pypy/_curses.py b/lib_pypy/_curses.py --- a/lib_pypy/_curses.py +++ b/lib_pypy/_curses.py @@ -476,6 +476,15 @@ def _chtype(ch): return int(ffi.cast("chtype", ch)) +def _texttype(text): + if isinstance(text, str): + return text + elif isinstance(text, unicode): + return str(text) # default encoding + else: + raise TypeError("str or unicode expected, got a '%s' object" + % (type(text).__name__,)) + def _extract_yx(args): if len(args) >= 2: @@ -589,6 +598,7 @@ @_argspec(1, 1, 2) def addstr(self, y, x, text, attr=None): + text = _texttype(text) if attr is not None: attr_old = lib.getattrs(self._win) lib.wattrset(self._win, attr) @@ -602,6 +612,7 @@ @_argspec(2, 1, 2) def addnstr(self, y, x, text, n, attr=None): + text = _texttype(text) if attr is not None: attr_old = lib.getattrs(self._win) lib.wattrset(self._win, attr) @@ -780,6 +791,7 @@ @_argspec(1, 1, 2) def insstr(self, y, x, text, attr=None): + text = _texttype(text) if attr is not None: attr_old = lib.getattrs(self._win) lib.wattrset(self._win, attr) @@ -793,6 +805,7 @@ @_argspec(2, 1, 2) def insnstr(self, y, x, text, n, attr=None): + text = _texttype(text) if attr is not None: attr_old = lib.getattrs(self._win) lib.wattrset(self._win, attr) @@ -1197,6 +1210,7 @@ def putp(text): + text = _texttype(text) return _check_ERR(lib.putp(text), "putp") diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py --- a/pypy/interpreter/baseobjspace.py +++ b/pypy/interpreter/baseobjspace.py @@ -914,6 +914,9 @@ def newlist_str(self, list_s): return self.newlist([self.wrap(s) for s in list_s]) + def newlist_unicode(self, list_u): + return self.newlist([self.wrap(u) for u in list_u]) + def newlist_hint(self, sizehint): from pypy.objspace.std.listobject import make_empty_list_with_size return make_empty_list_with_size(self, sizehint) diff --git a/pypy/module/thread/test/test_fork.py b/pypy/module/thread/test/test_fork.py --- a/pypy/module/thread/test/test_fork.py +++ b/pypy/module/thread/test/test_fork.py @@ -30,7 +30,7 @@ if pid == 0: os._exit(0) else: - self.timeout_killer(pid, 5) + self.timeout_killer(pid, 10) exitcode = os.waitpid(pid, 0)[1] assert exitcode == 0 # if 9, process was killed by timer! finally: @@ -56,7 +56,7 @@ _thread.start_new_thread(lambda: None, ()) os._exit(0) else: - self.timeout_killer(pid, 5) + self.timeout_killer(pid, 10) exitcode = os.waitpid(pid, 0)[1] assert exitcode == 0 # if 9, process was killed by timer! @@ -75,7 +75,7 @@ signal.signal(signal.SIGUSR1, signal.SIG_IGN) os._exit(42) else: - self.timeout_killer(pid, 5) + self.timeout_killer(pid, 10) exitcode = os.waitpid(pid, 0)[1] feedback.append(exitcode) diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py --- a/pypy/objspace/std/listobject.py +++ b/pypy/objspace/std/listobject.py @@ -171,6 +171,12 @@ storage = strategy.erase(list_s) return W_ListObject.from_storage_and_strategy(space, storage, strategy) + @staticmethod + def newlist_unicode(space, list_u): + strategy = space.fromcache(UnicodeListStrategy) + storage = strategy.erase(list_u) + return W_ListObject.from_storage_and_strategy(space, storage, strategy) + def __repr__(self): """ representation for debugging purposes """ return "%s(%s, %s)" % (self.__class__.__name__, self.strategy, diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -317,6 +317,9 @@ def newlist_str(self, list_s): return W_ListObject.newlist_str(self, list_s) + def newlist_unicode(self, list_u): + return W_ListObject.newlist_unicode(self, list_u) + def newdict(self, module=False, instance=False, kwargs=False, strdict=False): return W_DictMultiObject.allocate_and_init_instance( diff --git a/pypy/objspace/std/test/test_liststrategies.py b/pypy/objspace/std/test/test_liststrategies.py --- a/pypy/objspace/std/test/test_liststrategies.py +++ b/pypy/objspace/std/test/test_liststrategies.py @@ -565,6 +565,18 @@ assert space.listview_str(w_l) == ["a", "b", "c"] assert space.listview_str(w_l2) == ["a", "b", "c"] + def test_unicode_uses_newlist_unicode(self): + space = self.space + w_u = space.wrap(u"a b c") + space.newlist = None + try: + w_l = space.call_method(w_u, "split") + w_l2 = space.call_method(w_u, "split", space.wrap(" ")) + finally: + del space.newlist + assert space.listview_unicode(w_l) == [u"a", u"b", u"c"] + assert space.listview_unicode(w_l2) == [u"a", u"b", u"c"] + def test_pop_without_argument_is_fast(self): space = self.space w_l = W_ListObject(space, [space.wrap(1), space.wrap(2), space.wrap(3)]) diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -646,7 +646,7 @@ # continue to look from the character following the space after the word i = j + 1 - return space.newlist_str(res) + return space.newlist_unicode(res) def unicode_split__Unicode_Unicode_ANY(space, w_self, w_delim, w_maxsplit): self = w_self._value @@ -657,12 +657,12 @@ raise OperationError(space.w_ValueError, space.wrap('empty separator')) parts = _split_with(self, delim, maxsplit) - return space.newlist_str(parts) + return space.newlist_unicode(parts) def unicode_rsplit__Unicode_None_ANY(space, w_self, w_none, w_maxsplit): maxsplit = space.int_w(w_maxsplit) - res_w = [] + res = [] value = w_self._value i = len(value)-1 while True: @@ -687,13 +687,13 @@ # the word is value[j+1:i+1] j1 = j + 1 assert j1 >= 0 - res_w.append(W_UnicodeObject(value[j1:i+1])) + res.append(value[j1:i+1]) # continue to look from the character before the space before the word i = j - 1 - res_w.reverse() - return space.newlist(res_w) + res.reverse() + return space.newlist_unicode(res) def sliced(space, s, start, stop, orig_obj): assert start >= 0 diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py --- a/rpython/jit/backend/arm/assembler.py +++ b/rpython/jit/backend/arm/assembler.py @@ -113,7 +113,7 @@ tmpreg = r.lr mc.gen_load_int(r.ip.value, self.cpu.pos_exc_value()) if excvalloc is not None: # store - assert excvalloc.is_reg() + assert excvalloc.is_core_reg() self.load_reg(mc, excvalloc, r.ip) if on_frame: # store exc_value in JITFRAME @@ -125,7 +125,7 @@ self.store_reg(mc, r.ip, r.fp, ofs, helper=tmpreg) if exctploc is not None: # store pos_exception in exctploc - assert exctploc.is_reg() + assert exctploc.is_core_reg() mc.gen_load_int(r.ip.value, self.cpu.pos_exception()) self.load_reg(mc, exctploc, r.ip, helper=tmpreg) @@ -146,7 +146,7 @@ tmpreg = r.lr # use lr as a second temporary reg mc.gen_load_int(r.ip.value, self.cpu.pos_exc_value()) if excvalloc is not None: - assert excvalloc.is_reg() + assert excvalloc.is_core_reg() self.store_reg(mc, excvalloc, r.ip) else: assert exctploc is not r.fp @@ -947,7 +947,7 @@ # regalloc support def load(self, loc, value): """load an immediate value into a register""" - assert (loc.is_reg() and value.is_imm() + assert (loc.is_core_reg() and value.is_imm() or loc.is_vfp_reg() and value.is_imm_float()) if value.is_imm(): self.mc.gen_load_int(loc.value, value.getint()) @@ -958,7 +958,7 @@ def load_reg(self, mc, target, base, ofs=0, cond=c.AL, helper=r.ip): if target.is_vfp_reg(): return self._load_vfp_reg(mc, target, base, ofs, cond, helper) - elif target.is_reg(): + elif target.is_core_reg(): return self._load_core_reg(mc, target, base, ofs, cond, helper) def _load_vfp_reg(self, mc, target, base, ofs, cond=c.AL, helper=r.ip): @@ -1012,7 +1012,7 @@ def _mov_imm_to_loc(self, prev_loc, loc, cond=c.AL): if loc.type == FLOAT: raise AssertionError("invalid target for move from imm value") - if loc.is_reg(): + if loc.is_core_reg(): new_loc = loc elif loc.is_stack() or loc.is_raw_sp(): new_loc = r.lr @@ -1027,7 +1027,7 @@ def _mov_reg_to_loc(self, prev_loc, loc, cond=c.AL): if loc.is_imm(): raise AssertionError("mov reg to imm doesn't make sense") - if loc.is_reg(): + if loc.is_core_reg(): self.mc.MOV_rr(loc.value, prev_loc.value, cond=cond) elif loc.is_stack() and loc.type != FLOAT: # spill a core register @@ -1050,7 +1050,7 @@ helper = None offset = prev_loc.value tmp = None - if loc.is_reg(): + if loc.is_core_reg(): assert prev_loc.type != FLOAT, 'trying to load from an \ incompatible location into a core register' # unspill a core register @@ -1126,7 +1126,7 @@ """Moves a value from a previous location to some other location""" if prev_loc.is_imm(): return self._mov_imm_to_loc(prev_loc, loc, cond) - elif prev_loc.is_reg(): + elif prev_loc.is_core_reg(): self._mov_reg_to_loc(prev_loc, loc, cond) elif prev_loc.is_stack(): self._mov_stack_to_loc(prev_loc, loc, cond) @@ -1215,7 +1215,7 @@ scratch_reg = r.vfp_ip self.regalloc_mov(loc, scratch_reg, cond) self.regalloc_push(scratch_reg, cond) - elif loc.is_reg(): + elif loc.is_core_reg(): self.mc.PUSH([loc.value], cond=cond) elif loc.is_vfp_reg(): self.mc.VPUSH([loc.value], cond=cond) @@ -1238,7 +1238,7 @@ scratch_reg = r.vfp_ip self.regalloc_pop(scratch_reg) self.regalloc_mov(scratch_reg, loc) - elif loc.is_reg(): + elif loc.is_core_reg(): self.mc.POP([loc.value], cond=cond) elif loc.is_vfp_reg(): self.mc.VPOP([loc.value], cond=cond) @@ -1306,7 +1306,7 @@ # lengthloc is the length of the array, which we must not modify! assert lengthloc is not r.r0 and lengthloc is not r.r1 - if lengthloc.is_reg(): + if lengthloc.is_core_reg(): varsizeloc = lengthloc else: assert lengthloc.is_stack() diff --git a/rpython/jit/backend/arm/callbuilder.py b/rpython/jit/backend/arm/callbuilder.py --- a/rpython/jit/backend/arm/callbuilder.py +++ b/rpython/jit/backend/arm/callbuilder.py @@ -40,7 +40,7 @@ if self.fnloc.is_stack(): self.asm.mov_loc_loc(self.fnloc, r.ip) self.fnloc = r.ip - assert self.fnloc.is_reg() + assert self.fnloc.is_core_reg() self.mc.BLX(self.fnloc.value) def restore_stack_pointer(self): @@ -135,7 +135,7 @@ return [], [] if self.resloc.is_vfp_reg(): return [r.r0, r.r1], [] - assert self.resloc.is_reg() + assert self.resloc.is_core_reg() return [r.r0], [] def load_result(self): @@ -146,7 +146,7 @@ if resloc.is_vfp_reg(): # move result to the allocated register self.asm.mov_to_vfp_loc(r.r0, r.r1, resloc) - elif resloc.is_reg(): + elif resloc.is_core_reg(): # move result to the allocated register if resloc is not r.r0: self.asm.mov_loc_loc(r.r0, resloc) @@ -283,7 +283,7 @@ def load_result(self): resloc = self.resloc # ensure the result is wellformed and stored in the correct location - if resloc is not None and resloc.is_reg(): + if resloc is not None and resloc.is_core_reg(): self._ensure_result_bit_extension(resloc, self.ressize, self.ressign) @@ -292,7 +292,7 @@ return [], [] if self.resloc.is_vfp_reg(): return [], [r.d0] - assert self.resloc.is_reg() + assert self.resloc.is_core_reg() return [r.r0], [] diff --git a/rpython/jit/backend/arm/helper/assembler.py b/rpython/jit/backend/arm/helper/assembler.py --- a/rpython/jit/backend/arm/helper/assembler.py +++ b/rpython/jit/backend/arm/helper/assembler.py @@ -82,7 +82,7 @@ assert guard is not None l0 = arglocs[0] l1 = arglocs[1] - assert l0.is_reg() + assert l0.is_core_reg() if l1.is_imm(): self.mc.CMP_ri(l0.value, imm=l1.getint(), cond=fcond) diff --git a/rpython/jit/backend/arm/locations.py b/rpython/jit/backend/arm/locations.py --- a/rpython/jit/backend/arm/locations.py +++ b/rpython/jit/backend/arm/locations.py @@ -15,7 +15,7 @@ def is_raw_sp(self): return False - def is_reg(self): + def is_core_reg(self): return False def is_vfp_reg(self): @@ -43,7 +43,7 @@ def __repr__(self): return 'r%d' % self.value - def is_reg(self): + def is_core_reg(self): return True def as_key(self): @@ -62,7 +62,7 @@ def __repr__(self): return 'vfp%d' % self.value - def is_reg(self): + def is_core_reg(self): return False def is_vfp_reg(self): diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py --- a/rpython/jit/backend/arm/opassembler.py +++ b/rpython/jit/backend/arm/opassembler.py @@ -248,7 +248,7 @@ l1 = arglocs[1] failargs = arglocs[2:] - if l0.is_reg(): + if l0.is_core_reg(): if l1.is_imm(): self.mc.CMP_ri(l0.value, l1.getint()) else: @@ -488,7 +488,7 @@ # case GCFLAG_CARDS_SET: emit a few instructions to do # directly the card flag setting loc_index = arglocs[1] - assert loc_index.is_reg() + assert loc_index.is_core_reg() # must save the register loc_index before it is mutated mc.PUSH([loc_index.value]) tmp1 = loc_index @@ -588,7 +588,7 @@ def emit_op_setarrayitem_gc(self, op, arglocs, regalloc, fcond): value_loc, base_loc, ofs_loc, scale, ofs = arglocs - assert ofs_loc.is_reg() + assert ofs_loc.is_core_reg() if scale.value > 0: self.mc.LSL_ri(r.ip.value, ofs_loc.value, scale.value) ofs_loc = r.ip @@ -606,7 +606,7 @@ # vstr only supports imm offsets # so if the ofset is too large we add it to the base and use an # offset of 0 - if ofs_loc.is_reg(): + if ofs_loc.is_core_reg(): tmploc, save = self.get_tmp_reg([value_loc, base_loc, ofs_loc]) assert not save self.mc.ADD_rr(tmploc.value, base_loc.value, ofs_loc.value) @@ -644,13 +644,13 @@ def emit_op_raw_store(self, op, arglocs, regalloc, fcond): value_loc, base_loc, ofs_loc, scale, ofs = arglocs - assert ofs_loc.is_reg() + assert ofs_loc.is_core_reg() self._write_to_mem(value_loc, base_loc, ofs_loc, scale, fcond) return fcond def emit_op_getarrayitem_gc(self, op, arglocs, regalloc, fcond): res_loc, base_loc, ofs_loc, scale, ofs = arglocs - assert ofs_loc.is_reg() + assert ofs_loc.is_core_reg() signed = op.getdescr().is_item_signed() # scale the offset as required @@ -672,7 +672,7 @@ # vldr only supports imm offsets # if the offset is in a register we add it to the base and use a # tmp reg - if ofs_loc.is_reg(): + if ofs_loc.is_core_reg(): tmploc, save = self.get_tmp_reg([base_loc, ofs_loc]) assert not save self.mc.ADD_rr(tmploc.value, base_loc.value, ofs_loc.value) @@ -727,7 +727,7 @@ def emit_op_raw_load(self, op, arglocs, regalloc, fcond): res_loc, base_loc, ofs_loc, scale, ofs = arglocs - assert ofs_loc.is_reg() + assert ofs_loc.is_core_reg() # no base offset assert ofs.value == 0 signed = op.getdescr().is_item_signed() @@ -805,10 +805,10 @@ bytes_box = TempBox() bytes_loc = regalloc.rm.force_allocate_reg(bytes_box, forbidden_vars) scale = self._get_unicode_item_scale() - if not length_loc.is_reg(): + if not length_loc.is_core_reg(): self.regalloc_mov(length_loc, bytes_loc) length_loc = bytes_loc - assert length_loc.is_reg() + assert length_loc.is_core_reg() self.mc.MOV_ri(r.ip.value, 1 << scale) self.mc.MUL(bytes_loc.value, r.ip.value, length_loc.value) length_box = bytes_box @@ -835,8 +835,8 @@ # result = base_loc + (scaled_loc << scale) + static_offset def _gen_address(self, result, base_loc, scaled_loc, scale=0, static_offset=0): - assert scaled_loc.is_reg() - assert base_loc.is_reg() + assert scaled_loc.is_core_reg() + assert base_loc.is_core_reg() assert check_imm_arg(scale) assert check_imm_arg(static_offset) if scale > 0: @@ -1063,7 +1063,7 @@ def emit_op_cast_float_to_int(self, op, arglocs, regalloc, fcond): arg, res = arglocs assert arg.is_vfp_reg() - assert res.is_reg() + assert res.is_core_reg() self.mc.VCVT_float_to_int(r.vfp_ip.value, arg.value) self.mc.VMOV_rc(res.value, r.ip.value, r.vfp_ip.value) return fcond @@ -1071,7 +1071,7 @@ def emit_op_cast_int_to_float(self, op, arglocs, regalloc, fcond): arg, res = arglocs assert res.is_vfp_reg() - assert arg.is_reg() + assert arg.is_core_reg() self.mc.MOV_ri(r.ip.value, 0) self.mc.VMOV_cr(res.value, arg.value, r.ip.value) self.mc.VCVT_int_to_float(res.value, res.value) @@ -1087,7 +1087,7 @@ loc = arglocs[0] res = arglocs[1] assert loc.is_vfp_reg() - assert res.is_reg() + assert res.is_core_reg() self.mc.VMOV_rc(res.value, r.ip.value, loc.value) return fcond @@ -1108,7 +1108,7 @@ def emit_op_cast_float_to_singlefloat(self, op, arglocs, regalloc, fcond): arg, res = arglocs assert arg.is_vfp_reg() - assert res.is_reg() + assert res.is_core_reg() self.mc.VCVT_f64_f32(r.vfp_ip.value, arg.value) self.mc.VMOV_rc(res.value, r.ip.value, r.vfp_ip.value) return fcond @@ -1116,7 +1116,7 @@ def emit_op_cast_singlefloat_to_float(self, op, arglocs, regalloc, fcond): arg, res = arglocs assert res.is_vfp_reg() - assert arg.is_reg() + assert arg.is_core_reg() self.mc.MOV_ri(r.ip.value, 0) self.mc.VMOV_cr(res.value, arg.value, r.ip.value) self.mc.VCVT_f32_f64(res.value, res.value) diff --git a/rpython/jit/backend/arm/regalloc.py b/rpython/jit/backend/arm/regalloc.py --- a/rpython/jit/backend/arm/regalloc.py +++ b/rpython/jit/backend/arm/regalloc.py @@ -324,7 +324,7 @@ loc = r.fp arg = inputargs[i] i += 1 - if loc.is_reg(): + if loc.is_core_reg(): self.rm.reg_bindings[arg] = loc used[loc] = None elif loc.is_vfp_reg(): @@ -346,6 +346,8 @@ # note: we need to make a copy of inputargs because possibly_free_vars # is also used on op args, which is a non-resizable list self.possibly_free_vars(list(inputargs)) + self.fm.finish_binding() + self._check_invariants() def get_gcmap(self, forbidden_regs=[], noregs=False): frame_depth = self.fm.get_frame_depth() @@ -356,7 +358,7 @@ continue if box.type == REF and self.rm.is_still_alive(box): assert not noregs - assert loc.is_reg() + assert loc.is_core_reg() val = loc.value gcmap[val // WORD // 8] |= r_uint(1) << (val % (WORD * 8)) for box, loc in self.fm.bindings.iteritems(): @@ -1152,7 +1154,7 @@ assert isinstance(arg, Box) loc = self.loc(arg) arglocs[i] = loc - if loc.is_reg(): + if loc.is_core_reg() or loc.is_vfp_reg(): self.frame_manager.mark_as_free(arg) # descr._arm_arglocs = arglocs diff --git a/rpython/jit/backend/arm/test/test_jump.py b/rpython/jit/backend/arm/test/test_jump.py --- a/rpython/jit/backend/arm/test/test_jump.py +++ b/rpython/jit/backend/arm/test/test_jump.py @@ -255,7 +255,7 @@ else: newvalue = 'value-vfp-%d' % i regs2[loc.value] = newvalue - elif loc.is_reg(): + elif loc.is_core_reg(): regs1[loc.value] = 'value-int-%d' % i elif loc.is_stack(): stack[loc.position] = 'value-width%d-%d' % (loc.width, i) @@ -284,7 +284,7 @@ assert loc.width == expected_width*WORD if loc.is_vfp_reg(): return regs2[loc.value] - elif loc.is_reg(): + elif loc.is_core_reg(): return regs1[loc.value] elif loc.is_stack(): got = stack[loc.position] @@ -298,7 +298,7 @@ def write(loc, newvalue): if loc.is_vfp_reg(): regs2[loc.value] = newvalue - elif loc.is_reg(): + elif loc.is_core_reg(): regs1[loc.value] = newvalue elif loc.is_stack(): if loc.width > WORD: @@ -317,17 +317,17 @@ for op in assembler.ops: if op[0] == 'mov': src, dst = op[1:] - assert src.is_reg() or src.is_vfp_reg() or src.is_stack() or src.is_imm_float() or src.is_imm() - assert dst.is_reg() or dst.is_vfp_reg() or dst.is_stack() + assert src.is_core_reg() or src.is_vfp_reg() or src.is_stack() or src.is_imm_float() or src.is_imm() + assert dst.is_core_reg() or dst.is_vfp_reg() or dst.is_stack() assert not (src.is_stack() and dst.is_stack()) write(dst, read(src)) elif op[0] == 'push': src, = op[1:] - assert src.is_reg() or src.is_vfp_reg() or src.is_stack() + assert src.is_core_reg() or src.is_vfp_reg() or src.is_stack() extrapushes.append(read(src)) elif op[0] == 'pop': dst, = op[1:] - assert dst.is_reg() or dst.is_vfp_reg() or dst.is_stack() + assert dst.is_core_reg() or dst.is_vfp_reg() or dst.is_stack() write(dst, extrapushes.pop()) else: assert 0, "unknown op: %r" % (op,) diff --git a/rpython/jit/backend/arm/test/test_runner.py b/rpython/jit/backend/arm/test/test_runner.py --- a/rpython/jit/backend/arm/test/test_runner.py +++ b/rpython/jit/backend/arm/test/test_runner.py @@ -11,6 +11,7 @@ from rpython.jit.codewriter.effectinfo import EffectInfo from rpython.jit.metainterp.history import JitCellToken, TargetToken from rpython.jit.backend.arm.detect import detect_arch_version +from rpython.jit.codewriter import longlong CPU = getcpuclass() @@ -261,3 +262,43 @@ l1 = ('debug_print', preambletoken.repr_of_descr() + ':1') l2 = ('debug_print', targettoken.repr_of_descr() + ':9') assert ('jit-backend-counts', [l0, l1, l2]) in dlog + + + def test_label_float_in_reg_and_on_stack(self): + targettoken = TargetToken() + ops = """ + [i0, f3] + i2 = same_as(i0) # but forced to be in a register + force_spill(i2) + force_spill(f3) + f4 = float_add(f3, 5.0) + label(f3, f4, descr=targettoken) + force_spill(f3) + f5 = same_as(f3) # but forced to be in a register + finish(f5) + """ + faildescr = BasicFailDescr(2) + loop = parse(ops, self.cpu, namespace=locals()) + looptoken = JitCellToken() + info = self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) + ops2 = """ + [i0, f1] + i1 = same_as(i0) + f2 = same_as(f1) + f3 = float_add(f1, 10.0) + force_spill(f3) + force_spill(i1) + f4 = float_add(f3, f1) + jump(f3, f4, descr=targettoken) + """ + loop2 = parse(ops2, self.cpu, namespace=locals()) + looptoken2 = JitCellToken() + info = self.cpu.compile_loop(loop2.inputargs, loop2.operations, looptoken2) + + deadframe = self.cpu.execute_token(looptoken, -9, longlong.getfloatstorage(-13.5)) + res = longlong.getrealfloat(self.cpu.get_float_value(deadframe, 0)) + assert res == -13.5 + # + deadframe = self.cpu.execute_token(looptoken2, -9, longlong.getfloatstorage(-13.5)) + res = longlong.getrealfloat(self.cpu.get_float_value(deadframe, 0)) + assert res == -3.5 diff --git a/rpython/jit/backend/llsupport/assembler.py b/rpython/jit/backend/llsupport/assembler.py --- a/rpython/jit/backend/llsupport/assembler.py +++ b/rpython/jit/backend/llsupport/assembler.py @@ -47,7 +47,7 @@ input_i += 1 if arg.type == REF: loc = fail_locs[i] - if loc.is_reg(): + if loc.is_core_reg(): val = self.cpu.all_reg_indexes[loc.value] else: val = loc.get_position() + self.cpu.JITFRAME_FIXED_SIZE diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -1551,14 +1551,14 @@ frame in jf_guard_exc """ if excvalloc is not None: - assert excvalloc.is_reg() + assert excvalloc.is_core_reg() mc.MOV(excvalloc, heap(self.cpu.pos_exc_value())) elif tmploc is not None: # if both are None, just ignore ofs = self.cpu.get_ofs_of_frame_field('jf_guard_exc') mc.MOV(tmploc, heap(self.cpu.pos_exc_value())) mc.MOV(RawEbpLoc(ofs), tmploc) if exctploc is not None: - assert exctploc.is_reg() + assert exctploc.is_core_reg() mc.MOV(exctploc, heap(self.cpu.pos_exception())) mc.MOV(heap(self.cpu.pos_exception()), imm0) 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 @@ -227,18 +227,6 @@ else: return self.xrm.make_sure_var_in_reg(var, forbidden_vars) - def _frame_bindings(self, locs, inputargs): - bindings = {} - i = 0 - for loc in locs: - if loc is None: - continue - arg = inputargs[i] - i += 1 - if not isinstance(loc, RegLoc): - bindings[arg] = loc - return bindings - def _update_bindings(self, locs, inputargs): # XXX this should probably go to llsupport/regalloc.py used = {} diff --git a/rpython/jit/backend/x86/regloc.py b/rpython/jit/backend/x86/regloc.py --- a/rpython/jit/backend/x86/regloc.py +++ b/rpython/jit/backend/x86/regloc.py @@ -45,7 +45,7 @@ def is_stack(self): return False - def is_reg(self): + def is_core_reg(self): return False def get_position(self): @@ -169,7 +169,7 @@ def is_float(self): return self.is_xmm - def is_reg(self): + def is_core_reg(self): return True class ImmediateAssemblerLocation(AssemblerLocation): _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit