Author: Maciej Fijalkowski <fij...@gmail.com> Branch: optresult Changeset: r77656:36b8e6c0633d Date: 2015-05-28 16:49 +0200 http://bitbucket.org/pypy/pypy/changeset/36b8e6c0633d/
Log: fix some tests 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 @@ -206,11 +206,11 @@ self._call_assembler_emit_call(self.imm(descr._ll_function_addr), argloc, tmploc) - if op.result is None: + if op.type == 'v': assert result_loc is None value = self.cpu.done_with_this_frame_descr_void else: - kind = op.result.type + kind = op.type if kind == INT: assert result_loc is tmploc value = self.cpu.done_with_this_frame_descr_int diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -610,10 +610,10 @@ def bh_new(self, sizedescr): return self.gc_ll_descr.gc_malloc(sizedescr) - def bh_new_with_vtable(self, vtable, sizedescr): + def bh_new_with_vtable(self, sizedescr): res = self.gc_ll_descr.gc_malloc(sizedescr) if self.vtable_offset is not None: - self.write_int_at_mem(res, self.vtable_offset, WORD, vtable) + self.write_int_at_mem(res, self.vtable_offset, WORD, sizedescr.get_vtable()) return res def bh_new_raw_buffer(self, size): 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 @@ -305,7 +305,7 @@ def gen_malloc_frame(self, frame_info): descrs = self.gc_ll_descr.getframedescrs(self.cpu) if self.gc_ll_descr.kind == 'boehm': - size = ResOperation(rop.GETFIELD_RAW, + size = ResOperation(rop.GETFIELD_RAW_I, [history.ConstInt(frame_info)], descr=descrs.jfi_frame_depth) self.emit_op(size) @@ -378,7 +378,7 @@ args = [frame] call_asm = ResOperation(op.getopnum(), args, op.getdescr()) - self.replace_op_with(op, call_asm) + self.replace_op_with(self.get_box_replacement(op), call_asm) self.emit_op(call_asm) # ---------- diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py --- a/rpython/jit/backend/test/runner_test.py +++ b/rpython/jit/backend/test/runner_test.py @@ -3375,10 +3375,7 @@ x = cpu.bh_new(descrsize) lltype.cast_opaque_ptr(lltype.Ptr(S), x) # type check # - descrsize2 = cpu.sizeof(rclass.OBJECT, True) - vtable2 = lltype.malloc(rclass.OBJECT_VTABLE, immortal=True) - vtable2_int = heaptracker.adr2int(llmemory.cast_ptr_to_adr(vtable2)) - heaptracker.register_known_gctype(cpu, vtable2, rclass.OBJECT) + _, T, descrsize2 = self.alloc_instance(rclass.OBJECT) x = cpu.bh_new_with_vtable(descrsize2) lltype.cast_opaque_ptr(lltype.Ptr(rclass.OBJECT), x) # type check # well... @@ -3534,7 +3531,7 @@ EffectInfo.MOST_GENERAL) ops = ''' [i0] - i11 = call_assembler(i0, descr=looptoken) + i11 = call_assembler_i(i0, descr=looptoken) guard_not_forced()[] finish(i11) ''' @@ -4050,10 +4047,10 @@ self.cpu.setup_once() # xxx redo it, because we added # propagate_exception i0 = InputArgInt() - p0 = BoxPtr() + p0 = ResOperation(rop.NEWUNICODE, [i0]) operations = [ - ResOperation(rop.NEWUNICODE, [i0], p0), - ResOperation(rop.FINISH, [p0], None, descr=BasicFinalDescr(1)) + p0, + ResOperation(rop.FINISH, [p0], descr=BasicFinalDescr(1)) ] inputargs = [i0] looptoken = JitCellToken() @@ -4175,7 +4172,7 @@ targettoken = TargetToken() ops = """ [i2] - i0 = same_as(i2) # but forced to be in a register + i0 = same_as_i(i2) # but forced to be in a register label(i0, descr=targettoken) i1 = int_add(i0, i0) guard_true(i1, descr=faildescr) [i1] @@ -4707,8 +4704,8 @@ py.test.skip("llgraph can't do zero_ptr_field") T = lltype.GcStruct('T') S = lltype.GcStruct('S', ('x', lltype.Ptr(T))) - tdescr = self.cpu.sizeof(T) - sdescr = self.cpu.sizeof(S) + tdescr = self.cpu.sizeof(T, False) + sdescr = self.cpu.sizeof(S, False) fielddescr = self.cpu.fielddescrof(S, 'x') loop = parse(""" [] @@ -4741,7 +4738,7 @@ ofs_p, _ = symbolic.get_field_token(S, 'p', False) # self.execute_operation(rop.ZERO_PTR_FIELD, [ - BoxPtr(s_ref), ConstInt(ofs_p)], # OK for now to assume that the + InputArgRef(s_ref), ConstInt(ofs_p)], # OK for now to assume that the 'void') # 2nd argument is a constant # assert s.x == -1296321 @@ -4779,7 +4776,7 @@ if cls1 == cls2 and start == length: lengthbox = startbox # same box! self.execute_operation(rop.ZERO_ARRAY, - [BoxPtr(a_ref), + [InputArgRef(a_ref), startbox, lengthbox], 'void', descr=arraydescr) 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 @@ -2061,9 +2061,9 @@ return jmp_location def _call_assembler_load_result(self, op, result_loc): - if op.result is not None: + if op.type != 'v': # load the return value from the dead frame's value index 0 - kind = op.result.type + kind = op.type descr = self.cpu.getarraydescr_for_frame(kind) ofs = self.cpu.unpack_arraydescr(descr) if kind == FLOAT: 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 @@ -624,7 +624,7 @@ def consider_cast_float_to_singlefloat(self, op): loc0 = self.xrm.make_sure_var_in_reg(op.getarg(0)) loc1 = self.rm.force_allocate_reg(op) - tmpxvar = TempBox() + tmpxvar = TempVar() loctmp = self.xrm.force_allocate_reg(tmpxvar) # may be equal to loc0 self.xrm.possibly_free_var(tmpxvar) self.perform(op, [loc0, loctmp], loc1) @@ -1455,7 +1455,7 @@ if IS_X86_64: null_loc = X86_64_XMM_SCRATCH_REG else: - null_box = TempBox() + null_box = TempVar() null_loc = self.xrm.force_allocate_reg(null_box) self.xrm.possibly_free_var(null_box) self.perform_discard(op, [base_loc, startindex_loc, @@ -1467,7 +1467,7 @@ # address that we will pass as first argument to memset(). # It can be in the same register as either one, but not in # args[2], because we're still needing the latter. - dstaddr_box = TempBox() + dstaddr_box = TempVar() dstaddr_loc = self.rm.force_allocate_reg(dstaddr_box, [args[2]]) itemsize_loc = imm(itemsize) dst_addr = self.assembler._get_interiorfield_addr( @@ -1485,7 +1485,7 @@ # we need a register that is different from dstaddr_loc, # but which can be identical to length_loc (as usual, # only if the length_box is not used by future operations) - bytes_box = TempBox() + bytes_box = TempVar() bytes_loc = self.rm.force_allocate_reg(bytes_box, [dstaddr_box]) b_adr = self.assembler._get_interiorfield_addr( diff --git a/rpython/jit/backend/x86/test/test_runner.py b/rpython/jit/backend/x86/test/test_runner.py --- a/rpython/jit/backend/x86/test/test_runner.py +++ b/rpython/jit/backend/x86/test/test_runner.py @@ -2,14 +2,13 @@ from rpython.rtyper.lltypesystem import lltype, llmemory, rffi, rstr from rpython.jit.metainterp.history import ResOperation, TargetToken,\ JitCellToken -from rpython.jit.metainterp.history import (BoxInt, BoxPtr, ConstInt, - ConstPtr, Box, +from rpython.jit.metainterp.history import (ConstInt, ConstPtr, Const, BasicFailDescr, BasicFinalDescr) from rpython.jit.backend.detect_cpu import getcpuclass from rpython.jit.backend.x86.arch import WORD from rpython.jit.backend.x86.rx86 import fits_in_32bits from rpython.jit.backend.llsupport import symbolic -from rpython.jit.metainterp.resoperation import rop +from rpython.jit.metainterp.resoperation import rop, InputArgInt, InputArgRef from rpython.jit.metainterp.executor import execute from rpython.jit.backend.test.runner_test import LLtypeBackendTest from rpython.jit.tool.oparser import parse @@ -57,24 +56,24 @@ def test_execute_ptr_operation(self): cpu = self.cpu u = lltype.malloc(U) - u_box = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, u)) + u_box = InputArgRef(lltype.cast_opaque_ptr(llmemory.GCREF, u)) ofs = cpu.fielddescrof(S, 'value') assert self.execute_operation(rop.SETFIELD_GC, - [u_box, BoxInt(3)], + [u_box, InputArgInt(3)], 'void', ofs) == None assert u.parent.parent.value == 3 u.parent.parent.value += 100 - assert (self.execute_operation(rop.GETFIELD_GC, [u_box], 'int', ofs) - .value == 103) + assert (self.execute_operation(rop.GETFIELD_GC_I, [u_box], 'int', ofs) + == 103) def test_unicode(self): ofs = symbolic.get_field_token(rstr.UNICODE, 'chars', False)[0] u = rstr.mallocunicode(13) for i in range(13): u.chars[i] = unichr(ord(u'a') + i) - b = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, u)) + b = InputArgRef(lltype.cast_opaque_ptr(llmemory.GCREF, u)) r = self.execute_operation(rop.UNICODEGETITEM, [b, ConstInt(2)], 'int') - assert r.value == ord(u'a') + 2 + assert r == ord(u'a') + 2 self.execute_operation(rop.UNICODESETITEM, [b, ConstInt(2), ConstInt(ord(u'z'))], 'void') @@ -83,7 +82,7 @@ @staticmethod def _resbuf(res, item_tp=ctypes.c_long): - return ctypes.cast(res.value._obj.intval, ctypes.POINTER(item_tp)) + return ctypes.cast(res._obj.intval, ctypes.POINTER(item_tp)) def test_allocations(self): py.test.skip("rewrite or kill") @@ -107,7 +106,7 @@ # ------------------------------------------------------------ - res = self.execute_operation(rop.NEWSTR, [BoxInt(7)], 'ref') + res = self.execute_operation(rop.NEWSTR, [InputArgInt(7)], 'ref') assert allocs[0] == 7 + ofs + WORD resbuf = self._resbuf(res) assert resbuf[ofs/WORD] == 7 @@ -126,7 +125,7 @@ # ------------------------------------------------------------ - res = self.execute_operation(rop.NEW_ARRAY, [BoxInt(10)], + res = self.execute_operation(rop.NEW_ARRAY, [InputArgInt(10)], 'ref', descr) assert allocs[0] == 10*WORD + ofs + WORD resbuf = self._resbuf(res) @@ -138,13 +137,13 @@ ofs_items = symbolic.get_field_token(STR.chars, 'items', False)[0] res = self.execute_operation(rop.NEWSTR, [ConstInt(10)], 'ref') - self.execute_operation(rop.STRSETITEM, [res, ConstInt(2), ConstInt(ord('d'))], 'void') + self.execute_operation(rop.STRSETITEM, [InputArgRef(res), ConstInt(2), ConstInt(ord('d'))], 'void') resbuf = self._resbuf(res, ctypes.c_char) assert resbuf[ofs + ofs_items + 2] == 'd' - self.execute_operation(rop.STRSETITEM, [res, BoxInt(2), ConstInt(ord('z'))], 'void') + self.execute_operation(rop.STRSETITEM, [InputArgRef(res), InputArgInt(2), ConstInt(ord('z'))], 'void') assert resbuf[ofs + ofs_items + 2] == 'z' - r = self.execute_operation(rop.STRGETITEM, [res, BoxInt(2)], 'int') - assert r.value == ord('z') + r = self.execute_operation(rop.STRGETITEM, [InputArgRef(res), InputArgInt(2)], 'int') + assert r == ord('z') def test_arrayitems(self): TP = lltype.GcArray(lltype.Signed) @@ -155,35 +154,35 @@ 'ref', descr) resbuf = self._resbuf(res) assert resbuf[ofs/WORD] == 10 - self.execute_operation(rop.SETARRAYITEM_GC, [res, - ConstInt(2), BoxInt(38)], + self.execute_operation(rop.SETARRAYITEM_GC, [InputArgRef(res), + ConstInt(2), InputArgInt(38)], 'void', descr) assert resbuf[itemsofs/WORD + 2] == 38 - self.execute_operation(rop.SETARRAYITEM_GC, [res, - BoxInt(3), BoxInt(42)], + self.execute_operation(rop.SETARRAYITEM_GC, [InputArgRef(res), + InputArgInt(3), InputArgInt(42)], 'void', descr) assert resbuf[itemsofs/WORD + 3] == 42 - r = self.execute_operation(rop.GETARRAYITEM_GC, [res, ConstInt(2)], + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [InputArgRef(res), ConstInt(2)], 'int', descr) - assert r.value == 38 - r = self.execute_operation(rop.GETARRAYITEM_GC, [res.constbox(), - BoxInt(2)], + assert r == 38 + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [ConstPtr(res), + InputArgInt(2)], 'int', descr) - assert r.value == 38 - r = self.execute_operation(rop.GETARRAYITEM_GC, [res.constbox(), + assert r == 38 + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [ConstPtr(res), ConstInt(2)], 'int', descr) - assert r.value == 38 - r = self.execute_operation(rop.GETARRAYITEM_GC, [res, - BoxInt(2)], + assert r == 38 + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [InputArgRef(res), + InputArgInt(2)], 'int', descr) - assert r.value == 38 + assert r == 38 - r = self.execute_operation(rop.GETARRAYITEM_GC, [res, BoxInt(3)], + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [InputArgRef(res), InputArgInt(3)], 'int', descr) - assert r.value == 42 + assert r == 42 def test_arrayitems_not_int(self): TP = lltype.GcArray(lltype.Char) @@ -193,18 +192,19 @@ res = self.execute_operation(rop.NEW_ARRAY, [ConstInt(10)], 'ref', descr) resbuf = self._resbuf(res, ctypes.c_char) + res = InputArgRef(res) assert resbuf[ofs] == chr(10) for i in range(10): self.execute_operation(rop.SETARRAYITEM_GC, [res, - ConstInt(i), BoxInt(i)], + ConstInt(i), InputArgInt(i)], 'void', descr) for i in range(10): assert resbuf[itemsofs + i] == chr(i) for i in range(10): - r = self.execute_operation(rop.GETARRAYITEM_GC, [res, + r = self.execute_operation(rop.GETARRAYITEM_GC_I, [res, ConstInt(i)], 'int', descr) - assert r.value == i + assert r == i def test_getfield_setfield(self): TP = lltype.GcStruct('x', ('s', lltype.Signed), @@ -214,8 +214,8 @@ ('c1', lltype.Char), ('c2', lltype.Char), ('c3', lltype.Char)) - res = self.execute_operation(rop.NEW, [], - 'ref', self.cpu.sizeof(TP)) + res = InputArgRef(self.execute_operation(rop.NEW, [], + 'ref', self.cpu.sizeof(TP, False))) ofs_s = self.cpu.fielddescrof(TP, 's') ofs_i = self.cpu.fielddescrof(TP, 'i') #ofs_f = self.cpu.fielddescrof(TP, 'f') @@ -229,16 +229,16 @@ #self.execute_operation(rop.SETFIELD_GC, [res, ofs_f, 1e100], 'void') # XXX we don't support shorts (at all) #self.execute_operation(rop.SETFIELD_GC, [res, ofs_u, ConstInt(5)], 'void') - s = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofs_s) - assert s.value == 3 - self.execute_operation(rop.SETFIELD_GC, [res, BoxInt(3)], 'void', + s = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofs_s) + assert s == 3 + self.execute_operation(rop.SETFIELD_GC, [res, InputArgInt(3)], 'void', ofs_s) - s = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofs_s) - assert s.value == 3 + s = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofs_s) + assert s == 3 - self.execute_operation(rop.SETFIELD_GC, [res, BoxInt(1234)], 'void', ofs_i) - i = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofs_i) - assert i.value == 1234 + self.execute_operation(rop.SETFIELD_GC, [res, InputArgInt(1234)], 'void', ofs_i) + i = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofs_i) + assert i == 1234 #u = self.execute_operation(rop.GETFIELD_GC, [res, ofs_u], 'int') #assert u.value == 5 @@ -248,12 +248,12 @@ ofsc3) self.execute_operation(rop.SETFIELD_GC, [res, ConstInt(2)], 'void', ofsc2) - c = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofsc1) - assert c.value == 1 - c = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofsc2) - assert c.value == 2 - c = self.execute_operation(rop.GETFIELD_GC, [res], 'int', ofsc3) - assert c.value == 3 + c = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofsc1) + assert c == 1 + c = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofsc2) + assert c == 2 + c = self.execute_operation(rop.GETFIELD_GC_I, [res], 'int', ofsc3) + assert c == 3 def test_bug_setfield_64bit(self): if WORD == 4: @@ -278,78 +278,78 @@ p = lltype.cast_opaque_ptr(llmemory.GCREF, lltype.malloc(lltype.GcStruct('x'))) nullptr = lltype.nullptr(llmemory.GCREF.TO) - f = BoxInt() + f = InputArgInt() for op in allops: for guard in guards: if op == rop.INT_IS_TRUE: - bp = BoxInt(1) - n = BoxInt(0) + bp = InputArgInt(1) + n = InputArgInt(0) else: - bp = BoxPtr(p) - n = BoxPtr(nullptr) + bp = InputArgRef(p) + n = InputArgRef(nullptr) for b in (bp, n): - i1 = BoxInt(1) + i1 = ResOperation(rop.SAME_AS_I, [ConstInt(1)]) + f = ResOperation(op, [b]) ops = [ - ResOperation(rop.SAME_AS, [ConstInt(1)], i1), - ResOperation(op, [b], f), - ResOperation(guard, [f], None, + i1, + f, + ResOperation(guard, [f], descr=BasicFailDescr()), - ResOperation(rop.FINISH, [ConstInt(0)], None, + ResOperation(rop.FINISH, [ConstInt(0)], descr=BasicFinalDescr()), ] ops[-2].setfailargs([i1]) looptoken = JitCellToken() self.cpu.compile_loop([b], ops, looptoken) - deadframe = self.cpu.execute_token(looptoken, b.value) + deadframe = self.cpu.execute_token(looptoken, b.getint()) result = self.cpu.get_int_value(deadframe, 0) if guard == rop.GUARD_FALSE: assert result == execute(self.cpu, None, - op, None, b).value + op, None, b) else: assert result != execute(self.cpu, None, - op, None, b).value + op, None, b) def test_stuff_followed_by_guard(self): - boxes = [(BoxInt(1), BoxInt(0)), - (BoxInt(0), BoxInt(1)), - (BoxInt(1), BoxInt(1)), - (BoxInt(-1), BoxInt(1)), - (BoxInt(1), BoxInt(-1)), - (ConstInt(1), BoxInt(0)), - (ConstInt(0), BoxInt(1)), - (ConstInt(1), BoxInt(1)), - (ConstInt(-1), BoxInt(1)), - (ConstInt(1), BoxInt(-1)), - (BoxInt(1), ConstInt(0)), - (BoxInt(0), ConstInt(1)), - (BoxInt(1), ConstInt(1)), - (BoxInt(-1), ConstInt(1)), - (BoxInt(1), ConstInt(-1))] + boxes = [(InputArgInt(1), InputArgInt(0)), + (InputArgInt(0), InputArgInt(1)), + (InputArgInt(1), InputArgInt(1)), + (InputArgInt(-1), InputArgInt(1)), + (InputArgInt(1), InputArgInt(-1)), + (ConstInt(1), InputArgInt(0)), + (ConstInt(0), InputArgInt(1)), + (ConstInt(1), InputArgInt(1)), + (ConstInt(-1), InputArgInt(1)), + (ConstInt(1), InputArgInt(-1)), + (InputArgInt(1), ConstInt(0)), + (InputArgInt(0), ConstInt(1)), + (InputArgInt(1), ConstInt(1)), + (InputArgInt(-1), ConstInt(1)), + (InputArgInt(1), ConstInt(-1))] guards = [rop.GUARD_FALSE, rop.GUARD_TRUE] all = [rop.INT_EQ, rop.INT_NE, rop.INT_LE, rop.INT_LT, rop.INT_GT, rop.INT_GE, rop.UINT_GT, rop.UINT_LT, rop.UINT_LE, rop.UINT_GE] for a, b in boxes: for guard in guards: for op in all: - res = BoxInt() - i1 = BoxInt(1) + i1 = ResOperation(rop.SAME_AS_I, [ConstInt(1)]) + res = ResOperation(op, [a, b]) ops = [ - ResOperation(rop.SAME_AS, [ConstInt(1)], i1), - ResOperation(op, [a, b], res), - ResOperation(guard, [res], None, + i1, res, + ResOperation(guard, [res], descr=BasicFailDescr()), - ResOperation(rop.FINISH, [ConstInt(0)], None, + ResOperation(rop.FINISH, [ConstInt(0)], descr=BasicFinalDescr()), ] ops[-2].setfailargs([i1]) - inputargs = [i for i in (a, b) if isinstance(i, Box)] + inputargs = [i for i in (a, b) if not isinstance(i, Const)] looptoken = JitCellToken() self.cpu.compile_loop(inputargs, ops, looptoken) - inputvalues = [box.value for box in inputargs] + inputvalues = [box.getint() for box in inputargs] deadframe = self.cpu.execute_token(looptoken, *inputvalues) result = self.cpu.get_int_value(deadframe, 0) - expected = execute(self.cpu, None, op, None, a, b).value + expected = execute(self.cpu, None, op, None, a, b) if guard == rop.GUARD_FALSE: assert result == expected else: @@ -364,9 +364,9 @@ self.functions.append((name, address, size)) self.cpu.profile_agent = agent = FakeProfileAgent() - i0 = BoxInt() - i1 = BoxInt() - i2 = BoxInt() + i0 = InputArgInt() + i1 = InputArgInt() + i2 = InputArgInt() targettoken = TargetToken() faildescr1 = BasicFailDescr(1) faildescr2 = BasicFailDescr(2) @@ -395,8 +395,8 @@ assert loopaddress <= looptoken._ll_loop_code assert loopsize >= 40 # randomish number - i1b = BoxInt() - i3 = BoxInt() + i1b = InputArgInt() + i3 = InputArgInt() bridge = [ ResOperation(rop.INT_LE, [i1b, ConstInt(19)], i3), ResOperation(rop.GUARD_TRUE, [i3], None, descr=faildescr2), @@ -421,29 +421,26 @@ def test_ops_offset(self): from rpython.rlib import debug - i0 = BoxInt() - i1 = BoxInt() - i2 = BoxInt() looptoken = JitCellToken() targettoken = TargetToken() - operations = [ - ResOperation(rop.LABEL, [i0], None, descr=targettoken), - ResOperation(rop.INT_ADD, [i0, ConstInt(1)], i1), - ResOperation(rop.INT_LE, [i1, ConstInt(9)], i2), - ResOperation(rop.JUMP, [i1], None, descr=targettoken), - ] - inputargs = [i0] + loop = parse(""" + [i0] + label(i0) + i1 = int_add(i0, 1) + i2 = int_le(i1, 9) + jump(i1, descr=targettoken) + """, namespace=locals()) debug._log = dlog = debug.DebugLog() - info = self.cpu.compile_loop(inputargs, operations, looptoken) + info = self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) ops_offset = info.ops_offset debug._log = None # assert ops_offset is looptoken._x86_ops_offset # 2*increment_debug_counter + ops + None - assert len(ops_offset) == 2 + len(operations) + 1 - assert (ops_offset[operations[0]] <= - ops_offset[operations[1]] <= - ops_offset[operations[2]] <= + assert len(ops_offset) == 2 + len(loop.operations) + 1 + assert (ops_offset[loop.operations[0]] <= + ops_offset[loop.operations[1]] <= + ops_offset[loop.operations[2]] <= ops_offset[None]) def test_calling_convention(self, monkeypatch): @@ -482,12 +479,12 @@ # on Linux, because clibffi.get_call_conv() would always # return FFI_DEFAULT_ABI on non-Windows platforms. funcbox = ConstInt(rawstart) - i1 = BoxInt() - i2 = BoxInt() - i3 = BoxInt() - i4 = BoxInt() - i5 = BoxInt() - i6 = BoxInt() + i1 = InputArgInt() + i2 = InputArgInt() + i3 = InputArgInt() + i4 = InputArgInt() + i5 = InputArgInt() + i6 = InputArgInt() c = ConstInt(-1) faildescr = BasicFailDescr(1) cz = ConstInt(0) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit