[pypy-commit] pypy default: Fix the default goal. Unsure if it's better to keep it at all or completely remove it.
Author: Armin Rigo Branch: Changeset: r60516:cf3939f3c5ed Date: 2013-01-27 12:52 +0100 http://bitbucket.org/pypy/pypy/changeset/cf3939f3c5ed/ Log:Fix the default goal. Unsure if it's better to keep it at all or completely remove it. diff --git a/rpython/translator/goal/translate.py b/rpython/translator/goal/translate.py --- a/rpython/translator/goal/translate.py +++ b/rpython/translator/goal/translate.py @@ -50,7 +50,7 @@ return result translate_optiondescr = OptionDescription("translate", "XXX", [ -StrOption("targetspec", "XXX", default='targetpypystandalone', +StrOption("targetspec", "XXX", default='../../pypy/goal/targetpypystandalone', cmdline=None), ChoiceOption("opt", "optimization level", OPT_LEVELS, default=DEFAULT_OPT_LEVEL, ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy better-log-parser: Start a simpler version of jitlogparser
Author: Maciej Fijalkowski Branch: better-log-parser Changeset: r60517:0f876ed9d38e Date: 2013-01-26 14:40 +0200 http://bitbucket.org/pypy/pypy/changeset/0f876ed9d38e/ Log:Start a simpler version of jitlogparser diff --git a/rpython/jit/tool/oparser_model.py b/rpython/jit/tool/oparser_model.py --- a/rpython/jit/tool/oparser_model.py +++ b/rpython/jit/tool/oparser_model.py @@ -84,7 +84,8 @@ return str(self.value) class ConstInt(Const): -pass +def getint(self): +return self.value class ConstPtr(Const): pass ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: put force_token into a normal register, so it's no longer tied to a strange ebp
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60518:7712c8416bac Date: 2013-01-27 14:32 +0200 http://bitbucket.org/pypy/pypy/changeset/7712c8416bac/ Log:put force_token into a normal register, so it's no longer tied to a strange ebp location. That removes quite a bit of hacks. 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 @@ -1874,12 +1874,13 @@ fail_descr = rffi.cast(lltype.Signed, fail_descr) positions = [0] * len(guardtok.fail_locs) for i, loc in enumerate(guardtok.fail_locs): -if loc is None or loc is ebp: # frame +if loc is None: positions[i] = -1 elif isinstance(loc, StackLoc): positions[i] = loc.value else: assert isinstance(loc, RegLoc) +assert loc is not ebp # for now if loc.is_xmm: v = len(gpr_reg_mgr_cls.all_regs) + loc.value else: @@ -2485,6 +2486,11 @@ self.mc.overwrite(jmp_adr-1, chr(offset)) self.mc.MOV(heap(nursery_free_adr), edi) +def force_token(self, reg): +base_ofs = self.cpu.get_baseofs_of_frame_field() +assert isinstance(reg, RegLoc) +self.mc.LEA_rb(reg.value, -base_ofs) + genop_discard_list = [Assembler386.not_implemented_op_discard] * rop._LAST genop_list = [Assembler386.not_implemented_op] * rop._LAST genop_llong_list = {} 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 @@ -289,17 +289,17 @@ self.rm._check_invariants() self.xrm._check_invariants() -def Perform(self, op, arglocs, result_loc): +def perform(self, op, arglocs, result_loc): if not we_are_translated(): self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs)) self.assembler.regalloc_perform(op, arglocs, result_loc) -def PerformLLong(self, op, arglocs, result_loc): +def perform_llong(self, op, arglocs, result_loc): if not we_are_translated(): self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs)) self.assembler.regalloc_perform_llong(op, arglocs, result_loc) -def PerformMath(self, op, arglocs, result_loc): +def perform_math(self, op, arglocs, result_loc): if not we_are_translated(): self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs)) self.assembler.regalloc_perform_math(op, arglocs, result_loc) @@ -329,7 +329,7 @@ self.fm.get_frame_depth()) self.possibly_free_vars(guard_op.getfailargs()) -def PerformDiscard(self, op, arglocs): +def perform_discard(self, op, arglocs): if not we_are_translated(): self.assembler.dump('%s(%s)' % (op, arglocs)) self.assembler.regalloc_perform_discard(op, arglocs) @@ -427,7 +427,7 @@ locs = [loc, imm(fail_descr)] else: locs = [imm(fail_descr)] -self.Perform(op, locs, None) +self.perform(op, locs, None) def consider_guard_no_exception(self, op): self.perform_guard(op, [], None) @@ -480,12 +480,12 @@ def _consider_binop(self, op): loc, argloc = self._consider_binop_part(op) -self.Perform(op, [loc, argloc], loc) +self.perform(op, [loc, argloc], loc) def _consider_lea(self, op, loc): argloc = self.loc(op.getarg(1)) resloc = self.force_allocate_reg(op.result) -self.Perform(op, [loc, argloc], resloc) +self.perform(op, [loc, argloc], resloc) def consider_int_add(self, op): loc = self.loc(op.getarg(0)) @@ -520,7 +520,7 @@ def consider_int_neg(self, op): res = self.rm.force_result_in_reg(op.result, op.getarg(0)) -self.Perform(op, [res], res) +self.perform(op, [res], res) consider_int_invert = consider_int_neg @@ -531,7 +531,7 @@ loc2 = self.rm.make_sure_var_in_reg(op.getarg(1), selected_reg=ecx) args = op.getarglist() loc1 = self.rm.force_result_in_reg(op.result, op.getarg(0), args) -self.Perform(op, [loc1, loc2], loc1) +self.perform(op, [loc1, loc2], loc1) consider_int_rshift = consider_int_lshift consider_uint_rshift = consider_int_lshift @@ -551,11 +551,11 @@ def consider_int_mod(self, op): self._consider_int_div_or_mod(op, edx, eax) -self.Perform(op, [eax, ecx], edx) +self.perform(op, [eax, ecx], edx) def consider_int_floordiv(self, op): self._consider_int_div_or_mod(op, eax, edx) -self.Perform(op, [eax, ecx], eax) +self.perform(op, [eax, ecx], eax) consider_uint_floordiv = consider_int_floo
[pypy-commit] pypy jitframe-on-heap: fix
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60520:0c439825d278 Date: 2013-01-27 14:35 +0200 http://bitbucket.org/pypy/pypy/changeset/0c439825d278/ Log:fix diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -153,9 +153,7 @@ cast_ptr_to_int = staticmethod(cast_ptr_to_int) def force(self, addr_of_force_token): -descr = self.signedarraydescr -ofs = self.unpack_arraydescr(descr) -frame = rffi.cast(jitframe.JITFRAMEPTR, addr_of_force_token - ofs) +frame = rffi.cast(jitframe.JITFRAMEPTR, addr_of_force_token) frame.jf_descr = frame.jf_force_descr return lltype.cast_opaque_ptr(llmemory.GCREF, frame) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: Change the vable_token and virtual_token fields to be GC references
Author: Armin Rigo Branch: jitframe-on-heap Changeset: r60521:13a7d58be534 Date: 2013-01-27 14:09 +0100 http://bitbucket.org/pypy/pypy/changeset/13a7d58be534/ Log:Change the vable_token and virtual_token fields to be GC references to the live frame. 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 @@ -582,7 +582,7 @@ class LLFrame(object): -_TYPE = lltype.Signed +_TYPE = llmemory.GCREF forced_deadframe = None overflow_flag = False @@ -595,6 +595,22 @@ for box, arg in zip(argboxes, args): self.setenv(box, arg) +def __eq__(self, other): +# this is here to avoid crashes in 'token == TOKEN_TRACING_RESCALL' +from rpython.jit.metainterp.virtualizable import TOKEN_NONE +from rpython.jit.metainterp.virtualizable import TOKEN_TRACING_RESCALL +if isinstance(other, LLFrame): +return self is other +if other == TOKEN_NONE or other == TOKEN_TRACING_RESCALL: +return False +assert 0 + +def __ne__(self, other): +return not (self == other) + +def _identityhash(self): +return hash(self) + def setenv(self, box, arg): if box.type == INT: # typecheck the result @@ -863,7 +879,8 @@ def reset_vable(jd, vable): if jd.index_of_virtualizable != -1: fielddescr = jd.vable_token_descr -self.cpu.bh_setfield_gc(vable, 0, fielddescr) +NULL = lltype.nullptr(llmemory.GCREF.TO) +self.cpu.bh_setfield_gc(vable, NULL, fielddescr) faildescr = self.cpu.get_latest_descr(pframe) if faildescr == self.cpu.done_with_this_frame_descr_int: reset_vable(jd, vable) 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 @@ -2220,7 +2220,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -2228,7 +2228,7 @@ cpu = self.cpu i0 = BoxInt() i1 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -2265,7 +2265,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -2274,7 +2274,7 @@ i0 = BoxInt() i1 = BoxInt() i2 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -2313,7 +2313,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, @@ -2322,7 +2322,7 @@ i0 = BoxInt() i1 = BoxInt() f2 = BoxFloat() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -3697,7 +3697,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -3705,7 +3705,7 @@ i0 = BoxInt() i1 = BoxInt() i2 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(23) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), diff --git a/rpython/jit/metainterp/o
[pypy-commit] pypy kill-flowobjspace: move build_flow() out of FlowObjSpace
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60523:ec3af57266f4 Date: 2013-01-27 01:56 + http://bitbucket.org/pypy/pypy/changeset/ec3af57266f4/ Log:move build_flow() out of FlowObjSpace diff --git a/rpython/annotator/test/test_annrpython.py b/rpython/annotator/test/test_annrpython.py --- a/rpython/annotator/test/test_annrpython.py +++ b/rpython/annotator/test/test_annrpython.py @@ -13,7 +13,7 @@ from rpython.rlib.rarithmetic import r_uint, base_int, r_longlong, r_ulonglong from rpython.rlib.rarithmetic import r_singlefloat from rpython.rlib import objectmodel -from rpython.flowspace.objspace import FlowObjSpace, FlowingError +from rpython.flowspace.objspace import build_flow, FlowingError from rpython.translator.test import snippet @@ -40,9 +40,6 @@ class TestAnnotateTestCase: -def setup_class(cls): -cls.space = FlowObjSpace() - def teardown_method(self, meth): assert annmodel.s_Bool == annmodel.SomeBool() @@ -60,7 +57,7 @@ except AttributeError: pass name = func.func_name -funcgraph = self.space.build_flow(func) +funcgraph = build_flow(func) funcgraph.source = inspect.getsource(func) return funcgraph @@ -775,7 +772,7 @@ assert isinstance(s, annmodel.SomePBC) assert s.const == myobj -def test_cleanup_protocol(self): +def test_cleanup_protocol(self): class Stuff: def __init__(self): self.called = False @@ -2068,7 +2065,7 @@ s = a.build_types(f, [annmodel.SomeString(no_nul=True)]) assert isinstance(s, annmodel.SomeString) assert s.no_nul - + def test_non_none_and_none_with_isinstance(self): class A(object): @@ -3707,7 +3704,7 @@ def test_join_none_and_nonnull(self): from rpython.rlib.rstring import assert_str0 - + def f(i): a = str(i) a = assert_str0(a) @@ -3751,7 +3748,7 @@ class A(object): def __iter__(self): return self - + def fn(): return iter(A()) @@ -3810,7 +3807,7 @@ return True x = X() - + def f(i): if i: x1 = x diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py --- a/rpython/flowspace/objspace.py +++ b/rpython/flowspace/objspace.py @@ -84,6 +84,9 @@ # objects which should keep their SomeObjectness not_really_const = NOT_REALLY_CONST +def build_flow(self, func): +return build_flow(func, self) + def is_w(self, w_one, w_two): return self.is_true(self.is_(w_one, w_two)) @@ -262,28 +265,6 @@ w_type = w_instclass return FSException(w_type, w_value) -def build_flow(self, func): -""" -""" -_assert_rpythonic(func) -code = HostCode._from_code(func.func_code) -if (code.is_generator and -not hasattr(func, '_generator_next_method_of_')): -graph = PyGraph(func, code) -block = graph.startblock -for name, w_value in zip(code.co_varnames, block.framestate.mergeable): -if isinstance(w_value, Variable): -w_value.rename(name) -return bootstrap_generator(graph) -graph = PyGraph(func, code) -frame = self.frame = FlowSpaceFrame(self, graph, code) -frame.build_flow() -fixeggblocks(graph) -checkgraph(graph) -if code.is_generator: -tweak_generator_graph(graph) -return graph - def unpackiterable(self, w_iterable, expected_length=None): if not isinstance(w_iterable, Variable): l = list(self.unwrap(w_iterable)) @@ -555,6 +536,29 @@ setattr(FlowObjSpace, name, generic_operator) - for (name, symbol, arity, specialnames) in operation.MethodTable: make_op(name, arity) + + +def build_flow(func, space=FlowObjSpace()): +""" +Create the flow graph for the function. +""" +_assert_rpythonic(func) +code = HostCode._from_code(func.func_code) +if (code.is_generator and +not hasattr(func, '_generator_next_method_of_')): +graph = PyGraph(func, code) +block = graph.startblock +for name, w_value in zip(code.co_varnames, block.framestate.mergeable): +if isinstance(w_value, Variable): +w_value.rename(name) +return bootstrap_generator(graph) +graph = PyGraph(func, code) +frame = space.frame = FlowSpaceFrame(space, graph, code) +frame.build_flow() +fixeggblocks(graph) +checkgraph(graph) +if code.is_generator: +tweak_generator_graph(graph) +return graph diff --git a/rpython/flowspace/test/test_framestate.py b/rpython/flowspace/test/test_framestate.py --- a/rpython/flowspace/test/test_framestate.py +++ b/rpython/flowspace/test/test_fra
[pypy-commit] pypy kill-flowobjspace: Move do_operation* from FlowObjSpace to FSFrame
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60522:d45f1bd16894 Date: 2013-01-26 20:40 + http://bitbucket.org/pypy/pypy/changeset/d45f1bd16894/ Log:Move do_operation* from FlowObjSpace to FSFrame diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -9,11 +9,12 @@ from rpython.tool.stdlib_opcode import host_bytecode_spec from rpython.flowspace.argument import ArgumentsForTranslation from rpython.flowspace.model import (Constant, Variable, Block, Link, -UnwrapException, c_last_exception) +UnwrapException, c_last_exception, SpaceOperation) from rpython.flowspace.framestate import (FrameState, recursively_unflatten, recursively_flatten) from rpython.flowspace.specialcase import (rpython_print_item, rpython_print_newline) +from rpython.flowspace.operation import implicit_exceptions class FlowingError(Exception): """ Signals invalid RPython in the function being analysed""" @@ -471,6 +472,17 @@ def guessbool(self, w_condition, **kwds): return self.recorder.guessbool(self, w_condition, **kwds) +def do_operation(self, name, *args_w): +spaceop = SpaceOperation(name, args_w, Variable()) +spaceop.offset = self.last_instr +self.record(spaceop) +return spaceop.result + +def do_operation_with_implicit_exceptions(self, name, *args_w): +w_result = self.do_operation(name, *args_w) +self.handle_implicit_exceptions(implicit_exceptions.get(name)) +return w_result + def handle_implicit_exceptions(self, exceptions): """ Catch possible exceptions implicitly. @@ -740,7 +752,7 @@ def YIELD_VALUE(self, _, next_instr): assert self.pycode.is_generator w_result = self.popvalue() -self.space.do_operation('yield', w_result) +self.do_operation('yield', w_result) # XXX yield expressions not supported. This will blow up if the value # isn't popped straightaway. self.pushvalue(None) @@ -751,7 +763,7 @@ def PRINT_ITEM(self, oparg, next_instr): w_item = self.popvalue() -w_s = self.space.do_operation('str', w_item) +w_s = self.do_operation('str', w_item) self.space.appcall(rpython_print_item, w_s) def PRINT_NEWLINE(self, oparg, next_instr): diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py --- a/rpython/flowspace/objspace.py +++ b/rpython/flowspace/objspace.py @@ -9,7 +9,7 @@ from rpython.flowspace.argument import ArgumentsForTranslation from rpython.flowspace.model import (Constant, Variable, WrapException, -UnwrapException, checkgraph, SpaceOperation) +UnwrapException, checkgraph) from rpython.flowspace.bytecode import HostCode from rpython.flowspace import operation from rpython.flowspace.flowcontext import (FlowSpaceFrame, fixeggblocks, @@ -91,21 +91,21 @@ id = None # real version added by add_operations() def newdict(self, module="ignored"): -return self.do_operation('newdict') +return self.frame.do_operation('newdict') def newtuple(self, args_w): try: content = [self.unwrap(w_arg) for w_arg in args_w] except UnwrapException: -return self.do_operation('newtuple', *args_w) +return self.frame.do_operation('newtuple', *args_w) else: return Constant(tuple(content)) def newlist(self, args_w, sizehint=None): -return self.do_operation('newlist', *args_w) +return self.frame.do_operation('newlist', *args_w) def newslice(self, w_start, w_stop, w_step): -return self.do_operation('newslice', w_start, w_stop, w_step) +return self.frame.do_operation('newslice', w_start, w_stop, w_step) def newbool(self, b): if b: @@ -299,22 +299,10 @@ if not self.is_true(w_correct): e = self.exc_from_raise(self.w_ValueError, self.w_None) raise e -return [self.do_operation('getitem', w_iterable, self.wrap(i)) +return [self.frame.do_operation('getitem', w_iterable, self.wrap(i)) for i in range(expected_length)] # -def do_operation(self, name, *args_w): -spaceop = SpaceOperation(name, args_w, Variable()) -spaceop.offset = self.frame.last_instr -self.frame.record(spaceop) -return spaceop.result - -def do_operation_with_implicit_exceptions(self, name, *args_w): -w_result = self.do_operation(name, *args_w) -self.frame.handle_implicit_exceptions( -operation.implicit_exceptions.get(name)) -return w_result - def not_(self, w_obj): return self.wrap(not self.is_true(w_obj)) @@ -325,7 +313,7 @@ pass else:
[pypy-commit] pypy kill-flowobjspace: raise FlowingError on **-unpacking
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60525:352b1a959932 Date: 2013-01-27 16:40 + http://bitbucket.org/pypy/pypy/changeset/352b1a959932/ Log:raise FlowingError on **-unpacking diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -971,6 +971,8 @@ self.pushvalue(last_val) def call_function(self, oparg, w_star=None, w_starstar=None): +if w_starstar is not None: +raise FlowingError(self, "Dict-unpacking is not RPython") n_arguments = oparg & 0xff n_keywords = (oparg>>8) & 0xff if n_keywords: diff --git a/rpython/flowspace/test/test_objspace.py b/rpython/flowspace/test/test_objspace.py --- a/rpython/flowspace/test/test_objspace.py +++ b/rpython/flowspace/test/test_objspace.py @@ -699,6 +699,23 @@ for op in block.operations: assert not op.opname == "call_args" +def test_starstar_call(self): +"""Check that CALL_FUNCTION_KW and CALL_FUNCTION_VAR_KW raise a +useful error. +""" +def g(a, b, c): +return a*b*c +def f1(): +return g(**{'a':0}) +with py.test.raises(FlowingError) as excinfo: +graph = self.codetest(f1) +assert 'Dict-unpacking' in str(excinfo.value) +def f2(): +return g(*(0,), **{'c':3}) +with py.test.raises(FlowingError) as excinfo: +graph = self.codetest(f2) +assert 'Dict-unpackinga' in str(excinfo.value) + def test_catch_importerror_1(self): def f(): try: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: flowspace: Use (for now trivial) specialisation CallSpec of ArgumentsForTranslation
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60524:95a4332784d5 Date: 2013-01-27 16:24 + http://bitbucket.org/pypy/pypy/changeset/95a4332784d5/ Log:flowspace: Use (for now trivial) specialisation CallSpec of ArgumentsForTranslation diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -374,6 +374,11 @@ return args._rawshape(nextra) +class CallSpec(ArgumentsForTranslation): +"""Represents the arguments passed into a function call, i.e. the +`a, b, *c, **d` part in `return func(a, b, *c, **d)`. +""" + # # ArgErr family of exceptions raised in case of argument mismatch. # We try to give error messages following CPython's, which are very informative. diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py --- a/rpython/flowspace/bytecode.py +++ b/rpython/flowspace/bytecode.py @@ -36,7 +36,6 @@ code, consts, names, varnames, filename, name, firstlineno, lnotab, freevars): """Initialize a new code object""" -self.co_name = name assert nlocals >= 0 self.co_argcount = argcount self.co_nlocals = nlocals diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -7,7 +7,7 @@ from rpython.tool.error import source_lines from rpython.tool.stdlib_opcode import host_bytecode_spec -from rpython.flowspace.argument import ArgumentsForTranslation +from rpython.flowspace.argument import CallSpec from rpython.flowspace.model import (Constant, Variable, Block, Link, UnwrapException, c_last_exception, SpaceOperation) from rpython.flowspace.framestate import (FrameState, recursively_unflatten, @@ -989,7 +989,7 @@ keywords = None keywords_w = None arguments = self.popvalues(n_arguments) -args = ArgumentsForTranslation(self.space, arguments, keywords, +args = CallSpec(self.space, arguments, keywords, keywords_w, w_star, w_starstar) w_function = self.popvalue() w_result = self.space.call_args(w_function, args) diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py --- a/rpython/flowspace/objspace.py +++ b/rpython/flowspace/objspace.py @@ -7,7 +7,7 @@ import types from inspect import CO_NEWLOCALS -from rpython.flowspace.argument import ArgumentsForTranslation +from rpython.flowspace.argument import CallSpec from rpython.flowspace.model import (Constant, Variable, WrapException, UnwrapException, checkgraph) from rpython.flowspace.bytecode import HostCode @@ -396,7 +396,7 @@ return self.call_function(w_meth, *arg_w) def call_function(self, w_func, *args_w): -args = ArgumentsForTranslation(self, list(args_w)) +args = CallSpec(self, list(args_w)) return self.call_args(w_func, args) def appcall(self, func, *args_w): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: Kill unused argument CallSpec.w_starstararg
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60526:ab253504ce34 Date: 2013-01-27 16:58 + http://bitbucket.org/pypy/pypy/changeset/ab253504ce34/ Log:Kill unused argument CallSpec.w_starstararg diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -378,6 +378,45 @@ """Represents the arguments passed into a function call, i.e. the `a, b, *c, **d` part in `return func(a, b, *c, **d)`. """ +def __init__(self, space, args_w, keywords=None, keywords_w=None, + w_stararg=None, w_starstararg=None): +self.w_stararg = w_stararg +assert w_starstararg is None, "No **-unpacking in RPython" +self.combine_has_happened = False +self.space = space +assert isinstance(args_w, list) +self.arguments_w = args_w +self.keywords = keywords +self.keywords_w = keywords_w +self.keyword_names_w = None + +def copy(self): +return CallSpec(self.space, self.arguments_w, +self.keywords, self.keywords_w, self.w_stararg) + +def combine_if_necessary(self): +if self.combine_has_happened: +return +self._combine_wrapped(self.w_stararg) +self.combine_has_happened = True + +def _combine_wrapped(self, w_stararg): +"unpack the *arg and **kwd into arguments_w and keywords_w" +if w_stararg is not None: +self._combine_starargs_wrapped(w_stararg) + +def _rawshape(self, nextra=0): +assert not self.combine_has_happened +shape_cnt = len(self.arguments_w)+nextra# Number of positional args +if self.keywords: +shape_keys = self.keywords[:]# List of keywords (strings) +shape_keys.sort() +else: +shape_keys = [] +shape_star = self.w_stararg is not None # Flag: presence of *arg +shape_stst = False # Flag: presence of **kwds +return shape_cnt, tuple(shape_keys), shape_star, shape_stst # shape_keys are sorted + # # ArgErr family of exceptions raised in case of argument mismatch. diff --git a/rpython/flowspace/test/test_objspace.py b/rpython/flowspace/test/test_objspace.py --- a/rpython/flowspace/test/test_objspace.py +++ b/rpython/flowspace/test/test_objspace.py @@ -714,7 +714,7 @@ return g(*(0,), **{'c':3}) with py.test.raises(FlowingError) as excinfo: graph = self.codetest(f2) -assert 'Dict-unpackinga' in str(excinfo.value) +assert 'Dict-unpacking' in str(excinfo.value) def test_catch_importerror_1(self): def f(): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Help with unicode issues
Author: Maciej Fijalkowski Branch: Changeset: r60527:53723bf32fd5 Date: 2013-01-27 20:02 +0200 http://bitbucket.org/pypy/pypy/changeset/53723bf32fd5/ Log:Help with unicode issues diff --git a/pypy/module/unicodedata/interp_ucd.py b/pypy/module/unicodedata/interp_ucd.py --- a/pypy/module/unicodedata/interp_ucd.py +++ b/pypy/module/unicodedata/interp_ucd.py @@ -9,7 +9,7 @@ from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.runicode import MAXUNICODE from rpython.rlib.unicodedata import unicodedb_5_2_0, unicodedb_3_2_0 -from rpython.rlib.runicode import code_to_unichr, ORD +from rpython.rlib.runicode import code_to_unichr, ord_accepts_surrogate import sys @@ -28,8 +28,6 @@ # handling: on narrow unicode builds, a surrogate pair is considered as one # unicode code point. -# The functions below are subtly different from the ones in runicode.py. -# When PyPy implements Python 3 they should be merged. if MAXUNICODE > 0x: # Target is wide build @@ -41,7 +39,7 @@ if not we_are_translated() and sys.maxunicode == 0x: # Host CPython is narrow build, accept surrogates try: -return ORD(space.unicode_w(w_unichr)) +return ord_accepts_surrogate(space.unicode_w(w_unichr)) except ValueError: raise OperationError(space.w_TypeError, space.wrap( 'need a single Unicode character as parameter')) @@ -68,7 +66,7 @@ else: # Accept surrogates try: -return ORD(space.unicode_w(w_unichr)) +return ord_accepts_surrogate(space.unicode_w(w_unichr)) except ValueError: raise OperationError(space.w_TypeError, space.wrap( 'need a single Unicode character as parameter')) diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -13,6 +13,26 @@ BYTEORDER = sys.byteorder +# python 2.7 has a preview of py3k behavior, so those functions +# are used either when we're testing wide pypy on narrow cpython +# or in unicodedata in pypy + +def unichr_returns_surrogate(c): +if c <= sys.maxunicode or c > MAXUNICODE: +return unichr(c) +else: +c -= 0x1 +return (unichr(0xD800 + (c >> 10)) + +unichr(0xDC00 + (c & 0x03FF))) + +def ord_accepts_surrogate(u): +if isinstance(u, unicode) and len(u) == 2: +ch1 = ord(u[0]) +ch2 = ord(u[1]) +if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: +return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 +return ord(u) + if MAXUNICODE > sys.maxunicode: # A version of unichr which allows codes outside the BMP # even on narrow unicode builds. @@ -21,12 +41,7 @@ # Note that Python3 uses a similar implementation. def UNICHR(c): assert not we_are_translated() -if c <= sys.maxunicode or c > MAXUNICODE: -return unichr(c) -else: -c -= 0x1 -return (unichr(0xD800 + (c >> 10)) + -unichr(0xDC00 + (c & 0x03FF))) +return unichr_returns_surrogate(c) UNICHR._flowspace_rewrite_directly_as_ = unichr # ^^^ NB.: for translation, it's essential to use this hack instead # of calling unichr() from UNICHR(), because unichr() detects if there @@ -34,12 +49,7 @@ def ORD(u): assert not we_are_translated() -if isinstance(u, unicode) and len(u) == 2: -ch1 = ord(u[0]) -ch2 = ord(u[1]) -if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: -return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 -return ord(u) +return ord_accepts_surrogate(u) ORD._flowspace_rewrite_directly_as_ = ord else: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: one more "try to bring it to the previous state" thanks armin
Author: Maciej Fijalkowski Branch: Changeset: r60529:05c1d0284431 Date: 2013-01-27 20:07 +0200 http://bitbucket.org/pypy/pypy/changeset/05c1d0284431/ Log:one more "try to bring it to the previous state" thanks armin diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -60,13 +60,13 @@ def code_to_unichr(code): if not we_are_translated() and sys.maxunicode == 0x: # Host CPython is narrow build, generate surrogates -return UNICHR(code) +return unichr_returns_surrogate(code) else: return unichr(code) else: def code_to_unichr(code): # generate surrogates for large codes -return UNICHR(code) +return unichr_returns_surrogate(code) def _STORECHAR(result, CH, byteorder): hi = chr(((CH) >> 8) & 0xff) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy win32-fixes: see if this fixes win32 translation
Author: Brian Kearns Branch: win32-fixes Changeset: r60530:3865dce660fd Date: 2013-01-27 13:28 -0500 http://bitbucket.org/pypy/pypy/changeset/3865dce660fd/ Log:see if this fixes win32 translation diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -344,7 +344,7 @@ ]) CConfig.WSAPROTOCOL_INFO = platform.Struct( -'struct WSAPROTOCOL_INFO', +'struct _WSAPROTOCOL_INFO', []) # Struct is just passed between functions CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger( 'FROM_PROTOCOL_INFO') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy win32-fixes: ok, another try
Author: Brian Kearns Branch: win32-fixes Changeset: r60531:1929c19109d0 Date: 2013-01-27 13:32 -0500 http://bitbucket.org/pypy/pypy/changeset/1929c19109d0/ Log:ok, another try diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -344,7 +344,7 @@ ]) CConfig.WSAPROTOCOL_INFO = platform.Struct( -'struct _WSAPROTOCOL_INFO', +'WSAPROTOCOL_INFO', []) # Struct is just passed between functions CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger( 'FROM_PROTOCOL_INFO') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy win32-fixes: more fixes
Author: Brian Kearns Branch: win32-fixes Changeset: r60532:a0aa9cfc1a17 Date: 2013-01-27 13:35 -0500 http://bitbucket.org/pypy/pypy/changeset/a0aa9cfc1a17/ Log:more fixes diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -617,7 +617,7 @@ WSASocket = external('WSASocket', [rffi.INT, rffi.INT, rffi.INT, lltype.Ptr(WSAPROTOCOL_INFO), - rffi.DWORD, rffi.DWORD], + rwin32.DWORD, rwin32.DWORD], socketfd_type) if WIN32: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: merge win32-fixes for rsocket
Author: Brian Kearns Branch: Changeset: r60533:e6f15c5f03b0 Date: 2013-01-27 13:52 -0500 http://bitbucket.org/pypy/pypy/changeset/e6f15c5f03b0/ Log:merge win32-fixes for rsocket diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -344,7 +344,7 @@ ]) CConfig.WSAPROTOCOL_INFO = platform.Struct( -'struct WSAPROTOCOL_INFO', +'WSAPROTOCOL_INFO', []) # Struct is just passed between functions CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger( 'FROM_PROTOCOL_INFO') @@ -617,7 +617,7 @@ WSASocket = external('WSASocket', [rffi.INT, rffi.INT, rffi.INT, lltype.Ptr(WSAPROTOCOL_INFO), - rffi.DWORD, rffi.DWORD], + rwin32.DWORD, rwin32.DWORD], socketfd_type) if WIN32: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix rpython
Author: Maciej Fijalkowski Branch: Changeset: r60534:b30e913b44ff Date: 2013-01-27 20:53 +0200 http://bitbucket.org/pypy/pypy/changeset/b30e913b44ff/ Log:fix rpython diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -31,7 +31,8 @@ ch2 = ord(u[1]) if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 -return ord(u) +assert len(u) == 1 +return ord(u[0]) if MAXUNICODE > sys.maxunicode: # A version of unichr which allows codes outside the BMP ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: merge
Author: Maciej Fijalkowski Branch: Changeset: r60535:d701c9bcb992 Date: 2013-01-27 20:54 +0200 http://bitbucket.org/pypy/pypy/changeset/d701c9bcb992/ Log:merge diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -344,7 +344,7 @@ ]) CConfig.WSAPROTOCOL_INFO = platform.Struct( -'struct WSAPROTOCOL_INFO', +'WSAPROTOCOL_INFO', []) # Struct is just passed between functions CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger( 'FROM_PROTOCOL_INFO') @@ -617,7 +617,7 @@ WSASocket = external('WSASocket', [rffi.INT, rffi.INT, rffi.INT, lltype.Ptr(WSAPROTOCOL_INFO), - rffi.DWORD, rffi.DWORD], + rwin32.DWORD, rwin32.DWORD], socketfd_type) if WIN32: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix whatsnew for merged branches
Author: Brian Kearns Branch: Changeset: r60536:60c48ee502e1 Date: 2013-01-27 13:58 -0500 http://bitbucket.org/pypy/pypy/changeset/60c48ee502e1/ Log:fix whatsnew for merged branches diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -34,6 +34,8 @@ .. branch: kill-faking .. branch: improved_ebnfparse_error .. branch: task-decorator +.. branch: fix-e4fa0b2 +.. branch: win32-fixes .. branch: release-2.0-beta1 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: merge
Author: Brian Kearns Branch: Changeset: r60537:ce89f6bbee1e Date: 2013-01-27 13:58 -0500 http://bitbucket.org/pypy/pypy/changeset/ce89f6bbee1e/ Log:merge diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -31,7 +31,8 @@ ch2 = ord(u[1]) if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 -return ord(u) +assert len(u) == 1 +return ord(u[0]) if MAXUNICODE > sys.maxunicode: # A version of unichr which allows codes outside the BMP ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: implement malloc_cond_varsize_small for the JIT, not used so far
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60539:537d5ac910a9 Date: 2013-01-27 21:45 +0200 http://bitbucket.org/pypy/pypy/changeset/537d5ac910a9/ Log:implement malloc_cond_varsize_small for the JIT, not used so far 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 @@ -2486,6 +2486,22 @@ self.mc.overwrite(jmp_adr-1, chr(offset)) self.mc.MOV(heap(nursery_free_adr), edi) +def malloc_cond_varsize_small(self, nursery_free_adr, nursery_top_adr, + sizeloc, gcmap): +self.mc.MOV(edi, heap(nursery_free_adr)) +self.mc.MOV(eax, edi) +self.mc.ADD(edi, sizeloc) +self.mc.CMP(edi, heap(nursery_top_adr)) +self.mc.J_il8(rx86.Conditions['NA'], 0) # patched later +jmp_adr = self.mc.get_relative_pos() +# save the gcmap +self.push_gcmap(self.mc, gcmap, mov=True) +self.mc.CALL(imm(self.malloc_slowpath)) +offset = self.mc.get_relative_pos() - jmp_adr +assert 0 < offset <= 127 +self.mc.overwrite(jmp_adr-1, chr(offset)) +self.mc.MOV(heap(nursery_free_adr), edi) + def force_token(self, reg): base_ofs = self.cpu.get_baseofs_of_frame_field() assert isinstance(reg, RegLoc) 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 @@ -4,7 +4,7 @@ import os from rpython.jit.metainterp.history import (Box, Const, ConstInt, ConstPtr, -BoxPtr, ConstFloat, +BoxPtr, ConstFloat, BoxInt, BoxFloat, INT, REF, FLOAT, TargetToken, JitCellToken) from rpython.jit.backend.x86.regloc import * @@ -874,6 +874,26 @@ gc_ll_descr.get_nursery_top_addr(), size, gcmap) +def consider_call_malloc_nursery_varsize_small(self, op): +size_box = op.getarg(0) +assert isinstance(size_box, BoxInt) # we cannot have a const here! +# looking at the result +self.rm.force_allocate_reg(op.result, selected_reg=eax) +# +# We need edx as a temporary, but otherwise don't save any more +# register. See comments in _build_malloc_slowpath(). +tmp_box = TempBox() +self.rm.force_allocate_reg(tmp_box, selected_reg=edi) +sizeloc = self.rm.make_sure_var_in_reg(size_box, [op.result, tmp_box]) +gcmap = self.get_gcmap([eax, edi]) # allocate the gcmap *before* +self.rm.possibly_free_var(tmp_box) +# +gc_ll_descr = self.assembler.cpu.gc_ll_descr +self.assembler.malloc_cond_varsize_small( +gc_ll_descr.get_nursery_free_addr(), +gc_ll_descr.get_nursery_top_addr(), +sizeloc, gcmap) + def get_gcmap(self, forbidden_regs=[]): frame_depth = self.fm.get_frame_depth() size = frame_depth + JITFRAME_FIXED_SIZE diff --git a/rpython/jit/backend/x86/test/test_gc_integration.py b/rpython/jit/backend/x86/test/test_gc_integration.py --- a/rpython/jit/backend/x86/test/test_gc_integration.py +++ b/rpython/jit/backend/x86/test/test_gc_integration.py @@ -202,6 +202,29 @@ # slowpath never called assert gc_ll_descr.calls == [] +def test_malloc_nursery_varsize_small(self): +self.cpu = self.getcpu(None) +ops = ''' +[i0, i1, i2] +p0 = call_malloc_nursery_varsize_small(i0) +p1 = call_malloc_nursery_varsize_small(i1) +p2 = call_malloc_nursery_varsize_small(i2) +guard_true(i0) [p0, p1, p2] +''' +self.interpret(ops, [16, 32, 16]) +# check the returned pointers +gc_ll_descr = self.cpu.gc_ll_descr +nurs_adr = rffi.cast(lltype.Signed, gc_ll_descr.nursery) +ref = lambda n: self.cpu.get_ref_value(self.deadframe, n) +assert rffi.cast(lltype.Signed, ref(0)) == nurs_adr + 0 +assert rffi.cast(lltype.Signed, ref(1)) == nurs_adr + 16 +assert rffi.cast(lltype.Signed, ref(2)) == nurs_adr + 48 +# check the nursery content and state +gc_ll_descr.check_nothing_in_nursery() +assert gc_ll_descr.addrs[0] == nurs_adr + 64 +# slowpath never called +assert gc_ll_descr.calls == [] + def test_malloc_slowpath(self): def check(frame): assert len(frame.jf_gcmap) == 1 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 @@ -529,6 +529,10 @@ 'CALL_PURE/*d', # removed before it's passed to the backend 'CALL_MALLOC_GC/*d', # like CALL, but NULL
[pypy-commit] pypy jitframe-on-heap: fix the test
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60538:26beb40a6f7e Date: 2013-01-27 21:06 +0200 http://bitbucket.org/pypy/pypy/changeset/26beb40a6f7e/ Log:fix the test 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 @@ -2021,9 +2021,9 @@ ofs = self.cpu.get_ofs_of_frame_field('jf_descr') base_ofs = self.cpu.get_baseofs_of_frame_field() self.mov(fail_descr_loc, RawStackLoc(ofs)) -gcmap = self.gcmap_for_finish arglist = op.getarglist() if arglist and arglist[0].type == REF: +gcmap = self.gcmap_for_finish self.push_gcmap(self.mc, gcmap, store=True) else: # note that the 0 here is redundant, but I would rather diff --git a/rpython/jit/backend/x86/test/test_gc_integration.py b/rpython/jit/backend/x86/test/test_gc_integration.py --- a/rpython/jit/backend/x86/test/test_gc_integration.py +++ b/rpython/jit/backend/x86/test/test_gc_integration.py @@ -479,12 +479,11 @@ cpu.gc_ll_descr.init_nursery(100) cpu.setup_once() S = self.S -ofs = cpu.get_baseofs_of_frame_field() frames = [] def check(i): -assert cpu.gc_ll_descr.gcrootmap.stack[0] == i - ofs -frame = rffi.cast(JITFRAMEPTR, i - ofs) +assert cpu.gc_ll_descr.gcrootmap.stack[0] == i +frame = rffi.cast(JITFRAMEPTR, i) assert len(frame.jf_frame) == JITFRAME_FIXED_SIZE + 4 # we "collect" frames.append(frame) @@ -498,8 +497,8 @@ frames.append(new_frame) def check2(i): -assert cpu.gc_ll_descr.gcrootmap.stack[0] == i - ofs -frame = rffi.cast(JITFRAMEPTR, i - ofs) +assert cpu.gc_ll_descr.gcrootmap.stack[0] == i +frame = rffi.cast(JITFRAMEPTR, i) assert frame == frames[1] assert frame != frames[0] @@ -511,11 +510,12 @@ loop = self.parse(""" [p0, p1, p2] -i0 = force_token() # this is a bit below the frame -call(ConstClass(check_adr), i0, descr=checkdescr) # this can collect +pf = force_token() # this is a bit below the frame +call(ConstClass(check_adr), pf, descr=checkdescr) # this can collect p3 = getfield_gc(p0, descr=fielddescr) -call(ConstClass(check2_adr), i0, descr=checkdescr) -guard_true(i0, descr=faildescr) [p0, p1, p2, p3] +pf2 = force_token() +call(ConstClass(check2_adr), pf2, descr=checkdescr) +guard_nonnull(p3, descr=faildescr) [p0, p1, p2, p3] p4 = getfield_gc(p0, descr=fielddescr) finish(p4, descr=finaldescr) """, namespace={'finaldescr': BasicFinalDescr(), @@ -534,7 +534,7 @@ frame = lltype.cast_opaque_ptr(JITFRAMEPTR, frame) gcmap = unpack_gcmap(lltype.cast_opaque_ptr(JITFRAMEPTR, frame)) assert len(gcmap) == 1 -assert gcmap[0] < 29 +assert gcmap[0] < JITFRAME_FIXED_SIZE item = rffi.cast(lltype.Ptr(S), frame.jf_frame[gcmap[0]]) assert item == new_items[2] ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: merge
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60540:73a4b46a1381 Date: 2013-01-27 21:46 +0200 http://bitbucket.org/pypy/pypy/changeset/73a4b46a1381/ Log:merge 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 @@ -582,7 +582,7 @@ class LLFrame(object): -_TYPE = lltype.Signed +_TYPE = llmemory.GCREF forced_deadframe = None overflow_flag = False @@ -595,6 +595,22 @@ for box, arg in zip(argboxes, args): self.setenv(box, arg) +def __eq__(self, other): +# this is here to avoid crashes in 'token == TOKEN_TRACING_RESCALL' +from rpython.jit.metainterp.virtualizable import TOKEN_NONE +from rpython.jit.metainterp.virtualizable import TOKEN_TRACING_RESCALL +if isinstance(other, LLFrame): +return self is other +if other == TOKEN_NONE or other == TOKEN_TRACING_RESCALL: +return False +assert 0 + +def __ne__(self, other): +return not (self == other) + +def _identityhash(self): +return hash(self) + def setenv(self, box, arg): if box.type == INT: # typecheck the result @@ -863,7 +879,8 @@ def reset_vable(jd, vable): if jd.index_of_virtualizable != -1: fielddescr = jd.vable_token_descr -self.cpu.bh_setfield_gc(vable, 0, fielddescr) +NULL = lltype.nullptr(llmemory.GCREF.TO) +self.cpu.bh_setfield_gc(vable, NULL, fielddescr) faildescr = self.cpu.get_latest_descr(pframe) if faildescr == self.cpu.done_with_this_frame_descr_int: reset_vable(jd, vable) 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 @@ -2220,7 +2220,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -2228,7 +2228,7 @@ cpu = self.cpu i0 = BoxInt() i1 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -2265,7 +2265,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -2274,7 +2274,7 @@ i0 = BoxInt() i1 = BoxInt() i2 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -2313,7 +2313,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, @@ -2322,7 +2322,7 @@ i0 = BoxInt() i1 = BoxInt() f2 = BoxFloat() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(1) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), @@ -3697,7 +3697,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) funcbox = self.get_funcbox(self.cpu, func_ptr).constbox() calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, @@ -3705,7 +3705,7 @@ i0 = BoxInt() i1 = BoxInt() i2 = BoxInt() -tok = BoxInt() +tok = BoxPtr() faildescr = BasicFailDescr(23) ops = [ ResOperation(rop.FORCE_TOKEN, [], tok), diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/
[pypy-commit] pypy jitframe-on-heap: implement rewriting of frame malloc
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60541:cf0aed3ee46e Date: 2013-01-27 22:21 +0200 http://bitbucket.org/pypy/pypy/changeset/cf0aed3ee46e/ Log:implement rewriting of frame malloc diff --git a/rpython/jit/backend/llsupport/gc.py b/rpython/jit/backend/llsupport/gc.py --- a/rpython/jit/backend/llsupport/gc.py +++ b/rpython/jit/backend/llsupport/gc.py @@ -122,6 +122,8 @@ for name in ['jf_descr', 'jf_guard_exc', 'jf_force_descr', 'jf_frame_info', 'jf_gcmap']: setattr(descrs, name, cpu.fielddescrof(jitframe.JITFRAME, name)) +descrs.jfi_frame_size = cpu.fielddescrof(jitframe.JITFRAMEINFO, + 'jfi_frame_size') descrs.jfi_frame_depth = cpu.fielddescrof(jitframe.JITFRAMEINFO, 'jfi_frame_depth') return descrs diff --git a/rpython/jit/backend/llsupport/jitframe.py b/rpython/jit/backend/llsupport/jitframe.py --- a/rpython/jit/backend/llsupport/jitframe.py +++ b/rpython/jit/backend/llsupport/jitframe.py @@ -14,10 +14,19 @@ GCMAP = lltype.GcArray(lltype.Unsigned) NULLGCMAP = lltype.nullptr(GCMAP) +def jitframeinfo_set_depth(jfi, new_depth): +jfi.jfi_frame_depth = new_depth +jfi.jfi_frame_size = STATICSIZE + new_depth * SIZEOFSIGNED + JITFRAMEINFO = lltype.GcStruct( 'JITFRAMEINFO', -# the depth of frame +# the depth of the frame ('jfi_frame_depth', lltype.Signed), +# the total size of the frame, in bytes +('jfi_frame_size', lltype.Signed), +adtmeths = { +'set_frame_depth': jitframeinfo_set_depth, +}, ) NULLFRAMEINFO = lltype.nullptr(JITFRAMEINFO) 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 @@ -137,22 +137,42 @@ else: raise NotImplementedError(op.getopname()) +def gen_malloc_frame(self, frame_info, frame, size_box): +descrs = self.gc_ll_descr.getframedescrs(self.cpu) +if self.gc_ll_descr.kind == 'boehm': +op0 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)], + size_box, + descr=descrs.jfi_frame_depth) +self.newops.append(op0) +op1 = ResOperation(rop.NEW_ARRAY, [size_box], frame, + descr=descrs.arraydescr) +self.handle_new_array(descrs.arraydescr, op1) +else: +# we read size in bytes here, not the length +op0 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)], + size_box, + descr=descrs.jfi_frame_size) +self.newops.append(op0) +self.gen_malloc_nursery_varsize(size_box, frame, is_small=True) +self.gen_initialize_tid(frame, descrs.arraydescr.tid) +length_box = history.BoxInt() +op1 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(frame_info)], + length_box, + descr=descrs.jfi_frame_depth) +self.newops.append(op1) +self.gen_initialize_len(frame, length_box, +descrs.arraydescr.lendescr) + def handle_call_assembler(self, op): descrs = self.gc_ll_descr.getframedescrs(self.cpu) loop_token = op.getdescr() assert isinstance(loop_token, history.JitCellToken) -lgt_box = history.BoxInt() -frame = history.BoxPtr() jfi = loop_token.compiled_loop_token.frame_info llref = lltype.cast_opaque_ptr(llmemory.GCREF, jfi) rgc._make_sure_does_not_move(llref) -op0 = ResOperation(rop.GETFIELD_GC, [history.ConstPtr(llref)], lgt_box, - descr=descrs.jfi_frame_depth) -self.newops.append(op0) - -op1 = ResOperation(rop.NEW_ARRAY, [lgt_box], frame, - descr=descrs.arraydescr) -self.handle_new_array(descrs.arraydescr, op1) +size_box = history.BoxInt() +frame = history.BoxPtr() +self.gen_malloc_frame(llref, frame, size_box) op2 = ResOperation(rop.SETFIELD_GC, [frame, history.ConstPtr(llref)], None, descr=descrs.jf_frame_info) self.newops.append(op2) @@ -258,6 +278,18 @@ self._gen_call_malloc_gc([ConstInt(addr), v_num_elem], v_result, self.gc_ll_descr.malloc_unicode_descr) +def gen_malloc_nursery_varsize(self, sizebox, v_result, is_small=False): +""" Generate CALL_MALLOC_NURSERY_VARSIZE_SMALL +""" +assert is_small +self.emitting_an_operation_that_can_collect() +op = ResOperation(rop.CALL_MALLOC_NURSERY_VARSIZE_SMALL, + [sizebox], +
[pypy-commit] pypy jitframe-on-heap: an attempt to have a call assembler somewhere in zrpy_gc tests
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60542:f0fddff075fb Date: 2013-01-27 22:27 +0200 http://bitbucket.org/pypy/pypy/changeset/f0fddff075fb/ Log:an attempt to have a call assembler somewhere in zrpy_gc tests diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc.py b/rpython/jit/backend/x86/test/test_zrpy_gc.py --- a/rpython/jit/backend/x86/test/test_zrpy_gc.py +++ b/rpython/jit/backend/x86/test/test_zrpy_gc.py @@ -790,11 +790,25 @@ def test_compile_framework_minimal_size_in_nursery(self): self.run('compile_framework_minimal_size_in_nursery') -#def define_compile_framework_call_assembler(self): -#xxx +def define_compile_framework_call_assembler(self): +S = lltype.GcForwardReference() +S.become(lltype.GcStruct('S', ('s', lltype.Ptr(S +driver = JitDriver(greens = [], reds = ['x', 'x0', 'x2']) -#def test_compile_framework_call_assembler(self): -#self.run('compile_framework_call_assembler') +def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s0): +driver.jit_merge_point(x=x, x0=x0, x2=x2) +i = 0 +prev_s = lltype.nullptr(S) +while i < 100: +s = lltype.malloc(S) +s.s = prev_s +prev_s = s +return n - 1, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s0 + +return None, f, None + +def test_compile_framework_call_assembler(self): +self.run('compile_framework_call_assembler') class TestShadowStack(CompileFrameworkTests): gcrootfinder = "shadowstack" ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy win32-cleanup3: abandon, fixed differently
Author: Matti Picus Branch: win32-cleanup3 Changeset: r60543:2eb0f70e009a Date: 2013-01-27 22:18 +0200 http://bitbucket.org/pypy/pypy/changeset/2eb0f70e009a/ Log:abandon, fixed differently ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: infinite loops aren't cool
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60545:3196abf1af75 Date: 2013-01-27 22:34 +0200 http://bitbucket.org/pypy/pypy/changeset/3196abf1af75/ Log:infinite loops aren't cool diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc.py b/rpython/jit/backend/x86/test/test_zrpy_gc.py --- a/rpython/jit/backend/x86/test/test_zrpy_gc.py +++ b/rpython/jit/backend/x86/test/test_zrpy_gc.py @@ -803,6 +803,7 @@ s = lltype.malloc(S) s.s = prev_s prev_s = s +i += 1 return n - 1, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s0 return None, f, None ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fix-version-tool: make rpython/tool/version.py usable generically for any repository root
Author: Brian Kearns Branch: fix-version-tool Changeset: r60546:305ed2a35119 Date: 2013-01-27 11:27 -0500 http://bitbucket.org/pypy/pypy/changeset/305ed2a35119/ Log:make rpython/tool/version.py usable generically for any repository root diff --git a/rpython/tool/test/test_version.py b/rpython/tool/test/test_version.py --- a/rpython/tool/test/test_version.py +++ b/rpython/tool/test/test_version.py @@ -11,11 +11,11 @@ assert version_for('release', tag='release-123', node='000', - ) == ('RPython', 'release-123', '000') + ) == ('release-123', '000') assert version_for('somebranch', node='000', branch='something', - ) == ('RPython', 'something', '000') + ) == ('something', '000') def test_get_repo_version_info(): diff --git a/rpython/tool/version.py b/rpython/tool/version.py --- a/rpython/tool/version.py +++ b/rpython/tool/version.py @@ -4,7 +4,7 @@ import rpython rpythondir = os.path.dirname(os.path.abspath(rpython.__file__)) rpythonroot = os.path.dirname(rpythondir) -default_retval = 'RPython', '?', '?' +default_retval = '?', '?' def maywarn(err, repo_type='Mercurial'): if not err: @@ -15,31 +15,36 @@ py.log.setconsumer("version", ansi_log) log.WARNING('Errors getting %s information: %s' % (repo_type, err)) -def get_repo_version_info(hgexe=None): +def get_repo_version_info(hgexe=None, root=rpythonroot): '''Obtain version information by invoking the 'hg' or 'git' commands.''' +if root == rpythonroot: +project = ("RPython",) +else: +project = ('?',) + # Try to see if we can get info from Git if hgexe is not specified. if not hgexe: -if os.path.isdir(os.path.join(rpythonroot, '.git')): -return _get_git_version() +if os.path.isdir(os.path.join(root, '.git')): +return project + _get_git_version(root) # Fallback to trying Mercurial. if hgexe is None: hgexe = py.path.local.sysfind('hg') -if os.path.isfile(os.path.join(rpythonroot, '.hg_archival.txt')): -return _get_hg_archive_version(os.path.join(rpythonroot, '.hg_archival.txt')) -elif not os.path.isdir(os.path.join(rpythonroot, '.hg')): +if os.path.isfile(os.path.join(root, '.hg_archival.txt')): +return project + _get_hg_archive_version(os.path.join(root, '.hg_archival.txt')) +elif not os.path.isdir(os.path.join(root, '.hg')): maywarn('Not running from a Mercurial repository!') -return default_retval +return project + default_retval elif not hgexe: maywarn('Cannot find Mercurial command!') -return default_retval +return project + default_retval else: -return _get_hg_version(hgexe) +return project + _get_hg_version(hgexe, root) -def _get_hg_version(hgexe): +def _get_hg_version(hgexe, root): env = dict(os.environ) # get Mercurial into scripting mode env['HGPLAIN'] = '1' @@ -57,14 +62,14 @@ maywarn('command does not identify itself as Mercurial') return default_retval -p = Popen([str(hgexe), 'id', '-i', rpythonroot], +p = Popen([str(hgexe), 'id', '-i', root], stdout=PIPE, stderr=PIPE, env=env) hgid = p.stdout.read().strip() maywarn(p.stderr.read()) if p.wait() != 0: hgid = '?' -p = Popen([str(hgexe), 'id', '-t', rpythonroot], +p = Popen([str(hgexe), 'id', '-t', root], stdout=PIPE, stderr=PIPE, env=env) hgtags = [t for t in p.stdout.read().strip().split() if t != 'tip'] maywarn(p.stderr.read()) @@ -72,15 +77,15 @@ hgtags = ['?'] if hgtags: -return 'RPython', hgtags[0], hgid +return hgtags[0], hgid else: # use the branch instead -p = Popen([str(hgexe), 'id', '-b', rpythonroot], +p = Popen([str(hgexe), 'id', '-b', root], stdout=PIPE, stderr=PIPE, env=env) hgbranch = p.stdout.read().strip() maywarn(p.stderr.read()) -return 'RPython', hgbranch, hgid +return hgbranch, hgid def _get_hg_archive_version(path): @@ -90,12 +95,12 @@ finally: fp.close() if 'tag' in data: -return 'RPython', data['tag'], data['node'] +return data['tag'], data['node'] else: -return 'RPython', data['branch'], data['node'] +return data['branch'], data['node'] -def _get_git_version(): +def _get_git_version(root): #XXX: this function is a untested hack, # so the git mirror tav made will work gitexe = py.path.local.sysfind('git') @@ -105,7 +110,7 @@ try: p = Popen( [str(gitexe), 'rev-parse', 'HEAD'], -stdout=PIPE, stderr=PIPE, cwd=rpythonroot +stdout=PIPE, stderr=PIPE, cwd=root ) ex
[pypy-commit] pypy fix-version-tool: have pypy get_repo_version_info on its own root (for the later split)
Author: Brian Kearns Branch: fix-version-tool Changeset: r60547:dea6b7a85a2a Date: 2013-01-27 11:28 -0500 http://bitbucket.org/pypy/pypy/changeset/dea6b7a85a2a/ Log:have pypy get_repo_version_info on its own root (for the later split) diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -28,6 +28,7 @@ import pypy pypydir = os.path.dirname(os.path.abspath(pypy.__file__)) +pypyroot = os.path.dirname(os.path.dirname(os.path.abspath(pypy.__file__))) del pypy from rpython.tool.version import get_repo_version_info @@ -68,7 +69,7 @@ CPYTHON_VERSION[0], CPYTHON_VERSION[1], CPYTHON_VERSION[2], -get_repo_version_info()[2], +get_repo_version_info(root=pypyroot)[2], date, time, ver, @@ -91,10 +92,10 @@ return space.wrap(('PyPy', '', '')) def get_repo_info(space): -info = get_repo_version_info() +info = get_repo_version_info(root=pypyroot) if info: project, repo_tag, repo_version = info -return space.newtuple([space.wrap(project), +return space.newtuple([space.wrap('PyPy'), space.wrap(repo_tag), space.wrap(repo_version)]) else: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fix-version-tool: oops, this was the intent
Author: Brian Kearns Branch: fix-version-tool Changeset: r60548:ae5db54ff288 Date: 2013-01-27 11:44 -0500 http://bitbucket.org/pypy/pypy/changeset/ae5db54ff288/ Log:oops, this was the intent diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -28,7 +28,7 @@ import pypy pypydir = os.path.dirname(os.path.abspath(pypy.__file__)) -pypyroot = os.path.dirname(os.path.dirname(os.path.abspath(pypy.__file__))) +pypyroot = os.path.dirname(pypydir) del pypy from rpython.tool.version import get_repo_version_info ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fix-version-tool: unused import
Author: Brian Kearns Branch: fix-version-tool Changeset: r60549:5480de09f372 Date: 2013-01-27 11:56 -0500 http://bitbucket.org/pypy/pypy/changeset/5480de09f372/ Log:unused import diff --git a/rpython/tool/test/test_version.py b/rpython/tool/test/test_version.py --- a/rpython/tool/test/test_version.py +++ b/rpython/tool/test/test_version.py @@ -1,5 +1,4 @@ import os, sys -import py from rpython.tool.version import get_repo_version_info, _get_hg_archive_version def test_hg_archival_version(tmpdir): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Merged in bdkearns/pypy/fix-version-tool (pull request #111)
Author: Maciej Fijalkowski Branch: Changeset: r60550:7b8a30192de5 Date: 2013-01-27 22:37 +0200 http://bitbucket.org/pypy/pypy/changeset/7b8a30192de5/ Log:Merged in bdkearns/pypy/fix-version-tool (pull request #111) make get_repo_version_info() usable generically for any repository root diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -28,6 +28,7 @@ import pypy pypydir = os.path.dirname(os.path.abspath(pypy.__file__)) +pypyroot = os.path.dirname(pypydir) del pypy from rpython.tool.version import get_repo_version_info @@ -68,7 +69,7 @@ CPYTHON_VERSION[0], CPYTHON_VERSION[1], CPYTHON_VERSION[2], -get_repo_version_info()[2], +get_repo_version_info(root=pypyroot)[2], date, time, ver, @@ -91,10 +92,10 @@ return space.wrap(('PyPy', '', '')) def get_repo_info(space): -info = get_repo_version_info() +info = get_repo_version_info(root=pypyroot) if info: project, repo_tag, repo_version = info -return space.newtuple([space.wrap(project), +return space.newtuple([space.wrap('PyPy'), space.wrap(repo_tag), space.wrap(repo_version)]) else: diff --git a/rpython/tool/test/test_version.py b/rpython/tool/test/test_version.py --- a/rpython/tool/test/test_version.py +++ b/rpython/tool/test/test_version.py @@ -1,5 +1,4 @@ import os, sys -import py from rpython.tool.version import get_repo_version_info, _get_hg_archive_version def test_hg_archival_version(tmpdir): @@ -11,11 +10,11 @@ assert version_for('release', tag='release-123', node='000', - ) == ('RPython', 'release-123', '000') + ) == ('release-123', '000') assert version_for('somebranch', node='000', branch='something', - ) == ('RPython', 'something', '000') + ) == ('something', '000') def test_get_repo_version_info(): diff --git a/rpython/tool/version.py b/rpython/tool/version.py --- a/rpython/tool/version.py +++ b/rpython/tool/version.py @@ -4,7 +4,7 @@ import rpython rpythondir = os.path.dirname(os.path.abspath(rpython.__file__)) rpythonroot = os.path.dirname(rpythondir) -default_retval = 'RPython', '?', '?' +default_retval = '?', '?' def maywarn(err, repo_type='Mercurial'): if not err: @@ -15,31 +15,36 @@ py.log.setconsumer("version", ansi_log) log.WARNING('Errors getting %s information: %s' % (repo_type, err)) -def get_repo_version_info(hgexe=None): +def get_repo_version_info(hgexe=None, root=rpythonroot): '''Obtain version information by invoking the 'hg' or 'git' commands.''' +if root == rpythonroot: +project = ("RPython",) +else: +project = ('?',) + # Try to see if we can get info from Git if hgexe is not specified. if not hgexe: -if os.path.isdir(os.path.join(rpythonroot, '.git')): -return _get_git_version() +if os.path.isdir(os.path.join(root, '.git')): +return project + _get_git_version(root) # Fallback to trying Mercurial. if hgexe is None: hgexe = py.path.local.sysfind('hg') -if os.path.isfile(os.path.join(rpythonroot, '.hg_archival.txt')): -return _get_hg_archive_version(os.path.join(rpythonroot, '.hg_archival.txt')) -elif not os.path.isdir(os.path.join(rpythonroot, '.hg')): +if os.path.isfile(os.path.join(root, '.hg_archival.txt')): +return project + _get_hg_archive_version(os.path.join(root, '.hg_archival.txt')) +elif not os.path.isdir(os.path.join(root, '.hg')): maywarn('Not running from a Mercurial repository!') -return default_retval +return project + default_retval elif not hgexe: maywarn('Cannot find Mercurial command!') -return default_retval +return project + default_retval else: -return _get_hg_version(hgexe) +return project + _get_hg_version(hgexe, root) -def _get_hg_version(hgexe): +def _get_hg_version(hgexe, root): env = dict(os.environ) # get Mercurial into scripting mode env['HGPLAIN'] = '1' @@ -57,14 +62,14 @@ maywarn('command does not identify itself as Mercurial') return default_retval -p = Popen([str(hgexe), 'id', '-i', rpythonroot], +p = Popen([str(hgexe), 'id', '-i', root], stdout=PIPE, stderr=PIPE, env=env) hgid = p.stdout.read().strip() maywarn(p.stderr.read()) if p.wait() != 0: hgid = '?' -p = Popen([str(hgexe), 'id', '-t', rpythonroot], +p = Popen([str(hgexe), 'id', '-t', root], stdout=PIPE, stderr=PIPE, env=env) hgtags = [t for t in p.stdout.read().strip().split() if t != 'tip'] maywar
[pypy-commit] pypy kill-flowobjspace: CallSpec: inline a bit
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60551:a0ef0f4b0dbc Date: 2013-01-27 18:47 + http://bitbucket.org/pypy/pypy/changeset/a0ef0f4b0dbc/ Log:CallSpec: inline a bit diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -397,14 +397,11 @@ def combine_if_necessary(self): if self.combine_has_happened: return -self._combine_wrapped(self.w_stararg) +if self.w_stararg is not None: +args_w = self.space.unpackiterable(self.w_stararg) +self.arguments_w = self.arguments_w + args_w self.combine_has_happened = True -def _combine_wrapped(self, w_stararg): -"unpack the *arg and **kwd into arguments_w and keywords_w" -if w_stararg is not None: -self._combine_starargs_wrapped(w_stararg) - def _rawshape(self, nextra=0): assert not self.combine_has_happened shape_cnt = len(self.arguments_w)+nextra# Number of positional args ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: make CallSpec.unpack() non-destructive
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60552:eda004a832ff Date: 2013-01-27 20:51 + http://bitbucket.org/pypy/pypy/changeset/eda004a832ff/ Log:make CallSpec.unpack() non-destructive diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -386,21 +386,26 @@ self.space = space assert isinstance(args_w, list) self.arguments_w = args_w -self.keywords = keywords -self.keywords_w = keywords_w +self.keywords = keywords or [] +self.keywords_w = keywords_w or [] self.keyword_names_w = None def copy(self): return CallSpec(self.space, self.arguments_w, self.keywords, self.keywords_w, self.w_stararg) +def unpack(self): +"Return a ([w1,w2...], {'kw':w3...}) pair." +if self.w_stararg is not None: +stargs_w = self.space.unpackiterable(self.w_stararg) +args_w = self.arguments_w + stargs_w +else: +args_w = self.arguments_w +kwds_w = dict(zip(self.keywords, self.keywords_w)) +return args_w, kwds_w + def combine_if_necessary(self): -if self.combine_has_happened: -return -if self.w_stararg is not None: -args_w = self.space.unpackiterable(self.w_stararg) -self.arguments_w = self.arguments_w + args_w -self.combine_has_happened = True +raise NotImplementedError def _rawshape(self, nextra=0): assert not self.combine_has_happened diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py --- a/rpython/flowspace/objspace.py +++ b/rpython/flowspace/objspace.py @@ -417,7 +417,7 @@ return sc(self, fn, args) try: -args_w, kwds_w = args.copy().unpack() +args_w, kwds_w = args.unpack() except UnwrapException: args_w, kwds_w = '?', '?' # NOTE: annrpython needs to know about the following two operations! ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: give up
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60553:1079691f3cf0 Date: 2013-01-27 23:04 +0200 http://bitbucket.org/pypy/pypy/changeset/1079691f3cf0/ Log:give up diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc.py b/rpython/jit/backend/x86/test/test_zrpy_gc.py --- a/rpython/jit/backend/x86/test/test_zrpy_gc.py +++ b/rpython/jit/backend/x86/test/test_zrpy_gc.py @@ -793,7 +793,7 @@ def define_compile_framework_call_assembler(self): S = lltype.GcForwardReference() S.become(lltype.GcStruct('S', ('s', lltype.Ptr(S -driver = JitDriver(greens = [], reds = ['x', 'x0', 'x2']) +driver = JitDriver(greens = [], reds = 'auto') def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s0): driver.jit_merge_point(x=x, x0=x0, x2=x2) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: give up even more
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60554:406487744603 Date: 2013-01-27 23:05 +0200 http://bitbucket.org/pypy/pypy/changeset/406487744603/ Log:give up even more diff --git a/rpython/jit/backend/x86/test/test_zrpy_gc.py b/rpython/jit/backend/x86/test/test_zrpy_gc.py --- a/rpython/jit/backend/x86/test/test_zrpy_gc.py +++ b/rpython/jit/backend/x86/test/test_zrpy_gc.py @@ -796,7 +796,7 @@ driver = JitDriver(greens = [], reds = 'auto') def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s0): -driver.jit_merge_point(x=x, x0=x0, x2=x2) +driver.jit_merge_point() i = 0 prev_s = lltype.nullptr(S) while i < 100: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: ll2ctypes drives me nuts
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60555:7d06cb9306a1 Date: 2013-01-27 22:14 +0100 http://bitbucket.org/pypy/pypy/changeset/7d06cb9306a1/ Log:ll2ctypes drives me nuts 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 @@ -2062,7 +2062,7 @@ def test_cond_call_gc_wb(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) @@ -2092,13 +2092,13 @@ [BoxPtr(sgcref), ConstPtr(tgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [s] +assert record == [rffi.cast(lltype.Signed, sgcref)] else: assert record == [] def test_cond_call_gc_wb_array(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) @@ -2127,13 +2127,13 @@ [BoxPtr(sgcref), ConstInt(123), BoxPtr(sgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [s] +assert record == [rffi.cast(lltype.Signed, sgcref)] else: assert record == [] def test_cond_call_gc_wb_array_card_marking_fast_path(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) if cond == 1: # the write barrier sets the flag s.data.tid |= 32768 record = [] @@ -2192,7 +2192,7 @@ [BoxPtr(sgcref), box_index, BoxPtr(sgcref)], 'void', descr=WriteBarrierDescr()) if cond in [0, 1]: -assert record == [s.data] +assert record == [rffi.cast(lltype.Signed, s.data)] else: assert record == [] if cond in [1, 2]: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: UH, that's what I get for naming variables wrongly
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60556:32f451f7cffb Date: 2013-01-27 23:16 +0200 http://bitbucket.org/pypy/pypy/changeset/32f451f7cffb/ Log:UH, that's what I get for naming variables wrongly diff --git a/rpython/jit/backend/llsupport/jitframe.py b/rpython/jit/backend/llsupport/jitframe.py --- a/rpython/jit/backend/llsupport/jitframe.py +++ b/rpython/jit/backend/llsupport/jitframe.py @@ -14,9 +14,9 @@ GCMAP = lltype.GcArray(lltype.Unsigned) NULLGCMAP = lltype.nullptr(GCMAP) -def jitframeinfo_set_depth(jfi, new_depth): +def jitframeinfo_set_depth(jfi, base_ofs, new_depth): jfi.jfi_frame_depth = new_depth -jfi.jfi_frame_size = STATICSIZE + new_depth * SIZEOFSIGNED +jfi.jfi_frame_size = base_ofs + new_depth * SIZEOFSIGNED JITFRAMEINFO = lltype.GcStruct( 'JITFRAMEINFO', 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 @@ -507,7 +507,7 @@ clt = CompiledLoopToken(self.cpu, looptoken.number) clt.frame_info = lltype.malloc(jitframe.JITFRAMEINFO) clt.allgcrefs = [] -clt.frame_info.set_frame_depth(0) # for now +clt.frame_info.set_frame_depth(0, 0) # for now looptoken.compiled_loop_token = clt clt._debug_nbargs = len(inputargs) if not we_are_translated(): @@ -666,12 +666,13 @@ mc.copy_to_raw_memory(rawstart + pos_after_jz - 4) def update_frame_depth(self, frame_depth): -self.current_clt.frame_info.set_frame_depth(frame_depth) +baseofs = self.cpu.get_baseofs_of_frame_field() +self.current_clt.frame_info.set_frame_depth(baseofs, frame_depth) new_jumping_to = [] for wref in self.current_clt.jumping_to: clt = wref() if clt is not None: -clt.frame_info.set_frame_depth(max(frame_depth, +clt.frame_info.set_frame_depth(baseofs, max(frame_depth, clt.frame_info.jfi_frame_depth)) new_jumping_to.append(weakref.ref(clt)) self.current_clt.jumping_to = new_jumping_to @@ -898,7 +899,8 @@ # copy frame-info data old_fi = oldlooptoken.compiled_loop_token.frame_info new_fi = newlooptoken.compiled_loop_token.frame_info -old_fi.set_frame_depth(new_fi.jfi_frame_depth) +baseofs = self.cpu.get_baseofs_of_frame_field() +old_fi.set_frame_depth(baseofs, new_fi.jfi_frame_depth) mc = codebuf.MachineCodeBlockWrapper() mc.JMP(imm(target)) if WORD == 4: # keep in sync with prepare_loop() ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: actually just kill this misleading var
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60557:a06c4c0a4854 Date: 2013-01-27 23:17 +0200 http://bitbucket.org/pypy/pypy/changeset/a06c4c0a4854/ Log:actually just kill this misleading var diff --git a/rpython/jit/backend/llsupport/jitframe.py b/rpython/jit/backend/llsupport/jitframe.py --- a/rpython/jit/backend/llsupport/jitframe.py +++ b/rpython/jit/backend/llsupport/jitframe.py @@ -3,7 +3,6 @@ from rpython.rlib.objectmodel import specialize from rpython.rlib.debug import ll_assert -STATICSIZE = 0 # patch from the assembler backend SIZEOFSIGNED = rffi.sizeof(lltype.Signed) IS_32BIT = (SIZEOFSIGNED == 2 ** 31 - 1) diff --git a/rpython/jit/backend/llsupport/test/test_gc.py b/rpython/jit/backend/llsupport/test/test_gc.py --- a/rpython/jit/backend/llsupport/test/test_gc.py +++ b/rpython/jit/backend/llsupport/test/test_gc.py @@ -271,42 +271,37 @@ return (frame_adr + jitframe.getofs('jf_frame') + jitframe.BASEITEMOFS + jitframe.SIGN_SIZE * no) -PREV_STATICSIZE = jitframe.STATICSIZE -try: -jitframe.STATICSIZE = 3 -frame_info = lltype.malloc(jitframe.JITFRAMEINFO, zero=True) -frame = lltype.malloc(jitframe.JITFRAME, 15, zero=True) -frame.jf_frame_info = frame_info -frame.jf_gcmap = lltype.malloc(jitframe.GCMAP, 2) -if sys.maxint == 2**31 - 1: -max = r_uint(2 ** 31) -else: -max = r_uint(2 ** 63) -frame.jf_gcmap[0] = r_uint(1 | 2 | 8 | 32 | 128) | max -frame.jf_gcmap[1] = r_uint(2 | 16 | 32 | 128) -frame_adr = llmemory.cast_ptr_to_adr(frame) -all_addrs = [] -next = jitframe.jitframe_trace(frame_adr, llmemory.NULL) -while next: -all_addrs.append(next) -next = jitframe.jitframe_trace(frame_adr, next) -counter = 0 -for name in jitframe.JITFRAME._names: -TP = getattr(jitframe.JITFRAME, name) -if isinstance(TP, lltype.Ptr): # only GC pointers -assert all_addrs[counter] == frame_adr + jitframe.getofs(name) -counter += 1 -# gcpattern -assert all_addrs[6] == indexof(0) -assert all_addrs[7] == indexof(1) -assert all_addrs[8] == indexof(3) -assert all_addrs[9] == indexof(5) -assert all_addrs[10] == indexof(7) -assert all_addrs[11] == indexof(63) -# XXX 32bit -assert all_addrs[12] == indexof(65) +frame_info = lltype.malloc(jitframe.JITFRAMEINFO, zero=True) +frame = lltype.malloc(jitframe.JITFRAME, 15, zero=True) +frame.jf_frame_info = frame_info +frame.jf_gcmap = lltype.malloc(jitframe.GCMAP, 2) +if sys.maxint == 2**31 - 1: +max = r_uint(2 ** 31) +else: +max = r_uint(2 ** 63) +frame.jf_gcmap[0] = r_uint(1 | 2 | 8 | 32 | 128) | max +frame.jf_gcmap[1] = r_uint(2 | 16 | 32 | 128) +frame_adr = llmemory.cast_ptr_to_adr(frame) +all_addrs = [] +next = jitframe.jitframe_trace(frame_adr, llmemory.NULL) +while next: +all_addrs.append(next) +next = jitframe.jitframe_trace(frame_adr, next) +counter = 0 +for name in jitframe.JITFRAME._names: +TP = getattr(jitframe.JITFRAME, name) +if isinstance(TP, lltype.Ptr): # only GC pointers +assert all_addrs[counter] == frame_adr + jitframe.getofs(name) +counter += 1 +# gcpattern +assert all_addrs[6] == indexof(0) +assert all_addrs[7] == indexof(1) +assert all_addrs[8] == indexof(3) +assert all_addrs[9] == indexof(5) +assert all_addrs[10] == indexof(7) +assert all_addrs[11] == indexof(63) +# XXX 32bit +assert all_addrs[12] == indexof(65) -assert len(all_addrs) == 6 + 6 + 4 -# 6 static fields, 4 addresses from gcmap, 2 from gcpattern -finally: -jitframe.STATICSIZE = PREV_STATICSIZE +assert len(all_addrs) == 6 + 6 + 4 +# 6 static fields, 4 addresses from gcmap, 2 from gcpattern diff --git a/rpython/jit/backend/x86/runner.py b/rpython/jit/backend/x86/runner.py --- a/rpython/jit/backend/x86/runner.py +++ b/rpython/jit/backend/x86/runner.py @@ -15,8 +15,6 @@ from rpython.jit.backend.llsupport.descr import ArrayDescr, FLAG_POINTER,\ FLAG_FLOAT -jitframe.STATICSIZE = JITFRAME_FIXED_SIZE - import sys from rpython.tool.ansi_print import ansi_log ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: merge
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60558:103c9c68341d Date: 2013-01-27 23:18 +0200 http://bitbucket.org/pypy/pypy/changeset/103c9c68341d/ Log:merge 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 @@ -2062,7 +2062,7 @@ def test_cond_call_gc_wb(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) @@ -2092,13 +2092,13 @@ [BoxPtr(sgcref), ConstPtr(tgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [s] +assert record == [rffi.cast(lltype.Signed, sgcref)] else: assert record == [] def test_cond_call_gc_wb_array(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) record = [] # S = lltype.GcStruct('S', ('tid', lltype.Signed)) @@ -2127,13 +2127,13 @@ [BoxPtr(sgcref), ConstInt(123), BoxPtr(sgcref)], 'void', descr=WriteBarrierDescr()) if cond: -assert record == [s] +assert record == [rffi.cast(lltype.Signed, sgcref)] else: assert record == [] def test_cond_call_gc_wb_array_card_marking_fast_path(self): def func_void(a): -record.append(a) +record.append(rffi.cast(lltype.Signed, a)) if cond == 1: # the write barrier sets the flag s.data.tid |= 32768 record = [] @@ -2192,7 +2192,7 @@ [BoxPtr(sgcref), box_index, BoxPtr(sgcref)], 'void', descr=WriteBarrierDescr()) if cond in [0, 1]: -assert record == [s.data] +assert record == [rffi.cast(lltype.Signed, s.data)] else: assert record == [] if cond in [1, 2]: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix exe_name in gen_makefile when shared=True
Author: Brian Kearns Branch: Changeset: r60559:060ce43207d0 Date: 2013-01-27 16:18 -0500 http://bitbucket.org/pypy/pypy/changeset/060ce43207d0/ Log:fix exe_name in gen_makefile when shared=True diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py --- a/rpython/translator/platform/posix.py +++ b/rpython/translator/platform/posix.py @@ -115,7 +115,7 @@ cflags = self.cflags + self.standalone_only m = GnuMakefile(path) -m.exe_name = path.join(target_name) +m.exe_name = path.join(exe_name.basename) m.eci = eci def rpyrel(fpath): diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py --- a/rpython/translator/platform/windows.py +++ b/rpython/translator/platform/windows.py @@ -269,7 +269,7 @@ target_name = exe_name.basename m = NMakefile(path) -m.exe_name = path.join(target_name) +m.exe_name = path.join(exe_name.basename) m.eci = eci linkflags = list(self.link_flags) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix whatsnew
Author: Brian Kearns Branch: Changeset: r60560:02e6ddae5c1d Date: 2013-01-27 16:19 -0500 http://bitbucket.org/pypy/pypy/changeset/02e6ddae5c1d/ Log:fix whatsnew diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -36,6 +36,7 @@ .. branch: task-decorator .. branch: fix-e4fa0b2 .. branch: win32-fixes +.. branch: fix-version-tool .. branch: release-2.0-beta1 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy jitframe-on-heap: this is respectively uninteresting and done
Author: Maciej Fijalkowski Branch: jitframe-on-heap Changeset: r60561:4e549c373b0b Date: 2013-01-27 23:37 +0200 http://bitbucket.org/pypy/pypy/changeset/4e549c373b0b/ Log:this is respectively uninteresting and done diff --git a/pypy/TODO b/pypy/TODO --- a/pypy/TODO +++ b/pypy/TODO @@ -5,6 +5,3 @@ * shadowstack details - slowpath of stack check * kill jit2gc on translator * fix test_singlefloats in test_calling_conventions -* slowpaths can have more variants depending on how many registers we're using - (like floats vs non-floats for failures) -* fix jit hooks \ No newline at end of file ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fix-version-tool: merge default
Author: Brian Kearns Branch: fix-version-tool Changeset: r60562:a0295c6b1209 Date: 2013-01-27 16:41 -0500 http://bitbucket.org/pypy/pypy/changeset/a0295c6b1209/ Log:merge default diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-head.rst @@ -34,6 +34,9 @@ .. branch: kill-faking .. branch: improved_ebnfparse_error .. branch: task-decorator +.. branch: fix-e4fa0b2 +.. branch: win32-fixes +.. branch: fix-version-tool .. branch: release-2.0-beta1 diff --git a/pypy/module/unicodedata/interp_ucd.py b/pypy/module/unicodedata/interp_ucd.py --- a/pypy/module/unicodedata/interp_ucd.py +++ b/pypy/module/unicodedata/interp_ucd.py @@ -9,7 +9,7 @@ from rpython.rlib.objectmodel import we_are_translated from rpython.rlib.runicode import MAXUNICODE from rpython.rlib.unicodedata import unicodedb_5_2_0, unicodedb_3_2_0 -from rpython.rlib.runicode import code_to_unichr, ORD +from rpython.rlib.runicode import code_to_unichr, ord_accepts_surrogate import sys @@ -28,8 +28,6 @@ # handling: on narrow unicode builds, a surrogate pair is considered as one # unicode code point. -# The functions below are subtly different from the ones in runicode.py. -# When PyPy implements Python 3 they should be merged. if MAXUNICODE > 0x: # Target is wide build @@ -41,7 +39,7 @@ if not we_are_translated() and sys.maxunicode == 0x: # Host CPython is narrow build, accept surrogates try: -return ORD(space.unicode_w(w_unichr)) +return ord_accepts_surrogate(space.unicode_w(w_unichr)) except ValueError: raise OperationError(space.w_TypeError, space.wrap( 'need a single Unicode character as parameter')) @@ -68,7 +66,7 @@ else: # Accept surrogates try: -return ORD(space.unicode_w(w_unichr)) +return ord_accepts_surrogate(space.unicode_w(w_unichr)) except ValueError: raise OperationError(space.w_TypeError, space.wrap( 'need a single Unicode character as parameter')) diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py --- a/rpython/rlib/_rsocket_rffi.py +++ b/rpython/rlib/_rsocket_rffi.py @@ -344,7 +344,7 @@ ]) CConfig.WSAPROTOCOL_INFO = platform.Struct( -'struct WSAPROTOCOL_INFO', +'WSAPROTOCOL_INFO', []) # Struct is just passed between functions CConfig.FROM_PROTOCOL_INFO = platform.DefinedConstantInteger( 'FROM_PROTOCOL_INFO') @@ -617,7 +617,7 @@ WSASocket = external('WSASocket', [rffi.INT, rffi.INT, rffi.INT, lltype.Ptr(WSAPROTOCOL_INFO), - rffi.DWORD, rffi.DWORD], + rwin32.DWORD, rwin32.DWORD], socketfd_type) if WIN32: diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py --- a/rpython/rlib/runicode.py +++ b/rpython/rlib/runicode.py @@ -13,6 +13,27 @@ BYTEORDER = sys.byteorder +# python 2.7 has a preview of py3k behavior, so those functions +# are used either when we're testing wide pypy on narrow cpython +# or in unicodedata in pypy + +def unichr_returns_surrogate(c): +if c <= sys.maxunicode or c > MAXUNICODE: +return unichr(c) +else: +c -= 0x1 +return (unichr(0xD800 + (c >> 10)) + +unichr(0xDC00 + (c & 0x03FF))) + +def ord_accepts_surrogate(u): +if isinstance(u, unicode) and len(u) == 2: +ch1 = ord(u[0]) +ch2 = ord(u[1]) +if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: +return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 +assert len(u) == 1 +return ord(u[0]) + if MAXUNICODE > sys.maxunicode: # A version of unichr which allows codes outside the BMP # even on narrow unicode builds. @@ -21,12 +42,7 @@ # Note that Python3 uses a similar implementation. def UNICHR(c): assert not we_are_translated() -if c <= sys.maxunicode or c > MAXUNICODE: -return unichr(c) -else: -c -= 0x1 -return (unichr(0xD800 + (c >> 10)) + -unichr(0xDC00 + (c & 0x03FF))) +return unichr_returns_surrogate(c) UNICHR._flowspace_rewrite_directly_as_ = unichr # ^^^ NB.: for translation, it's essential to use this hack instead # of calling unichr() from UNICHR(), because unichr() detects if there @@ -34,12 +50,7 @@ def ORD(u): assert not we_are_translated() -if isinstance(u, unicode) and len(u) == 2: -ch1 = ord(u[0]) -ch2 = ord(u[1]) -if 0xD800 <= ch1 <= 0xDBFF and 0xDC00 <= ch2 <= 0xDFFF: -return (((ch1 - 0xD800) << 10) | (ch2 - 0xDC00)) + 0x1 -return ord(u) +return ord_accepts
[pypy-commit] pypy fix-version-tool: remove hardcoded project from get_repo_version_info()
Author: Brian Kearns Branch: fix-version-tool Changeset: r60563:d28498b4b051 Date: 2013-01-27 16:53 -0500 http://bitbucket.org/pypy/pypy/changeset/d28498b4b051/ Log:remove hardcoded project from get_repo_version_info() diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py --- a/pypy/module/sys/version.py +++ b/pypy/module/sys/version.py @@ -69,7 +69,7 @@ CPYTHON_VERSION[0], CPYTHON_VERSION[1], CPYTHON_VERSION[2], -get_repo_version_info(root=pypyroot)[2], +get_repo_version_info(root=pypyroot)[1], date, time, ver, @@ -94,7 +94,7 @@ def get_repo_info(space): info = get_repo_version_info(root=pypyroot) if info: -project, repo_tag, repo_version = info +repo_tag, repo_version = info return space.newtuple([space.wrap('PyPy'), space.wrap(repo_tag), space.wrap(repo_version)]) diff --git a/rpython/tool/test/test_version.py b/rpython/tool/test/test_version.py --- a/rpython/tool/test/test_version.py +++ b/rpython/tool/test/test_version.py @@ -19,5 +19,5 @@ def test_get_repo_version_info(): assert get_repo_version_info(None) -assert get_repo_version_info(os.devnull) == ('RPython', '?', '?') -assert get_repo_version_info(sys.executable) == ('RPython', '?', '?') +assert get_repo_version_info(os.devnull) == ('?', '?') +assert get_repo_version_info(sys.executable) == ('?', '?') diff --git a/rpython/tool/udir.py b/rpython/tool/udir.py --- a/rpython/tool/udir.py +++ b/rpython/tool/udir.py @@ -31,7 +31,7 @@ if basename is None: info = get_repo_version_info() if info: -project, hgtag, hgid = info +hgtag, hgid = info basename = hgtag if basename == '?': basename = 'unknown' # directories with ? are not fun diff --git a/rpython/tool/version.py b/rpython/tool/version.py --- a/rpython/tool/version.py +++ b/rpython/tool/version.py @@ -18,30 +18,25 @@ def get_repo_version_info(hgexe=None, root=rpythonroot): '''Obtain version information by invoking the 'hg' or 'git' commands.''' -if root == rpythonroot: -project = ("RPython",) -else: -project = ('?',) - # Try to see if we can get info from Git if hgexe is not specified. if not hgexe: if os.path.isdir(os.path.join(root, '.git')): -return project + _get_git_version(root) +return _get_git_version(root) # Fallback to trying Mercurial. if hgexe is None: hgexe = py.path.local.sysfind('hg') if os.path.isfile(os.path.join(root, '.hg_archival.txt')): -return project + _get_hg_archive_version(os.path.join(root, '.hg_archival.txt')) +return _get_hg_archive_version(os.path.join(root, '.hg_archival.txt')) elif not os.path.isdir(os.path.join(root, '.hg')): maywarn('Not running from a Mercurial repository!') -return project + default_retval +return default_retval elif not hgexe: maywarn('Cannot find Mercurial command!') -return project + default_retval +return default_retval else: -return project + _get_hg_version(hgexe, root) +return _get_hg_version(hgexe, root) def _get_hg_version(hgexe, root): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: clarify comment
Author: Brian Kearns Branch: Changeset: r60566:022a44a9b630 Date: 2013-01-27 17:46 -0500 http://bitbucket.org/pypy/pypy/changeset/022a44a9b630/ Log:clarify comment diff --git a/pypy/interpreter/test2/test_app_main.py b/pypy/interpreter/test2/test_app_main.py --- a/pypy/interpreter/test2/test_app_main.py +++ b/pypy/interpreter/test2/test_app_main.py @@ -774,7 +774,7 @@ assert data == p + os.sep + '\n' def test_getfilesystemencoding(self): -py.test.skip("this has been failing since forever, but it's not tested nightly because buildbot uses python2.6 :-(") +py.test.skip("encoding is only set if stdout.isatty(), test is flawed") if sys.version_info < (2, 7): skip("test requires Python >= 2.7") p = getscript_in_dir(""" ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: cleanups
Author: Brian Kearns Branch: Changeset: r60567:44a14b38dc4c Date: 2013-01-27 17:56 -0500 http://bitbucket.org/pypy/pypy/changeset/44a14b38dc4c/ Log:cleanups diff --git a/pypy/interpreter/test2/test_app_main.py b/pypy/interpreter/test2/test_app_main.py --- a/pypy/interpreter/test2/test_app_main.py +++ b/pypy/interpreter/test2/test_app_main.py @@ -881,7 +881,6 @@ def test_setup_bootstrap_path(self): import sys -import os old_sys_path = sys.path[:] sys.path.append(self.goal_dir) try: diff --git a/pypy/interpreter/test2/test_targetpypy.py b/pypy/interpreter/test2/test_targetpypy.py --- a/pypy/interpreter/test2/test_targetpypy.py +++ b/pypy/interpreter/test2/test_targetpypy.py @@ -1,5 +1,3 @@ - -import py from pypy.goal.targetpypystandalone import get_entry_point from pypy.config.pypyoption import get_pypy_config @@ -7,6 +5,4 @@ def test_run(self): config = get_pypy_config(translating=False) entry_point = get_entry_point(config)[0] -space = self.space -py.test.skip("not working so far") entry_point(['pypy-c' , '-S', '-c', 'print 3']) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix unnecessary skip
Author: Brian Kearns Branch: Changeset: r60568:af9676802136 Date: 2013-01-27 18:24 -0500 http://bitbucket.org/pypy/pypy/changeset/af9676802136/ Log:fix unnecessary skip diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py --- a/pypy/module/_io/test/test_fileio.py +++ b/pypy/module/_io/test/test_fileio.py @@ -2,7 +2,7 @@ import os class AppTestFileIO: -spaceconfig = dict(usemodules=['_io']) +spaceconfig = dict(usemodules=['_io'] + (['fcntl'] if os.name != 'nt' else [])) def setup_class(cls): tmpfile = udir.join('tmpfile') ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix some tests on darwin
Author: Brian Kearns Branch: Changeset: r60569:b59c8e831df0 Date: 2013-01-27 18:58 -0500 http://bitbucket.org/pypy/pypy/changeset/b59c8e831df0/ Log:fix some tests on darwin diff --git a/pypy/module/_ffi/test/test_funcptr.py b/pypy/module/_ffi/test/test_funcptr.py --- a/pypy/module/_ffi/test/test_funcptr.py +++ b/pypy/module/_ffi/test/test_funcptr.py @@ -96,7 +96,7 @@ libm = CDLL(self.libm_name) pow_addr = libm.getaddressindll('pow') fff = sys.maxint*2-1 -if sys.platform == 'win32': +if sys.platform == 'win32' or sys.platform == 'darwin': fff = sys.maxint*2+1 assert pow_addr == self.pow_addr & fff diff --git a/pypy/module/rctime/test/test_rctime.py b/pypy/module/rctime/test/test_rctime.py --- a/pypy/module/rctime/test/test_rctime.py +++ b/pypy/module/rctime/test/test_rctime.py @@ -213,7 +213,7 @@ def test_strftime(self): import time as rctime -import os +import os, sys t = rctime.time() tt = rctime.gmtime(t) @@ -234,6 +234,10 @@ # input to [w]strftime is not kosher. if os.name == 'nt': raises(ValueError, rctime.strftime, '%f') +elif sys.platform == 'darwin': +# darwin strips % of unknown format codes +# http://bugs.python.org/issue9811 +assert rctime.strftime('%f') == 'f' else: assert rctime.strftime('%f') == '%f' diff --git a/pypy/module/signal/test/test_signal.py b/pypy/module/signal/test/test_signal.py --- a/pypy/module/signal/test/test_signal.py +++ b/pypy/module/signal/test/test_signal.py @@ -157,6 +157,8 @@ if sys.platform == 'win32': raises(ValueError, signal, 42, lambda *args: None) raises(ValueError, signal, 7, lambda *args: None) +elif sys.platform == 'darwin': +raises(ValueError, signal, 42, lambda *args: None) else: signal(42, lambda *args: None) signal(42, SIG_DFL) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fix-e4fa0b2: close merged branch
Author: Brian Kearns Branch: fix-e4fa0b2 Changeset: r60570:e5da67dc7430 Date: 2013-01-27 20:15 -0500 http://bitbucket.org/pypy/pypy/changeset/e5da67dc7430/ Log:close merged branch ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: flowspace: test kwarg call
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60571:448681fc6a2e Date: 2013-01-27 22:25 + http://bitbucket.org/pypy/pypy/changeset/448681fc6a2e/ Log:flowspace: test kwarg call diff --git a/rpython/flowspace/test/test_objspace.py b/rpython/flowspace/test/test_objspace.py --- a/rpython/flowspace/test/test_objspace.py +++ b/rpython/flowspace/test/test_objspace.py @@ -716,6 +716,18 @@ graph = self.codetest(f2) assert 'Dict-unpacking' in str(excinfo.value) +def test_kwarg_call(self): +def g(x): +return x +def f(): +return g(x=2) +graph = self.codetest(f) +for block in graph.iterblocks(): +for op in block.operations: +assert op.opname == "call_args" +assert op.args == map(Constant, +[g, (0, ('x',), False, False), 2]) + def test_catch_importerror_1(self): def f(): try: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: make CallSpec independent of ArgumentsForTranslation
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60573:5398a4125bb7 Date: 2013-01-28 03:09 + http://bitbucket.org/pypy/pypy/changeset/5398a4125bb7/ Log:make CallSpec independent of ArgumentsForTranslation diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -374,7 +374,7 @@ return args._rawshape(nextra) -class CallSpec(ArgumentsForTranslation): +class CallSpec(object): """Represents the arguments passed into a function call, i.e. the `a, b, *c, **d` part in `return func(a, b, *c, **d)`. """ @@ -388,9 +388,6 @@ self.arguments_w = args_w self.keywords = keywords or {} -def copy(self): -return self - def unpack(self): "Return a ([w1,w2...], {'kw':w3...}) pair." if self.w_stararg is not None: @@ -400,9 +397,6 @@ args_w = self.arguments_w return args_w, self.keywords -def combine_if_necessary(self): -raise NotImplementedError - def flatten(self): """ Argument <-> list of w_objects together with "shape" information """ shape_cnt = len(self.arguments_w)# Number of positional args ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-flowobjspace: Store CallSpec kwargs in a dict
Author: Ronan Lamy Branch: kill-flowobjspace Changeset: r60572:4affc42b8dba Date: 2013-01-27 22:56 + http://bitbucket.org/pypy/pypy/changeset/4affc42b8dba/ Log:Store CallSpec kwargs in a dict diff --git a/rpython/flowspace/argument.py b/rpython/flowspace/argument.py --- a/rpython/flowspace/argument.py +++ b/rpython/flowspace/argument.py @@ -378,21 +378,18 @@ """Represents the arguments passed into a function call, i.e. the `a, b, *c, **d` part in `return func(a, b, *c, **d)`. """ -def __init__(self, space, args_w, keywords=None, keywords_w=None, - w_stararg=None, w_starstararg=None): +def __init__(self, space, args_w, keywords=None, w_stararg=None, +w_starstararg=None): self.w_stararg = w_stararg assert w_starstararg is None, "No **-unpacking in RPython" self.combine_has_happened = False self.space = space assert isinstance(args_w, list) self.arguments_w = args_w -self.keywords = keywords or [] -self.keywords_w = keywords_w or [] -self.keyword_names_w = None +self.keywords = keywords or {} def copy(self): -return CallSpec(self.space, self.arguments_w, -self.keywords, self.keywords_w, self.w_stararg) +return self def unpack(self): "Return a ([w1,w2...], {'kw':w3...}) pair." @@ -401,23 +398,21 @@ args_w = self.arguments_w + stargs_w else: args_w = self.arguments_w -kwds_w = dict(zip(self.keywords, self.keywords_w)) -return args_w, kwds_w +return args_w, self.keywords def combine_if_necessary(self): raise NotImplementedError -def _rawshape(self, nextra=0): -assert not self.combine_has_happened -shape_cnt = len(self.arguments_w)+nextra# Number of positional args -if self.keywords: -shape_keys = self.keywords[:]# List of keywords (strings) -shape_keys.sort() -else: -shape_keys = [] +def flatten(self): +""" Argument <-> list of w_objects together with "shape" information """ +shape_cnt = len(self.arguments_w)# Number of positional args +shape_keys = tuple(sorted(self.keywords)) shape_star = self.w_stararg is not None # Flag: presence of *arg shape_stst = False # Flag: presence of **kwds -return shape_cnt, tuple(shape_keys), shape_star, shape_stst # shape_keys are sorted +data_w = self.arguments_w + [self.keywords[key] for key in shape_keys] +if shape_star: +data_w.append(self.w_stararg) +return (shape_cnt, shape_keys, shape_star, shape_stst), data_w # diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py --- a/rpython/flowspace/flowcontext.py +++ b/rpython/flowspace/flowcontext.py @@ -975,24 +975,14 @@ raise FlowingError(self, "Dict-unpacking is not RPython") n_arguments = oparg & 0xff n_keywords = (oparg>>8) & 0xff -if n_keywords: -keywords = [None] * n_keywords -keywords_w = [None] * n_keywords -while True: -n_keywords -= 1 -if n_keywords < 0: -break -w_value = self.popvalue() -w_key = self.popvalue() -key = self.space.str_w(w_key) -keywords[n_keywords] = key -keywords_w[n_keywords] = w_value -else: -keywords = None -keywords_w = None +keywords = {} +for _ in range(n_keywords): +w_value = self.popvalue() +w_key = self.popvalue() +key = self.space.str_w(w_key) +keywords[key] = w_value arguments = self.popvalues(n_arguments) -args = CallSpec(self.space, arguments, keywords, -keywords_w, w_star, w_starstar) +args = CallSpec(self.space, arguments, keywords, w_star, w_starstar) w_function = self.popvalue() w_result = self.space.call_args(w_function, args) self.pushvalue(w_result) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: more darwin test fixes
Author: Brian Kearns Branch: Changeset: r60574:f35e9b243a35 Date: 2013-01-27 20:21 -0800 http://bitbucket.org/pypy/pypy/changeset/f35e9b243a35/ Log:more darwin test fixes diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py --- a/pypy/module/cpyext/test/test_cpyext.py +++ b/pypy/module/cpyext/test/test_cpyext.py @@ -49,6 +49,8 @@ kwds["libraries"] = [api_library] # '%s' undefined; assuming extern returning int kwds["compile_extra"] = ["/we4013"] +elif sys.platform == 'darwin': +kwds["link_files"] = [str(api_library + '.dylib')] else: kwds["link_files"] = [str(api_library + '.so')] if sys.platform.startswith('linux'): diff --git a/rpython/rlib/test/test_rposix.py b/rpython/rlib/test/test_rposix.py --- a/rpython/rlib/test/test_rposix.py +++ b/rpython/rlib/test/test_rposix.py @@ -117,7 +117,7 @@ curdir = os.getcwd() try: interpret(f, []) -assert os.getcwdu() == self.ufilename +assert os.getcwdu() == os.path.realpath(self.ufilename) finally: os.chdir(curdir) diff --git a/rpython/translator/c/test/test_extfunc.py b/rpython/translator/c/test/test_extfunc.py --- a/rpython/translator/c/test/test_extfunc.py +++ b/rpython/translator/c/test/test_extfunc.py @@ -316,7 +316,7 @@ return os.getcwd() f1 = compile(does_stuff, [str]) # different on windows please -assert f1('/tmp') == '/tmp' +assert f1('/tmp') == os.path.realpath('/tmp') def test_mkdir_rmdir(): def does_stuff(path, delete): diff --git a/rpython/translator/platform/test/test_posix.py b/rpython/translator/platform/test/test_posix.py --- a/rpython/translator/platform/test/test_posix.py +++ b/rpython/translator/platform/test/test_posix.py @@ -41,7 +41,8 @@ if self.strict_on_stderr: assert res.err == '' assert res.returncode == 0 -assert '-lrt' in tmpdir.join("Makefile").read() +if sys.platform.startswith('linux'): +assert '-lrt' in tmpdir.join("Makefile").read() def test_link_files(self): tmpdir = udir.join('link_files' + self.__class__.__name__).ensure(dir=1) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit