[pypy-commit] pypy optresult: finish porting test_runner (yay!)
Author: Maciej Fijalkowski Branch: optresult Changeset: r74723:94595cb2a9e7 Date: 2014-11-26 11:11 +0200 http://bitbucket.org/pypy/pypy/changeset/94595cb2a9e7/ Log:finish porting test_runner (yay!) diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -949,7 +949,7 @@ execute_call_may_force_f = _execute_call_may_force execute_call_may_force_i = _execute_call_may_force -def execute_call_release_gil(self, descr, func, *args): +def _execute_call_release_gil(self, descr, func, *args): if hasattr(descr, '_original_func_'): func = descr._original_func_ # see pyjitpl.py # we want to call the function that does the aroundstate @@ -974,7 +974,12 @@ del self.force_guard_op return support.cast_result(descr.RESULT, result) -def execute_call_assembler(self, descr, *args): +execute_call_release_gil_n = _execute_call_release_gil +execute_call_release_gil_i = _execute_call_release_gil +execute_call_release_gil_r = _execute_call_release_gil +execute_call_release_gil_f = _execute_call_release_gil + +def _execute_call_assembler(self, descr, *args): # XXX simplify the following a bit # # pframe = CALL_ASSEMBLER(args..., descr=looptoken) @@ -1027,6 +1032,11 @@ result = support.cast_to_floatstorage(result) return result +execute_call_assembler_i = _execute_call_assembler +execute_call_assembler_r = _execute_call_assembler +execute_call_assembler_f = _execute_call_assembler +execute_call_assembler_n = _execute_call_assembler + def execute_same_as_i(self, _, x): return x execute_same_as_f = execute_same_as_i 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 @@ -2423,22 +2423,18 @@ assert c_tolower.call(argchain, rffi.INT) == ord('a') cpu = self.cpu -func_adr = llmemory.cast_ptr_to_adr(c_tolower.funcsym) -funcbox = ConstInt(heaptracker.adr2int(func_adr)) +func_adr = c_tolower.funcsym calldescr = cpu._calldescr_dynamic_for_tests([types.uchar], types.sint) -i1 = InputArgInt() -i2 = InputArgInt() -tok = InputArgInt() faildescr = BasicFailDescr(1) -ops = [ -ResOperation(rop.CALL_RELEASE_GIL, [funcbox, i1], i2, - descr=calldescr), -ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=faildescr), -ResOperation(rop.FINISH, [i2], None, descr=BasicFinalDescr(0)) -] -ops[1].setfailargs([i1, i2]) +finaldescr = BasicFinalDescr(0) +loop = parse(""" +[i1] +i2 = call_release_gil_i(ConstClass(func_adr), i1, descr=calldescr) +guard_not_forced(descr=faildescr) [i1, i2] +finish(i2, descr=finaldescr) +""", namespace=locals()) looptoken = JitCellToken() -self.cpu.compile_loop([i1], ops, looptoken) +self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) deadframe = self.cpu.execute_token(looptoken, ord('G')) fail = self.cpu.get_latest_descr(deadframe) assert fail.identifier == 0 @@ -2477,26 +2473,20 @@ del glob.lst[:] cpu = self.cpu -func_adr = llmemory.cast_ptr_to_adr(c_qsort.funcsym) -funcbox = ConstInt(heaptracker.adr2int(func_adr)) +func_adr = c_qsort.funcsym calldescr = cpu._calldescr_dynamic_for_tests( [types.pointer, types_size_t, types_size_t, types.pointer], types.void) -i0 = InputArgInt() -i1 = InputArgInt() -i2 = InputArgInt() -i3 = InputArgInt() -tok = InputArgInt() faildescr = BasicFailDescr(1) -ops = [ -ResOperation(rop.CALL_RELEASE_GIL, [funcbox, i0, i1, i2, i3], None, - descr=calldescr), -ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=faildescr), -ResOperation(rop.FINISH, [], None, descr=BasicFinalDescr(0)) -] -ops[1].setfailargs([]) +finaldescr = BasicFinalDescr(0) +loop = parse(""" +[i0, i1, i2, i3] +call_release_gil_n(ConstClass(func_adr), i0, i1, i2, i3, descr=calldescr) +guard_not_forced(descr=faildescr) [] +finish(descr=finaldescr) +""", namespace=locals()) looptoken = JitCellToken() -self.cpu.compile_loop([i0, i1, i2, i3], ops, looptoken) +self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) args = [rffi.cast(lltype.Signed, raw), 2, 4, @@ -2609,18 +2599,16 @@ faildescr = BasicFailDescr(1) kind = types.getkind(ffitype) if kind in 'uis': -
[pypy-commit] pypy portable-threadlocal: fixes
Author: Armin Rigo Branch: portable-threadlocal Changeset: r74724:9e8ef9cecb2e Date: 2014-11-26 12:16 +0100 http://bitbucket.org/pypy/pypy/changeset/9e8ef9cecb2e/ Log:fixes diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py --- a/pypy/module/pypyjit/test_pypy_c/test_call.py +++ b/pypy/module/pypyjit/test_pypy_c/test_call.py @@ -82,7 +82,7 @@ assert log.opnames(ops) == [] # assert entry_bridge.match_by_id('call', """ -p38 = call(ConstClass(_ll_0_threadlocalref_getter___), descr=) +p38 = call(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=) p39 = getfield_gc(p38, descr=) i40 = force_token() p41 = getfield_gc_pure(p38, descr=) @@ -444,7 +444,7 @@ p26 = getfield_gc(p7, descr=) guard_value(p26, ConstPtr(ptr27), descr=...) guard_not_invalidated(descr=...) -p29 = call(ConstClass(_ll_0_threadlocalref_getter___), descr=) +p29 = call(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=) p30 = getfield_gc(p29, descr=) p31 = force_token() p32 = getfield_gc_pure(p29, descr=) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy portable-threadlocal: Update the test
Author: Armin Rigo Branch: portable-threadlocal Changeset: r74727:250984ff4950 Date: 2014-11-26 12:38 +0100 http://bitbucket.org/pypy/pypy/changeset/250984ff4950/ Log:Update the test diff --git a/pypy/module/pypyjit/test_pypy_c/test_ffi.py b/pypy/module/pypyjit/test_pypy_c/test_ffi.py --- a/pypy/module/pypyjit/test_pypy_c/test_ffi.py +++ b/pypy/module/pypyjit/test_pypy_c/test_ffi.py @@ -199,21 +199,16 @@ ldexp_addr, res = log.result assert res == 8.0 * 300 loop, = log.loops_by_filename(self.filepath) -if 'ConstClass(ldexp)' in repr(loop): # e.g. OS/X -ldexp_addr = 'ConstClass(ldexp)' assert loop.match_by_id('cfficall', """ -... -f1 = call_release_gil(..., descr=) -... -""") -ops = loop.ops_by_id('cfficall') -for name in ['raw_malloc', 'raw_free']: -assert name not in str(ops) -for name in ['raw_load', 'raw_store', 'getarrayitem_raw', 'setarrayitem_raw']: -assert name not in log.opnames(ops) -# so far just check that call_release_gil() is produced. -# later, also check that the arguments to call_release_gil() -# are constants +setarrayitem_raw(i69, 0, i95, descr=)# write 'errno' +p96 = force_token() +setfield_gc(p0, p96, descr=) +f97 = call_release_gil(i59, 1.0, 3, descr=) +guard_not_forced(descr=...) +guard_no_exception(descr=...) +i98 = getarrayitem_raw(i69, 0, descr=) # read 'errno' +setfield_gc(p65, i98, descr=) +""", ignore_ops=['guard_not_invalidated']) def test_cffi_call_guard_not_forced_fails(self): # this is the test_pypy_c equivalent of ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy optresult: gah, that took forever to fix
Author: Maciej Fijalkowski Branch: optresult Changeset: r74728:279090680681 Date: 2014-11-26 13:06 +0200 http://bitbucket.org/pypy/pypy/changeset/279090680681/ Log:gah, that took forever to fix diff --git a/rpython/jit/metainterp/executor.py b/rpython/jit/metainterp/executor.py --- a/rpython/jit/metainterp/executor.py +++ b/rpython/jit/metainterp/executor.py @@ -479,7 +479,7 @@ def execute_nonspec_const(cpu, metainterp, opnum, argboxes, descr=None, type='i'): return wrap_constant(_execute_nonspec(cpu, metainterp, opnum, argboxes, - descr, type)) + descr)) @specialize.arg(2) def _execute_nonspec(cpu, metainterp, opnum, argboxes, descr=None): diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py @@ -2421,12 +2421,12 @@ pfieldvar = match.group(3) pendingfields.append((pvar, pfieldname, pfieldvar)) # -def _variables_equal(value, varname, strict): +def _variables_equal(box, varname, strict): if varname not in virtuals: if strict: assert box.same_box(oparse.getvar(varname)) else: -assert value == oparse.getvar(varname).getvalue() +assert box.getvalue() == oparse.getvar(varname).getvalue() else: tag, resolved, fieldstext = virtuals[varname] if tag[0] == 'virtual': @@ -2438,7 +2438,7 @@ else: assert 0 if resolved is not None: -assert resolved.value == box.value +assert resolved.getvalue() == box.getvalue() else: virtuals[varname] = tag, box, fieldstext # @@ -2482,7 +2482,8 @@ resolved, ConstInt(index)) else: assert 0 -_variables_equal(fieldval, fieldvalue.strip(), strict=False) +_variables_equal(executor.wrap_constant(fieldval), + fieldvalue.strip(), strict=False) index += 1 def check_expanded_fail_descr(self, expectedtext, guard_opnum): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy optresult: port some more tests and fix some issues
Author: Maciej Fijalkowski Branch: optresult Changeset: r74729:b066f43553d4 Date: 2014-11-26 13:41 +0200 http://bitbucket.org/pypy/pypy/changeset/b066f43553d4/ Log:port some more tests and fix some issues diff --git a/rpython/jit/metainterp/optimizeopt/earlyforce.py b/rpython/jit/metainterp/optimizeopt/earlyforce.py --- a/rpython/jit/metainterp/optimizeopt/earlyforce.py +++ b/rpython/jit/metainterp/optimizeopt/earlyforce.py @@ -4,7 +4,7 @@ def is_raw_free(op, opnum): -if not op.is_call(): +if not op.is_real_call(): return False einfo = op.getdescr().get_extra_info() return einfo.oopspecindex == EffectInfo.OS_RAW_FREE diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py @@ -2452,11 +2452,13 @@ for pvar, pfieldname, pfieldvar in pendingfields: box = oparse.getvar(pvar) fielddescr = self.namespace[pfieldname.strip()] -fieldbox = executor.execute(self.cpu, None, -rop.GETFIELD_GC, +opnum = OpHelpers.getfield_for_descr(fielddescr) +fieldval = executor.execute(self.cpu, None, +opnum, fielddescr, box) -_variables_equal(fieldbox, pfieldvar, strict=True) +_variables_equal(executor.wrap_constant(fieldval), pfieldvar, + strict=True) # for match in parts: pvar = match.group(1) @@ -2476,8 +2478,9 @@ resolved) elif tag[0] == 'varray': fieldvalue = fieldtext -fieldbox = executor.execute(self.cpu, None, -rop.GETARRAYITEM_GC, +#opnum = OpHelpers.getarrayitem_for_descr(fielddescr) +fieldval = executor.execute(self.cpu, None, +rop.GETARRAYITEM_GC_I, tag[1], resolved, ConstInt(index)) else: @@ -2637,7 +2640,7 @@ setarrayitem_gc(p1, 1, i1, descr=arraydescr) setarrayitem_gc(p1, 0, 25, descr=arraydescr) guard_true(i1, descr=fdescr) [p1] -i2 = getarrayitem_gc(p1, 1, descr=arraydescr) +i2 = getarrayitem_gc_i(p1, 1, descr=arraydescr) jump(i2) """ expected = """ @@ -2731,7 +2734,7 @@ jump(p1, i2, i4) """ self.optimize_loop(ops, expected) -self.loop.inputargs[0].value = self.nodebox.value +self.loop.inputargs[0].setref_base(self.nodeaddr) self.check_expanded_fail_descr(''' p1.nextdescr = p2 where p2 is a node_vtable, valuedescr=i2 @@ -2765,7 +2768,7 @@ ops = """ [p1, p2] i1 = getfield_gc_i(p1, descr=valuedescr) -i2 = call(i1, descr=nonwritedescr) +i2 = call_i(i1, descr=nonwritedescr) i3 = getfield_gc_i(p1, descr=valuedescr) escape(i1) escape(i3) @@ -2774,7 +2777,7 @@ expected = """ [p1, p2] i1 = getfield_gc_i(p1, descr=valuedescr) -i2 = call(i1, descr=nonwritedescr) +i2 = call_i(i1, descr=nonwritedescr) escape(i1) escape(i1) jump(p1, p2) @@ -2786,7 +2789,7 @@ [p1, p2] i1 = getfield_gc_i(p1, descr=adescr) i2 = getfield_gc_i(p1, descr=bdescr) -i3 = call(i1, descr=writeadescr) +i3 = call_i(i1, descr=writeadescr) i4 = getfield_gc_i(p1, descr=adescr) i5 = getfield_gc_i(p1, descr=bdescr) escape(i1) @@ -2799,7 +2802,7 @@ [p1, p2] i1 = getfield_gc_i(p1, descr=adescr) i2 = getfield_gc_i(p1, descr=bdescr) -i3 = call(i1, descr=writeadescr) +i3 = call_i(i1, descr=writeadescr) i4 = getfield_gc_i(p1, descr=adescr) escape(i1) escape(i2) @@ -2812,11 +2815,11 @@ def test_residual_call_invalidate_arrays(self): ops = """ [p1, p2, i1] -p3 = getarrayitem_gc(p1, 0, descr=arraydescr2) -p4 = getarrayitem_gc(p2, 1, descr=arraydescr2) -i3 = call(i1, descr=writeadescr) -p5 = getarrayitem_gc(p1, 0, descr=arraydescr2) -p6 = getarrayitem_gc(p2, 1, descr=arraydescr2) +p3 = getarrayitem_gc_r(p1, 0, descr=arraydescr2) +p4 = getarrayitem_gc_r(p2, 1, descr=arraydescr2) +i3 = call_i(i1, descr=writeadescr) +p5 = getarrayitem_gc_r(p1, 0, descr=arraydescr2) +p6 = getarrayitem_gc_r(p2, 1, descr=arraydescr2) escape(p3)
[pypy-commit] pypy framestate: Use (bc_block, index-in-block) as position
Author: Ronan Lamy Branch: framestate Changeset: r74730:84a74ea27d86 Date: 2014-11-25 19:21 +0100 http://bitbucket.org/pypy/pypy/changeset/84a74ea27d86/ Log:Use (bc_block, index-in-block) as position diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -245,10 +245,11 @@ return block.operations[i].offset def get_position(self, offset): -return offset +return self.pos_index[offset] def get_offset(self, position): -return position +block, i = position +return block[i].offset def dump(self): all_blocks = set(x[0] for x in self.pos_index.values()) diff --git a/rpython/flowspace/pygraph.py b/rpython/flowspace/pygraph.py --- a/rpython/flowspace/pygraph.py +++ b/rpython/flowspace/pygraph.py @@ -1,7 +1,7 @@ """ Implements flow graphs for Python callables """ -from rpython.flowspace.model import FunctionGraph, Constant, Variable +from rpython.flowspace.model import FunctionGraph, Variable from rpython.flowspace.framestate import FrameState class PyGraph(FunctionGraph): @@ -14,7 +14,9 @@ locals = [None] * code.co_nlocals for i in range(code.formalargcount): locals[i] = Variable(code.co_varnames[i]) -state = FrameState(locals, [], None, [], 0) +bc_graph = code.graph +start_pos = bc_graph.entry._exits[0], 0 +state = FrameState(locals, [], None, [], start_pos) initialblock = SpamBlock(state) super(PyGraph, self).__init__(self._sanitize_funcname(func), initialblock) self.func = func ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy framestate: create bc_graph.iter_instr()
Author: Ronan Lamy Branch: framestate Changeset: r74731:dc288d5b57c8 Date: 2014-11-26 00:57 +0100 http://bitbucket.org/pypy/pypy/changeset/dc288d5b57c8/ Log:create bc_graph.iter_instr() diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -251,6 +251,12 @@ block, i = position return block[i].offset +def iter_instr(self): +while True: +offset = self.get_offset(self.curr_position) +instr = self.read(offset) +yield instr + def dump(self): all_blocks = set(x[0] for x in self.pos_index.values()) blocks = sorted(all_blocks, key=lambda b: b.startpos) diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -350,13 +350,13 @@ self.setstate(block.framestate) self.recorder = block.make_recorder() bc_graph = self.pycode.graph -next_offset = bc_graph.get_offset(block.framestate.position) +bc_graph.curr_position = block.framestate.position try: -while True: -instr = bc_graph.read(next_offset) +for instr in bc_graph.iter_instr(): self.last_offset = instr.offset next_offset = self.handle_bytecode(instr) position = bc_graph.get_position(next_offset) +bc_graph.curr_position = position self.recorder.final_state = self.getstate(position) except RaiseImplicit as e: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy framestate: return positions from handle_bytecode()
Author: Ronan Lamy Branch: framestate Changeset: r74734:d5cab6a66583 Date: 2014-11-26 14:25 +0100 http://bitbucket.org/pypy/pypy/changeset/d5cab6a66583/ Log:return positions from handle_bytecode() diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -234,15 +234,15 @@ bc_block, i = self.pos_index[pos] return bc_block[i] -def next_pos(self, instr): -block, i = self.pos_index[instr.offset] +def next_pos(self): +block, i = self.curr_position i = i + 1 if i >= len(block.operations): assert len(block._exits) == 1 assert block._exits[0] is not block -return block._exits[0].startpos +return (block._exits[0], 0) else: -return block.operations[i].offset +return block, i def get_position(self, offset): return self.pos_index[offset] diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -354,8 +354,7 @@ try: for instr in bc_graph.iter_instr(): self.last_offset = instr.offset -next_offset = self.handle_bytecode(instr) -position = bc_graph.get_position(next_offset) +position = self.handle_bytecode(instr) bc_graph.curr_position = position self.recorder.final_state = self.getstate(position) @@ -459,11 +458,12 @@ try: next_offset = instr.eval(self) except FlowSignal as signal: -return self.unroll(signal) +return bc_graph.get_position(self.unroll(signal)) if next_offset is None: -next_offset = bc_graph.next_pos(instr) -elif isinstance(next_offset, BytecodeBlock): -next_offset = next_offset.startpos +next_offset = bc_graph.next_pos() +else: +assert isinstance(next_offset, BytecodeBlock) +next_offset = next_offset, 0 return next_offset def unroll(self, signal): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy framestate: move FOR_ITER
Author: Ronan Lamy Branch: framestate Changeset: r74732:b8afe00c2ad2 Date: 2014-11-26 14:03 +0100 http://bitbucket.org/pypy/pypy/changeset/b8afe00c2ad2/ Log:move FOR_ITER diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -476,6 +476,22 @@ reader.end_block() @bc_reader.register_opcode +class FOR_ITER(BCInstruction): +def eval(self, ctx): +from rpython.flowspace.flowcontext import Raise +w_iterator = ctx.peekvalue() +try: +w_nextitem = op.next(w_iterator).eval(ctx) +ctx.pushvalue(w_nextitem) +except Raise as e: +if ctx.exception_match(e.w_exc.w_type, const(StopIteration)): +ctx.popvalue() +return self.arg +else: +raise + + +@bc_reader.register_opcode class SETUP_EXCEPT(BCInstruction): def eval(self, ctx): from rpython.flowspace.flowcontext import ExceptBlock diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -708,18 +708,6 @@ w_iterator = op.iter(w_iterable).eval(self) self.pushvalue(w_iterator) -def FOR_ITER(self, target): -w_iterator = self.peekvalue() -try: -w_nextitem = op.next(w_iterator).eval(self) -self.pushvalue(w_nextitem) -except Raise as e: -if self.exception_match(e.w_exc.w_type, const(StopIteration)): -self.popvalue() -return target -else: -raise - def SETUP_LOOP(self, target): block = LoopBlock(self.stackdepth, target) self.blockstack.append(block) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy framestate: return blocks, not offsets, from FOR_ITER.eval()
Author: Ronan Lamy Branch: framestate Changeset: r74733:be6505ef80a3 Date: 2014-11-26 14:11 +0100 http://bitbucket.org/pypy/pypy/changeset/be6505ef80a3/ Log:return blocks, not offsets, from FOR_ITER.eval() diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -477,16 +477,25 @@ @bc_reader.register_opcode class FOR_ITER(BCInstruction): +def bc_flow(self, reader): +block = reader.curr_block +block.operations.append(self) +self.exit = reader.get_block_at(self.arg) +self.body = reader.get_next_block() +block.set_exits([self.body, self.exit]) +reader.end_block() + def eval(self, ctx): from rpython.flowspace.flowcontext import Raise w_iterator = ctx.peekvalue() try: w_nextitem = op.next(w_iterator).eval(ctx) ctx.pushvalue(w_nextitem) +return self.body except Raise as e: if ctx.exception_match(e.w_exc.w_type, const(StopIteration)): ctx.popvalue() -return self.arg +return self.exit else: raise ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy framestate: inline handle_bytecode()
Author: Ronan Lamy Branch: framestate Changeset: r74735:d1f5bf302728 Date: 2014-11-26 14:59 +0100 http://bitbucket.org/pypy/pypy/changeset/d1f5bf302728/ Log:inline handle_bytecode() diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -15,8 +15,7 @@ from rpython.flowspace.specialcase import (rpython_print_item, rpython_print_newline) from rpython.flowspace.operation import op -from rpython.flowspace.bytecode import ( -BytecodeBlock, BytecodeCorruption, bc_reader) +from rpython.flowspace.bytecode import BytecodeCorruption, bc_reader from rpython.flowspace.pygraph import PyGraph w_None = const(None) @@ -354,9 +353,17 @@ try: for instr in bc_graph.iter_instr(): self.last_offset = instr.offset -position = self.handle_bytecode(instr) -bc_graph.curr_position = position -self.recorder.final_state = self.getstate(position) +try: +next_block = instr.eval(self) +except FlowSignal as signal: +next_position = bc_graph.get_position(self.unroll(signal)) +else: +if next_block is None: +next_position = bc_graph.next_pos() +else: +next_position = next_block, 0 +bc_graph.curr_position = next_position +self.recorder.final_state = self.getstate(next_position) except RaiseImplicit as e: w_exc = e.w_exc @@ -453,19 +460,6 @@ stack_items_w[i] = w_new break -def handle_bytecode(self, instr): -bc_graph = self.pycode.graph -try: -next_offset = instr.eval(self) -except FlowSignal as signal: -return bc_graph.get_position(self.unroll(signal)) -if next_offset is None: -next_offset = bc_graph.next_pos() -else: -assert isinstance(next_offset, BytecodeBlock) -next_offset = next_offset, 0 -return next_offset - def unroll(self, signal): while self.blockstack: block = self.blockstack.pop() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy portable-threadlocal: test and fix for the no-__thread case
Author: Armin Rigo Branch: portable-threadlocal Changeset: r74736:31fa1fdc28a7 Date: 2014-11-26 15:44 +0100 http://bitbucket.org/pypy/pypy/changeset/31fa1fdc28a7/ Log:test and fix for the no-__thread case diff --git a/rpython/translator/c/src/threadlocal.c b/rpython/translator/c/src/threadlocal.c --- a/rpython/translator/c/src/threadlocal.c +++ b/rpython/translator/c/src/threadlocal.c @@ -69,6 +69,9 @@ explicitly, with malloc()/free(), and attached to (a single) thread- local key using the API of Windows or pthread. */ +pthread_key_t pypy_threadlocal_key; + + void RPython_ThreadLocals_ProgramInit(void) { #ifdef _WIN32 diff --git a/rpython/translator/c/src/threadlocal.h b/rpython/translator/c/src/threadlocal.h --- a/rpython/translator/c/src/threadlocal.h +++ b/rpython/translator/c/src/threadlocal.h @@ -55,15 +55,16 @@ #ifdef _WIN32 # include # include -# define _RPy_ThreadLocals_Get TlsGetValue -# define _RPy_ThreadLocals_Set TlsSetValue -RPY_EXTERN DWORD pypy_threadlocal_key; +# define _RPy_ThreadLocals_Get() TlsGetValue(pypy_threadlocal_key) +# define _RPy_ThreadLocals_Set(x) TlsSetValue(pypy_threadlocal_key, x) +typedef DWORD pthread_key_t; #else # include -# define _RPy_ThreadLocals_Get pthread_getspecific -# define _RPy_ThreadLocals_Set pthread_setspecific +# define _RPy_ThreadLocals_Get() pthread_getspecific(pypy_threadlocal_key) +# define _RPy_ThreadLocals_Set(x) pthread_setspecific(pypy_threadlocal_key, x) +#endif + RPY_EXTERN pthread_key_t pypy_threadlocal_key; -#endif #define OP_THREADLOCALREF_ADDR(r) \ diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -2,6 +2,7 @@ import sys, os, re from rpython.config.translationoption import get_combined_translation_config +from rpython.config.translationoption import SUPPORT__THREAD from rpython.rlib.objectmodel import keepalive_until_here from rpython.rlib.rarithmetic import r_longlong from rpython.rlib.debug import ll_assert, have_debug_prints, debug_flush @@ -1026,11 +1027,12 @@ gcrootfinder = 'shadowstack' config = None -def compile(self, entry_point): +def compile(self, entry_point, no__thread=True): t = TranslationContext(self.config) t.config.translation.gc = "semispace" t.config.translation.gcrootfinder = self.gcrootfinder t.config.translation.thread = True +t.config.translation.no__thread = no__thread t.buildannotator().build_types(entry_point, [s_list_of_strings]) t.buildrtyper().specialize() # @@ -1142,7 +1144,7 @@ def test_thread_and_gc(self): import time, gc -from rpython.rlib import rthread +from rpython.rlib import rthread, rposix from rpython.rtyper.lltypesystem import lltype from rpython.rlib.objectmodel import invoke_around_extcall @@ -1163,14 +1165,22 @@ self.head = head self.tail = tail +def check_errno(value): +rposix.set_errno(value) +for i in range(1000): +pass +assert rposix.get_errno() == value + def bootstrap(): rthread.gc_thread_start() +check_errno(42) state.xlist.append(Cons(123, Cons(456, None))) gc.collect() rthread.gc_thread_die() def new_thread(): ident = rthread.start_new_thread(bootstrap, ()) +check_errno(41) time.sleep(0.5)# enough time to start, hopefully return ident @@ -1209,14 +1219,19 @@ os.write(1, "%d ok\n" % (i+1)) return 0 -t, cbuilder = self.compile(entry_point) -data = cbuilder.cmdexec('') -assert data.splitlines() == ['hello world', - '1 ok', - '2 ok', - '3 ok', - '4 ok', - '5 ok'] +def runme(no__thread): +t, cbuilder = self.compile(entry_point, no__thread=no__thread) +data = cbuilder.cmdexec('') +assert data.splitlines() == ['hello world', + '1 ok', + '2 ok', + '3 ok', + '4 ok', + '5 ok'] + +if SUPPORT__THREAD: +runme(no__thread=False) +runme(no__thread=True) def test_gc_with_fork_without_threads(self): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy optresult: FORCE_TOKEN returns a GCREF. otherwise just whack whack until more tests pass
Author: Maciej Fijalkowski Branch: optresult Changeset: r74737:4518e77297b1 Date: 2014-11-26 16:32 +0200 http://bitbucket.org/pypy/pypy/changeset/4518e77297b1/ Log:FORCE_TOKEN returns a GCREF. otherwise just whack whack until more tests pass diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -679,7 +679,7 @@ class LLFrame(object): -_TYPE = lltype.Signed +_TYPE = llmemory.GCREF forced_deadframe = None overflow_flag = False 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 @@ -2272,7 +2272,7 @@ values.append(self.cpu.get_int_value(deadframe, 1)) self.cpu.set_savedata_ref(deadframe, random_gcref) -FUNC = self.FuncType([lltype.Signed, lltype.Signed], lltype.Void) +FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Void) func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force) calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, EffectInfo.MOST_GENERAL) @@ -2281,8 +2281,8 @@ finaldescr = BasicFinalDescr(0) loop = parse(""" [i0, i1] -i2 = force_token() -call_may_force_n(ConstClass(func_ptr), i2, i1, descr=calldescr) +p2 = force_token() +call_may_force_n(ConstClass(func_ptr), p2, i1, descr=calldescr) guard_not_forced(descr=faildescr) [i1, i0] finish(i0, descr=finaldescr) """, namespace=locals()) @@ -2313,7 +2313,7 @@ self.cpu.set_savedata_ref(deadframe, random_gcref) return 42 -FUNC = self.FuncType([lltype.Signed, lltype.Signed], lltype.Signed) +FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Signed) func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force) calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, EffectInfo.MOST_GENERAL) @@ -2322,8 +2322,8 @@ finaldescr = BasicFinalDescr(0) loop = parse(""" [i0, i1] -i3 = force_token() -i2 = call_may_force_i(ConstClass(func_ptr), i3, i1, descr=calldescr) +p3 = force_token() +i2 = call_may_force_i(ConstClass(func_ptr), p3, i1, descr=calldescr) guard_not_forced(descr=faildescr) [i1, i2, i0] finish(i2, descr=finaldescr) """, namespace=locals()) @@ -2356,7 +2356,7 @@ self.cpu.set_savedata_ref(deadframe, random_gcref) return 42.5 -FUNC = self.FuncType([lltype.Signed, lltype.Signed], lltype.Float) +FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Float) func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -2366,8 +2366,8 @@ finaldescr = BasicFinalDescr(0) loop = parse(""" [i0, i1] -i3 = force_token() -f2 = call_may_force_f(ConstClass(func_ptr), i3, i1, descr=calldescr) +p3 = force_token() +f2 = call_may_force_f(ConstClass(func_ptr), p3, i1, descr=calldescr) guard_not_forced(descr=faildescr) [i1, f2, i0] finish(f2, descr=finaldescr) """, namespace=locals()) @@ -2397,16 +2397,16 @@ loop = parse(""" [i0] i1 = int_add(i0, 10) -i2 = force_token() +p2 = force_token() guard_not_forced_2(descr=faildescr) [i1] -finish(i2, descr=finaldescr) +finish(p2, descr=finaldescr) """, namespace=locals()) looptoken = JitCellToken() self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) deadframe = self.cpu.execute_token(looptoken, 20) fail = self.cpu.get_latest_descr(deadframe) assert fail.identifier == 0 -frame = self.cpu.get_int_value(deadframe, 0) +frame = self.cpu.get_ref_value(deadframe, 0) # actually, we should get the same pointer in 'frame' and 'deadframe' # but it is not the case on LLGraph if not getattr(self.cpu, 'is_llgraph', False): @@ -4142,7 +4142,7 @@ values.append(self.cpu.get_int_value(deadframe, 0)) return 42 -FUNC = self.FuncType([lltype.Signed, lltype.Signed], lltype.Signed) +FUNC = self.FuncType([llmemory.GCREF, lltype.Signed], lltype.Signed) func_ptr = llhelper(lltype.Ptr(FUNC), maybe_force) calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, EffectInfo.MOST_GENERAL) @@ -4150,8 +4150,8 @@ faildescr = BasicFailDescr(23) loop = parse(""" [i0, i1] -
[pypy-commit] pypy default: Add 'int_signext' to replace the three instructions which have all very
Author: Armin Rigo Branch: Changeset: r74738:68c97410a30e Date: 2014-11-26 18:16 +0100 http://bitbucket.org/pypy/pypy/changeset/68c97410a30e/ Log:Add 'int_signext' to replace the three instructions which have all very large constants when used to sign-extend a 32-bit integer into a full 64-bit word. diff --git a/rpython/jit/backend/arm/codebuilder.py b/rpython/jit/backend/arm/codebuilder.py --- a/rpython/jit/backend/arm/codebuilder.py +++ b/rpython/jit/backend/arm/codebuilder.py @@ -318,6 +318,18 @@ | (rd & 0xF) << 12 | imm16 & 0xFFF) +def SXTB_rr(self, rd, rm, c=cond.AL): +self.write32(c << 28 +| 0x06AF0070 +| (rd & 0xF) << 12 +| (rm & 0xF)) + +def SXTB16_rr(self, rd, rm, c=cond.AL): +self.write32(c << 28 +| 0x068F0070 +| (rd & 0xF) << 12 +| (rm & 0xF)) + def LDREX(self, rt, rn, c=cond.AL): self.write32(c << 28 | 0x01900f9f 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 @@ -102,6 +102,17 @@ self.mc.MOV_rr(res.value, arg.value, cond=c.GE) return fcond +def emit_op_int_signext(self, op, arglocs, regalloc, fcond): +arg, numbytes, res = arglocs +assert numbytes.is_imm() +if numbytes.value == 1: +self.mc.SXTB_rr(res.value, arg.value) +elif numbytes.value == 2: +self.mc.SXTB16_rr(res.value, arg.value) +else: +raise AssertionError("bad number of bytes") +return fcond + #ref: http://blogs.arm.com/software-enablement/detecting-overflow-from-mul/ def emit_guard_int_mul_ovf(self, op, guard, arglocs, regalloc, fcond): reg1 = arglocs[0] 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 @@ -458,6 +458,12 @@ resloc = self.force_allocate_reg(op.result, [op.getarg(0)]) return [argloc, resloc] +def prepare_op_int_signext(self, op, fcond): +argloc = self.make_sure_var_in_reg(op.getarg(0)) +numbytes = op.getarg(1).getint() +resloc = self.force_allocate_reg(op.result) +return [argloc, imm(numbytes), resloc] + def prepare_guard_int_mul_ovf(self, op, guard, fcond): boxes = op.getarglist() reg1 = self.make_sure_var_in_reg(boxes[0], forbidden_vars=boxes) 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 @@ -3890,6 +3890,26 @@ deadframe = self.cpu.execute_token(looptoken, inp) assert outp == self.cpu.get_int_value(deadframe, 0) +def test_int_signext(self): +numbytes_cases = [1, 2] if IS_32_BIT else [1, 2, 4] +for numbytes in numbytes_cases: +ops = """ +[i0] +i1 = int_signext(i0, %d) +finish(i1, descr=descr) +""" % numbytes +descr = BasicFinalDescr() +loop = parse(ops, self.cpu, namespace=locals()) +looptoken = JitCellToken() +self.cpu.compile_loop(loop.inputargs, loop.operations, looptoken) +test_cases = [random.randrange(-sys.maxint-1, sys.maxint+1) + for _ in range(100)] +for test_case in test_cases: +deadframe = self.cpu.execute_token(looptoken, test_case) +got = self.cpu.get_int_value(deadframe, 0) +expected = heaptracker.int_signext(test_case, numbytes) +assert got == expected + def test_compile_asmlen(self): from rpython.jit.backend.llsupport.llmodel import AbstractLLCPU if not isinstance(self.cpu, AbstractLLCPU): 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 @@ -1143,6 +1143,18 @@ def genop_math_sqrt(self, op, arglocs, resloc): self.mc.SQRTSD(arglocs[0], resloc) +def genop_int_signext(self, op, arglocs, resloc): +argloc, numbytesloc = arglocs +assert isinstance(numbytesloc, ImmedLoc) +if numbytesloc.value == 1: +self.mc.MOVSX8(resloc, argloc) +elif numbytesloc.value == 2: +self.mc.MOVSX16(resloc, argloc) +elif IS_X86_64 and numbytesloc.value == 4: +self.mc.MOVSX32(resloc, argloc) +else: +raise AssertionError("bad number of bytes") + def genop_guard_float_ne(self, op, guard_op, guard_token, arglocs, result_loc): guard_opnum = guard_op.getopnum()
[pypy-commit] pypy default: Change cffi's primitive integer type to use int_signext (via type casts)
Author: Armin Rigo Branch: Changeset: r74739:4af7cfa6d69c Date: 2014-11-26 18:48 +0100 http://bitbucket.org/pypy/pypy/changeset/4af7cfa6d69c/ Log:Change cffi's primitive integer type to use int_signext (via type casts) diff --git a/pypy/module/_cffi_backend/ctypeprim.py b/pypy/module/_cffi_backend/ctypeprim.py --- a/pypy/module/_cffi_backend/ctypeprim.py +++ b/pypy/module/_cffi_backend/ctypeprim.py @@ -158,21 +158,14 @@ class W_CTypePrimitiveSigned(W_CTypePrimitive): -_attrs_= ['value_fits_long', 'vmin', 'vrangemax'] -_immutable_fields_ = ['value_fits_long', 'vmin', 'vrangemax'] +_attrs_= ['value_fits_long', 'value_smaller_than_long'] +_immutable_fields_ = ['value_fits_long', 'value_smaller_than_long'] is_primitive_integer = True def __init__(self, *args): W_CTypePrimitive.__init__(self, *args) self.value_fits_long = self.size <= rffi.sizeof(lltype.Signed) -if self.size < rffi.sizeof(lltype.Signed): -assert self.value_fits_long -sh = self.size * 8 -self.vmin = r_uint(-1) << (sh - 1) -self.vrangemax = (r_uint(1) << sh) - 1 -else: -self.vmin = r_uint(0) -self.vrangemax = r_uint(-1) +self.value_smaller_than_long = self.size < rffi.sizeof(lltype.Signed) def cast_to_int(self, cdata): return self.convert_to_object(cdata) @@ -192,8 +185,17 @@ def convert_from_object(self, cdata, w_ob): if self.value_fits_long: value = misc.as_long(self.space, w_ob) -if self.size < rffi.sizeof(lltype.Signed): -if r_uint(value) - self.vmin > self.vrangemax: +if self.value_smaller_than_long: +size = self.size +if size == 1: +signextended = misc.signext(value, 1) +elif size == 2: +signextended = misc.signext(value, 2) +elif size == 4: +signextended = misc.signext(value, 4) +else: +raise AssertionError("unsupported size") +if value != signextended: self._overflow(w_ob) misc.write_raw_signed_data(cdata, value, self.size) else: @@ -221,7 +223,7 @@ length = w_cdata.get_array_length() populate_list_from_raw_array(res, buf, length) return res -elif self.value_fits_long: +elif self.value_smaller_than_long: res = [0] * w_cdata.get_array_length() misc.unpack_list_from_raw_array(res, w_cdata._cdata, self.size) return res @@ -235,8 +237,8 @@ cdata = rffi.cast(rffi.LONGP, cdata) copy_list_to_raw_array(int_list, cdata) else: -overflowed = misc.pack_list_to_raw_array_bounds( -int_list, cdata, self.size, self.vmin, self.vrangemax) +overflowed = misc.pack_list_to_raw_array_bounds_signed( +int_list, cdata, self.size) if overflowed != 0: self._overflow(self.space.wrap(overflowed)) return True @@ -314,8 +316,8 @@ def pack_list_of_items(self, cdata, w_ob): int_list = self.space.listview_int(w_ob) if int_list is not None: -overflowed = misc.pack_list_to_raw_array_bounds( -int_list, cdata, self.size, r_uint(0), self.vrangemax) +overflowed = misc.pack_list_to_raw_array_bounds_unsigned( +int_list, cdata, self.size, self.vrangemax) if overflowed != 0: self._overflow(self.space.wrap(overflowed)) return True diff --git a/pypy/module/_cffi_backend/misc.py b/pypy/module/_cffi_backend/misc.py --- a/pypy/module/_cffi_backend/misc.py +++ b/pypy/module/_cffi_backend/misc.py @@ -216,6 +216,19 @@ neg_msg = "can't convert negative number to unsigned" ovf_msg = "long too big to convert" +@specialize.arg(1) +def signext(value, size): +# 'value' is sign-extended from 'size' bytes to a full integer. +# 'size' should be a constant smaller than a full integer size. +if size == rffi.sizeof(rffi.SIGNEDCHAR): +return rffi.cast(lltype.Signed, rffi.cast(rffi.SIGNEDCHAR, value)) +elif size == rffi.sizeof(rffi.SHORT): +return rffi.cast(lltype.Signed, rffi.cast(rffi.SHORT, value)) +elif size == rffi.sizeof(rffi.INT): +return rffi.cast(lltype.Signed, rffi.cast(rffi.INT, value)) +else: +raise AssertionError("unsupported size") + # class _NotStandardObject(Exception): @@ -334,13 +347,26 @@ # -def pack_list_to_raw_array_bounds(int_list, target, size, vmin, vrangemax): +def pack_list_to_raw_array_bounds_signed(int_list, target, size):
[pypy-commit] pypy portable-threadlocal: fix test
Author: Armin Rigo Branch: portable-threadlocal Changeset: r74740:cd80e75755dc Date: 2014-11-26 20:13 +0100 http://bitbucket.org/pypy/pypy/changeset/cd80e75755dc/ Log:fix test diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py --- a/pypy/module/pypyjit/test_pypy_c/model.py +++ b/pypy/module/pypyjit/test_pypy_c/model.py @@ -184,10 +184,10 @@ matcher = OpMatcher(ops) return matcher.match(expected_src, **kwds) -def match_by_id(self, id, expected_src, **kwds): +def match_by_id(self, id, expected_src, ignore_ops=[], **kwds): ops = list(self.ops_by_id(id, **kwds)) matcher = OpMatcher(ops, id) -return matcher.match(expected_src) +return matcher.match(expected_src, ignore_ops=ignore_ops) class PartialTraceWithIds(TraceWithIds): def __init__(self, trace, is_entry_bridge=False): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Wrong instruction.
Author: Armin Rigo Branch: Changeset: r74741:af4cfbb2548c Date: 2014-11-26 22:27 +0100 http://bitbucket.org/pypy/pypy/changeset/af4cfbb2548c/ Log:Wrong instruction. diff --git a/rpython/jit/backend/arm/codebuilder.py b/rpython/jit/backend/arm/codebuilder.py --- a/rpython/jit/backend/arm/codebuilder.py +++ b/rpython/jit/backend/arm/codebuilder.py @@ -324,9 +324,9 @@ | (rd & 0xF) << 12 | (rm & 0xF)) -def SXTB16_rr(self, rd, rm, c=cond.AL): +def SXTH_rr(self, rd, rm, c=cond.AL): self.write32(c << 28 -| 0x068F0070 +| 0x06BF0070 | (rd & 0xF) << 12 | (rm & 0xF)) 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 @@ -108,7 +108,7 @@ if numbytes.value == 1: self.mc.SXTB_rr(res.value, arg.value) elif numbytes.value == 2: -self.mc.SXTB16_rr(res.value, arg.value) +self.mc.SXTH_rr(res.value, arg.value) else: raise AssertionError("bad number of bytes") return fcond ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy portable-threadlocal: document as_key() and add one for RawSPStackLocation, needed now
Author: Armin Rigo Branch: portable-threadlocal Changeset: r74742:a80d4cea2d6e Date: 2014-11-27 00:17 +0100 http://bitbucket.org/pypy/pypy/changeset/a80d4cea2d6e/ Log:document as_key() and add one for RawSPStackLocation, needed now 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 @@ -46,7 +46,7 @@ def is_core_reg(self): return True -def as_key(self): +def as_key(self): # 0 <= as_key <= 15 return self.value @@ -64,7 +64,7 @@ def is_vfp_reg(self): return True -def as_key(self): +def as_key(self):# 20 <= as_key <= 35 return self.value + 20 def is_float(self): @@ -115,8 +115,8 @@ def is_imm_float(self): return True -def as_key(self): -return self.value +def as_key(self): # a real address + 1 +return self.value | 1 def is_float(self): return True @@ -148,7 +148,7 @@ def is_stack(self): return True -def as_key(self): +def as_key(self):# an aligned word + 1 return self.position + 1 def is_float(self): @@ -174,6 +174,9 @@ def is_float(self): return self.type == FLOAT +def as_key(self):# a word >= 1000, and < 1000 + size of SP frame +return self.value + 1000 + def imm(i): return ImmLocation(i) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Debian gcc 4.9.2 seems to be emmiting some nb variant instructions
Author: Stefano Rivera Branch: Changeset: r74743:c1abec418acf Date: 2014-11-26 17:57 -0800 http://bitbucket.org/pypy/pypy/changeset/c1abec418acf/ Log:Debian gcc 4.9.2 seems to be emmiting some nb variant instructions diff --git a/rpython/translator/c/gcc/trackgcroot.py b/rpython/translator/c/gcc/trackgcroot.py --- a/rpython/translator/c/gcc/trackgcroot.py +++ b/rpython/translator/c/gcc/trackgcroot.py @@ -590,7 +590,7 @@ # The various cmov* operations for name in ''' -e ne g ge l le a ae b be p np s ns o no +e ne g ge l le a ae b be nb p np s ns o no '''.split(): locals()['visit_cmov' + name] = binary_insn locals()['visit_cmov' + name + 'l'] = binary_insn @@ -837,6 +837,7 @@ visit_jb = conditional_jump visit_jbe = conditional_jump visit_jp = conditional_jump +visit_jnb = conditional_jump visit_jnp = conditional_jump visit_js = conditional_jump visit_jns = conditional_jump ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit