[pypy-commit] pypy stringbuilder-perf: Update the test
Author: Armin Rigo Branch: stringbuilder-perf Changeset: r72032:ef6d3281e46e Date: 2014-06-12 14:03 +0200 http://bitbucket.org/pypy/pypy/changeset/ef6d3281e46e/ Log:Update the test diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py --- a/pypy/module/pypyjit/test_pypy_c/test_string.py +++ b/pypy/module/pypyjit/test_pypy_c/test_string.py @@ -102,38 +102,42 @@ assert log.result == main(1000) loop, = log.loops_by_filename(self.filepath) assert loop.match(""" -i7 = int_gt(i4, 0) -guard_true(i7, descr=...) +i82 = int_gt(i77, 0) +guard_true(i82, descr=...) guard_not_invalidated(descr=...) -p9 = call(ConstClass(ll_int2dec__Signed), i4, descr=) +p83 = call(ConstClass(ll_int2dec__Signed), i77, descr=) guard_no_exception(descr=...) -i10 = strlen(p9) -i11 = int_is_true(i10) -guard_true(i11, descr=...) -i13 = strgetitem(p9, 0) -i15 = int_eq(i13, 45) -guard_false(i15, descr=...) -i17 = int_neg(i10) -i19 = int_gt(i10, 23) -guard_false(i19, descr=...) -p21 = newstr(23) -copystrcontent(p9, p21, 0, 0, i10) -i25 = int_add(1, i10) -i26 = int_gt(i25, 23) -guard_false(i26, descr=...) -strsetitem(p21, i10, 32) -i30 = int_add(i10, i25) -i31 = int_gt(i30, 23) -guard_false(i31, descr=...) -copystrcontent(p9, p21, 0, i25, i10) -i33 = int_lt(i30, 23) -guard_true(i33, descr=...) -p35 = call(ConstClass(ll_shrink_array__rpy_stringPtr_Signed), p21, i30, descr=) +i84 = strlen(p83) +i85 = int_is_true(i84) +guard_true(i85, descr=...) +i86 = strgetitem(p83, 0) +i87 = int_eq(i86, 45) +guard_false(i87, descr=...) +i88 = int_neg(i84) +i89 = int_add(24, i84) +i90 = uint_le(i89, 56) +guard_true(i90, descr=...) +p92 = newstr(32) +copystrcontent(p83, p92, 0, 0, i84) +i93 = uint_lt(i89, 56) +guard_true(i93, descr=...) +i94 = int_add(i89, 1) +strsetitem(p92, i84, 32) +i95 = int_add(i94, i84) +i96 = uint_le(i95, 56) +guard_true(i96, descr=...) +i97 = int_sub(i94, 24) +copystrcontent(p83, p92, 0, i97, i84) +i98 = int_sub(56, i95) +i99 = int_sub(32, i98) +i100 = int_ne(32, i99) +guard_true(i100, descr=...) +p101 = call(ConstClass(ll_shrink_array__rpy_stringPtr_Signed), p92, i99, descr=) guard_no_exception(descr=...) -i37 = strlen(p35) -i38 = int_add_ovf(i5, i37) +i102 = strlen(p101) +i103 = int_add_ovf(i75, i102) guard_no_overflow(descr=...) -i40 = int_sub(i4, 1) +i104 = int_sub(i77, 1) --TICK-- jump(..., descr=...) """) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stringbuilder-perf: Tweak: don't give a minimal size (if we know exactly how many chars
Author: Armin Rigo Branch: stringbuilder-perf Changeset: r72033:b28423c21e95 Date: 2014-06-12 14:09 +0200 http://bitbucket.org/pypy/pypy/changeset/b28423c21e95/ Log:Tweak: don't give a minimal size (if we know exactly how many chars we need and it's less than 32). But resize more aggressively when we're still small. diff --git a/rpython/rtyper/lltypesystem/rbuilder.py b/rpython/rtyper/lltypesystem/rbuilder.py --- a/rpython/rtyper/lltypesystem/rbuilder.py +++ b/rpython/rtyper/lltypesystem/rbuilder.py @@ -54,12 +54,12 @@ @enforceargs(None, int) def stringbuilder_grow(ll_builder, needed): -needed += 7 try: needed = ovfcheck(needed + ll_builder.total_size) except OverflowError: raise MemoryError -needed &= ~7 +needed += 63 +needed &= ~63 # new_piece = lltype.malloc(STRINGPIECE) charsize = ll_builder.charsize @@ -68,7 +68,7 @@ except OverflowError: raise MemoryError new_piece.piece_lgt = needed_chars -raw_ptr = lltype.malloc(rffi.CCHARP.TO, needed * charsize, flavor='raw') +raw_ptr = lltype.malloc(rffi.CCHARP.TO, needed_chars, flavor='raw') new_piece.raw_ptr = raw_ptr new_piece.prev_piece = ll_builder.extra_pieces ll_builder.extra_pieces = new_piece @@ -201,7 +201,7 @@ @classmethod def ll_new(cls, init_size): -init_size = max(min(init_size, 1280), 32) +init_size = min(init_size, 1280) ll_builder = lltype.malloc(cls.lowleveltype.TO) ll_builder.current_buf = cls.mallocfn(init_size) ofs = ll_baseofs(ll_builder.current_buf) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stringbuilder-perf: More tweaks
Author: Armin Rigo Branch: stringbuilder-perf Changeset: r72034:df22a674b249 Date: 2014-06-12 14:11 +0200 http://bitbucket.org/pypy/pypy/changeset/df22a674b249/ Log:More tweaks diff --git a/rpython/rtyper/lltypesystem/rbuilder.py b/rpython/rtyper/lltypesystem/rbuilder.py --- a/rpython/rtyper/lltypesystem/rbuilder.py +++ b/rpython/rtyper/lltypesystem/rbuilder.py @@ -54,19 +54,15 @@ @enforceargs(None, int) def stringbuilder_grow(ll_builder, needed): +charsize = ll_builder.charsize try: needed = ovfcheck(needed + ll_builder.total_size) +needed = ovfcheck(needed + 63) & ~63 +needed_chars = ovfcheck(needed * charsize) except OverflowError: raise MemoryError -needed += 63 -needed &= ~63 # new_piece = lltype.malloc(STRINGPIECE) -charsize = ll_builder.charsize -try: -needed_chars = needed * charsize -except OverflowError: -raise MemoryError new_piece.piece_lgt = needed_chars raw_ptr = lltype.malloc(rffi.CCHARP.TO, needed_chars, flavor='raw') new_piece.raw_ptr = raw_ptr ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: whoops on parallel_runs of tests
Author: mattip Branch: Changeset: r72035:bf4a503315e1 Date: 2014-06-12 18:30 +0300 http://bitbucket.org/pypy/pypy/changeset/bf4a503315e1/ Log:whoops on parallel_runs of tests diff --git a/testrunner/runner.py b/testrunner/runner.py --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -234,7 +234,7 @@ N = run_param.parallel_runs if N > 1: -out.write("running %d parallel test workers") +out.write("running %d parallel test workers" % N) failure = False for testname in testdirs: @@ -355,7 +355,7 @@ help="configuration python file (optional)") parser.add_option("--root", dest="root", default=".", help="root directory for the run") -parser.add_option("--parallel-runs", dest="parallel_runs", default=1, +parser.add_option("--parallel-runs", dest="parallel_runs", default=0, type="int", help="number of parallel test runs") parser.add_option("--dry-run", dest="dry_run", default=False, ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] lang-smalltalk stmgc-c7: Float asString produced wrong results because image instances were read wrongly
Author: Hubert Hesse Branch: stmgc-c7 Changeset: r845:33317024f2e6 Date: 2014-06-12 20:14 +0200 http://bitbucket.org/pypy/lang-smalltalk/changeset/33317024f2e6/ Log:Float asString produced wrong results because image instances were read wrongly diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py --- a/spyvm/squeakimage.py +++ b/spyvm/squeakimage.py @@ -561,8 +561,9 @@ return bytes[:stop] # omit odd bytes def get_ruints(self, required_len=-1): -from rpython.rlib.rarithmetic import r_uint -words = [r_uint(x) for x in self.chunk.data] +from rpython.rlib.rarithmetic import r_uint32 +# XXX: Fix for 64bit image support +words = [r_uint32(x) for x in self.chunk.data] if required_len != -1 and len(words) != required_len: raise CorruptImageError("Expected %d words, got %d" % (required_len, len(words))) return words ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: fix test
Author: mattip Branch: Changeset: r72038:c2bd8af00b27 Date: 2014-06-13 00:57 +0300 http://bitbucket.org/pypy/pypy/changeset/c2bd8af00b27/ Log:fix test diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py --- a/pypy/tool/release/test/test_package.py +++ b/pypy/tool/release/test/test_package.py @@ -115,9 +115,8 @@ basedir = dirname(dirname(dirname(dirname(dirname(abspath(__file__)) options.no_tk = False if sys.platform == 'win32': -# Following recommended build setup at -# http://doc.pypy.org/en/latest/windows.html#abridged-method-for-ojit-builds-using-visual-studio-2008 -options.license_base = dirname(basedir) + '/local' + # as on buildbot YMMV +options.license_base = os.path.join(basedir, r'..\..\..\local') else: options.license_base = '/usr/share/doc' license = package.generate_license(py.path.local(basedir), options) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy ufuncapi: wip
Author: mattip Branch: ufuncapi Changeset: r72037:baa6d5815247 Date: 2014-06-12 23:45 +0300 http://bitbucket.org/pypy/pypy/changeset/baa6d5815247/ Log:wip diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -85,6 +85,29 @@ greens = ['shapelen', 'dtype'], reds = 'auto') +call_many_to_one_driver = jit.JitDriver( +name='numpy_call_many_to_one', +greens=['shapelen', 'func', 'res_dtype'], +reds='auto') + +def call_many_to_one(space, shape, func, res_dtype, w_in, out): +# out must hav been built. func needs no calc_type, is usually an +# external ufunc +iters_and_states = [i.create_iter(shape) for i in w_in] +shapelen = len(shape) +while not out_iter.done(out_state): +call_many_to_one_driver.jit_merge_point(shapelen=shapelen, func=func, + res_dtype=res_dtype) +vals = [None] + [i_s[0].getitem(i_s[1]) for i_s in iters_and_states] +arglist = space.wrap(vals) +out_val = space.call_args(func, Arguments.frompacked(space, arglist)) +out_iter.setitem(out_state, out_val.convert_to(space, res_dtype)) +for i in range(len(iters_and_states)): +iters_and_states[i][1] = iters_and_states[i][0].next(iters_and_states[i][1]) +out_state = out_iter.next(out_state) +return out + + def setslice(space, shape, target, source): # note that unlike everything else, target and source here are # array implementations, not arrays diff --git a/pypy/module/micronumpy/test/test_ufuncs.py b/pypy/module/micronumpy/test/test_ufuncs.py --- a/pypy/module/micronumpy/test/test_ufuncs.py +++ b/pypy/module/micronumpy/test/test_ufuncs.py @@ -208,9 +208,9 @@ except NotImplementedError as e: assert 'object' in str(e) # Use pypy specific extension for out_dtype -myufunc = frompyfunc(adder, 2, 1, out_dtype='match') -int_func22 = frompyfunc(int, 2, 2, out_dtype='match') -int_func12 = frompyfunc(int, 1, 2, out_dtype='match') +myufunc = frompyfunc(adder, 2, 1, dtypes=['match']) +int_func22 = frompyfunc(int, 2, 2, dtypes=['match']) +int_func12 = frompyfunc(int, 1, 2, dtypes=['match']) retype = dtype(int) assert isinstance(myufunc, ufunc) res = myufunc(arange(10), arange(10)) diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py --- a/pypy/module/micronumpy/ufuncs.py +++ b/pypy/module/micronumpy/ufuncs.py @@ -527,8 +527,11 @@ index = self.type_resolver(space, inargs, outargs) self.alloc_outargs(space, index, inargs, outargs) # XXX handle inner-loop indexing -# XXX JIT_me -raise oefmt(space.w_NotImplementedError, 'not implemented yet') +if len(outargs) < 2: +return loop.call_many_to_one(space, new_shape, self.func, + res_dtype, inargs, outargs[0]) +return loop.call_many_to_many(space, new_shape, self.func, + res_dtype, inargs, out) def type_resolver(self, space, index, outargs): # Find a match for the inargs.dtype in self.dtypes, like @@ -951,8 +954,7 @@ if space.is_none(w_dtypes) and not signature: raise oefmt(space.w_NotImplementedError, 'object dtype requested but not implemented') -#dtypes=[descriptor.get_dtype_cache(space).w_objectdtype] -elif space.isinstance_w(w_dtypes, space.w_str): +if space.isinstance_w(w_dtypes, space.w_str): if not space.str_w(w_dtypes) == 'match': raise oefmt(space.w_ValueError, 'unknown out_dtype value "%s"', space.str_w(w_dtypes)) @@ -974,14 +976,17 @@ raise oefmt(space.w_ValueError, 'identity must be 0, 1, or None') if nin==1 and nout==1 and dtypes == 'match': -w_ret = W_Ufunc1(func[0], name) +w_ret = W_Ufunc1(wrap_ext_func(func[0], name) elif nin==2 and nout==1 and dtypes == 'match': -def _func(calc_dtype, w_left, w_right): -arglist = space.wrap([w_left, w_right]) -return space.call_args(func[0], Arguments.frompacked(space, arglist)) -w_ret = W_Ufunc2(_func, name) +w_ret = W_Ufunc2(wrap_ext_func(func[0]), name) else: w_ret = W_UfuncGeneric(space, func, name, identity, nin, nout, dtypes, signature) if doc: w_ret.w_doc = space.wrap(doc) return w_ret + +def wrap_ext_func(func): +def _func(calc_dtype, w_left, w_right): +arglist = space.wrap([w_left, w_right]) +return space.call_args(func, Arguments.frompacked(space, arglist)) +return _func ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org
[pypy-commit] pypy default: typo
Author: mattip Branch: Changeset: r72036:56d1c343a38c Date: 2014-06-12 20:20 +0300 http://bitbucket.org/pypy/pypy/changeset/56d1c343a38c/ Log:typo diff --git a/testrunner/runner.py b/testrunner/runner.py --- a/testrunner/runner.py +++ b/testrunner/runner.py @@ -234,7 +234,7 @@ N = run_param.parallel_runs if N > 1: -out.write("running %d parallel test workers" % N) +out.write("running %d parallel test workers\n" % N) failure = False for testname in testdirs: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit