[pypy-commit] pypy dotviewer-linewidth: Add linewidth attribute to dotviewer
Author: Tobias Pape Branch: dotviewer-linewidth Changeset: r65633:ada230ad6f68 Date: 2013-07-24 18:21 +0200 http://bitbucket.org/pypy/pypy/changeset/ada230ad6f68/ Log:Add linewidth attribute to dotviewer note that due to 'plain'-format restrictions, only the older 'style="setlinewidth(...)"' style is supported. diff --git a/dotviewer/drawgraph.py b/dotviewer/drawgraph.py --- a/dotviewer/drawgraph.py +++ b/dotviewer/drawgraph.py @@ -22,6 +22,7 @@ 'yellow': (255,255,0), } re_nonword=re.compile(r'([^0-9a-zA-Z_.]+)') +re_linewidth=re.compile(r'setlinewidth\((\d+(\.\d*)?|\.\d+)\)') def combine(color1, color2, alpha): r1, g1, b1 = color1 @@ -138,6 +139,13 @@ self.yl = float(yl) rest = rest[3:] self.style, self.color = rest +linematch = re_linewidth.match(self.style) +if linematch: +num = linematch.group(1) +self.linewidth = int(round(float(num))) +self.style = self.style[linematch.end(0):] +else: +self.linewidth = 1 self.highlight = False self.cachedbezierpoints = None self.cachedarrowhead = None @@ -520,8 +528,8 @@ fgcolor = highlight_color(fgcolor) points = [self.map(*xy) for xy in edge.bezierpoints()] -def drawedgebody(points=points, fgcolor=fgcolor): -pygame.draw.lines(self.screen, fgcolor, False, points) +def drawedgebody(points=points, fgcolor=fgcolor, width=edge.linewidth): +pygame.draw.lines(self.screen, fgcolor, False, points, width) edgebodycmd.append(drawedgebody) points = [self.map(*xy) for xy in edge.arrowhead()] diff --git a/dotviewer/test/test_interactive.py b/dotviewer/test/test_interactive.py --- a/dotviewer/test/test_interactive.py +++ b/dotviewer/test/test_interactive.py @@ -34,6 +34,23 @@ } ''' +SOURCE2=r'''digraph f { + a; d; e; f; g; h; i; j; k; l; + a -> d [penwidth=1, style="setlinewidth(1)"]; + d -> e [penwidth=2, style="setlinewidth(2)"]; + e -> f [penwidth=4, style="setlinewidth(4)"]; + f -> g [penwidth=8, style="setlinewidth(8)"]; + g -> h [penwidth=16, style="setlinewidth(16)"]; + h -> i [penwidth=32, style="setlinewidth(32)"]; + i -> j [penwidth=64, style="setlinewidth(64)"]; + j -> k [penwidth=128, style="setlinewidth(128)"]; + k -> l [penwidth=256, style="setlinewidth(256)"]; +}''' + + + + + def setup_module(mod): if not option.pygame: py.test.skip("--pygame not enabled") @@ -161,3 +178,10 @@ page = MyPage(str(dotfile)) page.fixedfont = True graphclient.display_page(page) + +def test_linewidth(): +udir.join("graph2.dot").write(SOURCE2) +from dotviewer import graphpage, graphclient +dotfile = udir.join('graph2.dot') +page = graphpage.DotFileGraphPage(str(dotfile)) +graphclient.display_page(page) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stmgc-c4: make jitviewer work by ignoring thread numbers in log files
Author: Remi Meier Branch: stmgc-c4 Changeset: r65634:88858c31ce32 Date: 2013-07-25 09:40 +0200 http://bitbucket.org/pypy/pypy/changeset/88858c31ce32/ Log:make jitviewer work by ignoring thread numbers in log files diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py --- a/pypy/tool/jitlogparser/parser.py +++ b/pypy/tool/jitlogparser/parser.py @@ -361,12 +361,19 @@ i += 1 return res - +def purge_thread_numbers(entry): +result = [] +for line in entry.split('\n'): +line = line[line.find('#')+2:] +result.append(line) +return '\n'.join(result) + def import_log(logname, ParserCls=SimpleParser): log = parse_log_file(logname) hex_re = '0x(-?[\da-f]+)' addrs = {} for entry in extract_category(log, 'jit-backend-addr'): +entry = purge_thread_numbers(entry) m = re.search('bootstrap ' + hex_re, entry) if not m: # a bridge @@ -381,6 +388,7 @@ addrs.setdefault(addr, []).append(name) dumps = {} for entry in extract_category(log, 'jit-backend-dump'): +entry = purge_thread_numbers(entry) backend, _, dump, _ = entry.split("\n") _, addr, _, data = re.split(" +", dump) backend_name = backend.split(" ")[1] 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 @@ -1203,15 +1203,13 @@ mc.MOV(ebp, mem(ecx, -WORD)) # if gcrootmap and gcrootmap.is_stm: - - if not hasattr(gc_ll_descr, 'P2Wdescr'): raise Exception("unreachable code") wbdescr = gc_ll_descr.P2Wdescr self._stm_barrier_fastpath(mc, wbdescr, [ebp], is_frame=True, align_stack=align_stack) return - +# wbdescr = gc_ll_descr.write_barrier_descr if gcrootmap and wbdescr: # frame never uses card marking, so we enforce this is not ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy refactor-str-types: For interp2app(), pick up the docstring from either the interp-level
Author: Armin Rigo Branch: refactor-str-types Changeset: r65635:de6e41b763ad Date: 2013-07-25 11:18 +0200 http://bitbucket.org/pypy/pypy/changeset/de6e41b763ad/ Log:For interp2app(), pick up the docstring from either the interp-level function (as it was done before) or override it with the "doc" keyword argument. diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py --- a/pypy/interpreter/gateway.py +++ b/pypy/interpreter/gateway.py @@ -520,12 +520,13 @@ # When a BuiltinCode is stored in a Function object, # you get the functionality of CPython's built-in function type. -def __init__(self, func, unwrap_spec=None, self_type=None, descrmismatch=None): +def __init__(self, func, unwrap_spec=None, self_type=None, + descrmismatch=None, doc=None): "NOT_RPYTHON" # 'implfunc' is the interpreter-level function. # Note that this uses a lot of (construction-time) introspection. Code.__init__(self, func.__name__) -self.docstring = func.__doc__ +self.docstring = doc or func.__doc__ self.identifier = "%s-%s-%s" % (func.__module__, func.__name__, getattr(self_type, '__name__', '*')) @@ -832,7 +833,7 @@ instancecache = {} def __new__(cls, f, app_name=None, unwrap_spec=None, descrmismatch=None, -as_classmethod=False): +as_classmethod=False, doc=None): "NOT_RPYTHON" # f must be a function whose name does NOT start with 'app_' @@ -861,7 +862,8 @@ cls.instancecache[key] = self self._code = BuiltinCode(f, unwrap_spec=unwrap_spec, self_type=self_type, - descrmismatch=descrmismatch) + descrmismatch=descrmismatch, + doc=doc) self.__name__ = f.func_name self.name = app_name self.as_classmethod = as_classmethod diff --git a/pypy/interpreter/test/test_gateway.py b/pypy/interpreter/test/test_gateway.py --- a/pypy/interpreter/test/test_gateway.py +++ b/pypy/interpreter/test/test_gateway.py @@ -708,6 +708,18 @@ never_called py.test.raises(AssertionError, space.wrap, gateway.interp2app_temp(g)) +def test_interp2app_doc(self): +space = self.space +def f(space, w_x): +"""foo""" +w_f = space.wrap(gateway.interp2app_temp(f)) +assert space.unwrap(space.getattr(w_f, space.wrap('__doc__'))) == 'foo' +# +def g(space, w_x): +never_called +w_g = space.wrap(gateway.interp2app_temp(g, doc='bar')) +assert space.unwrap(space.getattr(w_g, space.wrap('__doc__'))) == 'bar' + class AppTestPyTestMark: @py.test.mark.unlikely_to_exist ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fast-slowpath: fix this test
Author: Maciej Fijalkowski Branch: fast-slowpath Changeset: r65637:a040b8053e49 Date: 2013-07-25 11:17 +0200 http://bitbucket.org/pypy/pypy/changeset/a040b8053e49/ Log:fix this test 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 @@ -2280,9 +2280,9 @@ ops = ''' [i0, i1, i2, i3, i4, i5, i6, f0, f1] -cond_call(i1, ConstClass(func_ptr), %s, descr=calldescr) +cond_call(i1, ConstClass(func_ptr), %s) guard_false(i0, descr=faildescr) [i1, i2, i3, i4, i5, i6, f0, f1] -''' % ', '.join(['i%d' % (j + 2) for j in range(i)]) +''' % ', '.join(['i%d' % (j + 2) for j in range(i)] + ["descr=calldescr"]) loop = parse(ops, namespace={'faildescr': BasicFailDescr(), 'func_ptr': func_ptr, 'calldescr': calldescr}) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fast-slowpath: we changed the way registers are picked.
Author: Maciej Fijalkowski Branch: fast-slowpath Changeset: r65638:1def2b709c14 Date: 2013-07-25 11:18 +0200 http://bitbucket.org/pypy/pypy/changeset/1def2b709c14/ Log:we changed the way registers are picked. diff --git a/rpython/jit/backend/llsupport/test/test_gc_integration.py b/rpython/jit/backend/llsupport/test/test_gc_integration.py --- a/rpython/jit/backend/llsupport/test/test_gc_integration.py +++ b/rpython/jit/backend/llsupport/test/test_gc_integration.py @@ -84,7 +84,7 @@ nos.reverse() if self.cpu.backend_name.startswith('x86'): if self.cpu.IS_64_BIT: -assert nos == [11, 12, 31] +assert nos == [0, 1, 31] else: assert nos == [4, 5, 25] elif self.cpu.backend_name.startswith('arm'): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy fast-slowpath: ups leftovers
Author: Maciej Fijalkowski Branch: fast-slowpath Changeset: r65639:fe4416f455c8 Date: 2013-07-25 11:19 +0200 http://bitbucket.org/pypy/pypy/changeset/fe4416f455c8/ Log:ups leftovers diff --git a/rpython/jit/backend/llsupport/test/test_rewrite.py b/rpython/jit/backend/llsupport/test/test_rewrite.py --- a/rpython/jit/backend/llsupport/test/test_rewrite.py +++ b/rpython/jit/backend/llsupport/test/test_rewrite.py @@ -89,23 +89,6 @@ tzdescr = None # noone cares # -ARRAY = lltype.GcArray(lltype.Signed) -LIST = lltype.GcStruct('LIST', ('length', lltype.Signed), - ('items', lltype.Ptr(ARRAY))) -lendescr = get_field_descr(self.gc_ll_descr, LIST, 'length') -itemsdescr = get_field_descr(self.gc_ll_descr, LIST, 'items') -arraydescr = get_array_descr(self.gc_ll_descr, ARRAY) -resize_ptr = ConstInt(123) -extrainfo = EffectInfo(None, None, None, None, - extraeffect=EffectInfo.EF_RANDOM_EFFECTS, - oopspecindex=EffectInfo.OS_LIST_RESIZE_GE, - extra_descrs=[lendescr, itemsdescr, arraydescr, - resize_ptr]) -list_resize_descr = get_call_descr(self.gc_ll_descr, - [lltype.Ptr(LIST), lltype.Signed], - lltype.Void, extrainfo) -extrainfo.extra_descrs.append(list_resize_descr) - namespace.update(locals()) # for funcname in self.gc_ll_descr._generated_functions: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stmgc-c4: make jitviewer show rewritten trace
Author: Remi Meier Branch: stmgc-c4 Changeset: r65640:cea9abd542dc Date: 2013-07-25 12:01 +0200 http://bitbucket.org/pypy/pypy/changeset/cea9abd542dc/ Log:make jitviewer show rewritten trace diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py --- a/pypy/tool/jitlogparser/parser.py +++ b/pypy/tool/jitlogparser/parser.py @@ -452,6 +452,7 @@ mapping[loop.descr] = loop for line in lines: if line: +line = purge_thread_numbers(line) num, count = line.split(':', 2) mapping[num].count = int(count) 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 @@ -517,9 +517,9 @@ clt.allgcrefs = [] clt.frame_info.clear() # for now -# if log: -# operations = self._inject_debugging_code(looptoken, operations, -# 'e', looptoken.number) +if log: +operations = self._inject_debugging_code(looptoken, operations, + 'e', looptoken.number) regalloc = RegAlloc(self, self.cpu.translate_support_code) # @@ -568,7 +568,7 @@ self.cpu.profile_agent.native_code_written(name, rawstart, full_size) return AsmInfo(ops_offset, rawstart + looppos, - size_excluding_failure_stuff - looppos) + size_excluding_failure_stuff - looppos), operations def assemble_bridge(self, faildescr, inputargs, operations, original_loop_token, log, logger=None): @@ -578,9 +578,9 @@ self.setup(original_loop_token) descr_number = compute_unique_id(faildescr) -# if log: -# operations = self._inject_debugging_code(faildescr, operations, -# 'b', descr_number) +if log: +operations = self._inject_debugging_code(faildescr, operations, + 'b', descr_number) arglocs = self.rebuild_faillocs_from_descr(faildescr, inputargs) regalloc = RegAlloc(self, self.cpu.translate_support_code) @@ -615,7 +615,9 @@ name = "Bridge # %s" % (descr_number,) self.cpu.profile_agent.native_code_written(name, rawstart, fullsize) -return AsmInfo(ops_offset, startpos + rawstart, codeendpos - startpos) +return AsmInfo(ops_offset, startpos + rawstart, + codeendpos - startpos), operations + def write_pending_failure_recoveries(self): # for each pending guard, generate the code of the recovery stub diff --git a/rpython/jit/metainterp/compile.py b/rpython/jit/metainterp/compile.py --- a/rpython/jit/metainterp/compile.py +++ b/rpython/jit/metainterp/compile.py @@ -343,9 +343,9 @@ metainterp_sd.profiler.start_backend() debug_start("jit-backend") try: -asminfo = do_compile_loop(metainterp_sd, loop.inputargs, - operations, original_jitcell_token, - name=loopname) +asminfo, new_ops = do_compile_loop(metainterp_sd, loop.inputargs, + operations, original_jitcell_token, + name=loopname) finally: debug_stop("jit-backend") metainterp_sd.profiler.end_backend() @@ -361,7 +361,7 @@ ops_offset = asminfo.ops_offset else: ops_offset = None -metainterp_sd.logger_ops.log_loop(loop.inputargs, loop.operations, n, +metainterp_sd.logger_ops.log_loop(loop.inputargs, new_ops, n, type, ops_offset, name=loopname) # @@ -387,9 +387,9 @@ metainterp_sd.profiler.start_backend() debug_start("jit-backend") try: -asminfo = do_compile_bridge(metainterp_sd, faildescr, inputargs, -operations, -original_loop_token) +asminfo, new_ops = do_compile_bridge(metainterp_sd, faildescr, + inputargs, operations, + original_loop_token) finally: debug_stop("jit-backend") metainterp_sd.profiler.end_backend() @@ -404,7 +404,7 @@ ops_offset = asminfo.ops_offset else: ops_offset = None -metainterp_sd.logger_ops.log_bridge(inputargs, operations, None, faildescr, +metainterp_sd.logger_ops.log_bridge(inputargs, new_ops, None, faildescr, ops_offset) # #if metainterp_sd.warmrunnerdesc is not None:#
[pypy-commit] pypy release-2.1.x: added statvfs_result to posix
Author: Alex Gaynor Branch: release-2.1.x Changeset: r65641:fde1203a425d Date: 2013-07-19 15:23 -0700 http://bitbucket.org/pypy/pypy/changeset/fde1203a425d/ Log:added statvfs_result to posix (transplanted from b95b5d21340327350a770cf5f4c0f5b2fc4ebf09) diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py --- a/pypy/module/posix/__init__.py +++ b/pypy/module/posix/__init__.py @@ -35,6 +35,7 @@ appleveldefs = { 'error' : 'app_posix.error', 'stat_result': 'app_posix.stat_result', +'statvfs_result': 'app_posix.statvfs_result', 'fdopen' : 'app_posix.fdopen', 'tmpfile': 'app_posix.tmpfile', 'popen' : 'app_posix.popen', diff --git a/pypy/module/posix/app_posix.py b/pypy/module/posix/app_posix.py --- a/pypy/module/posix/app_posix.py +++ b/pypy/module/posix/app_posix.py @@ -65,6 +65,23 @@ if self.st_ctime is None: self.__dict__['st_ctime'] = self[9] + +class statvfs_result: +__metaclass__ = structseqtype + +name = osname + ".statvfs_result" + +f_bsize = structseqfield(0) +f_frsize = structseqfield(1) +f_blocks = structseqfield(2) +f_bfree = structseqfield(3) +f_bavail = structseqfield(4) +f_files = structseqfield(5) +f_ffree = structseqfield(6) +f_favail = structseqfield(7) +f_flag = structseqfield(8) +f_namemax = structseqfield(9) + if osname == 'posix': # POSIX: we want to check the file descriptor when fdopen() is called, # not later when we read or write data. So we call fstat(), letting ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stmgc-c4: let jitviewer show symbol names for addresses (like viewcode.py)
Author: Remi Meier Branch: stmgc-c4 Changeset: r65642:71e70dc573d8 Date: 2013-07-25 12:42 +0200 http://bitbucket.org/pypy/pypy/changeset/71e70dc573d8/ Log:let jitviewer show symbol names for addresses (like viewcode.py) diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py --- a/pypy/tool/jitlogparser/parser.py +++ b/pypy/tool/jitlogparser/parser.py @@ -4,6 +4,8 @@ from rpython.jit.tool.oparser import OpParser from rpython.tool.logparser import parse_log_file, extract_category from copy import copy +from rpython.jit.backend.tool.viewcode import (machine_code_dump, load_symbols, + lineaddresses) def parse_code_data(arg): name = None @@ -74,7 +76,7 @@ use_mock_model = True def postprocess(self, loop, backend_dump=None, backend_tp=None, -dump_start=0): +dump_start=0, symbols=None): if backend_dump is not None: raw_asm = self._asm_disassemble(backend_dump.decode('hex'), backend_tp, dump_start) @@ -89,8 +91,15 @@ if not start: start = int(adr.strip(":"), 16) ofs = int(adr.strip(":"), 16) - start +# add symbols to addresses: +for addr in lineaddresses(v): +sym = symbols.get(addr) +if sym: +v = '%s\t%s\n' % (v.rstrip(), + sym.replace('\xb7', '')) if ofs >= 0: asm.append((ofs, v.strip("\n"))) +# asm_index = 0 for i, op in enumerate(loop.operations): end = 0 @@ -113,7 +122,6 @@ return loop def _asm_disassemble(self, d, origin_addr, tp): -from rpython.jit.backend.tool.viewcode import machine_code_dump return list(machine_code_dump(d, tp, origin_addr)) @classmethod @@ -387,15 +395,22 @@ addr = int(m.group(1), 16) addrs.setdefault(addr, []).append(name) dumps = {} +executables = set() +symbols = {} for entry in extract_category(log, 'jit-backend-dump'): entry = purge_thread_numbers(entry) -backend, _, dump, _ = entry.split("\n") +backend, executable, dump, _ = entry.split("\n") +_, executable = executable.split(" ") +if executable not in executables: +symbols.update(load_symbols(executable)) +executables.add(executable) _, addr, _, data = re.split(" +", dump) backend_name = backend.split(" ")[1] addr = int(addr[1:], 16) if addr in addrs and addrs[addr]: name = addrs[addr].pop(0) # they should come in order dumps[name] = (backend_name, addr, data) + loops = [] for entry in extract_category(log, 'jit-log-opt'): parser = ParserCls(entry, None, {}, 'lltype', None, @@ -416,7 +431,8 @@ bname=bname, loop=loop: parser.postprocess(loop, backend_tp=bname, backend_dump=dump, - dump_start=start_ofs)) + dump_start=start_ofs, + symbols=symbols)) loops += split_trace(loop) return log, loops diff --git a/rpython/jit/backend/tool/viewcode.py b/rpython/jit/backend/tool/viewcode.py --- a/rpython/jit/backend/tool/viewcode.py +++ b/rpython/jit/backend/tool/viewcode.py @@ -205,7 +205,8 @@ for addr in lineaddresses(line): sym = symbols.get(addr) if sym: -lines[i] = '%s\t%s\n' % (lines[i].rstrip(), sym) +lines[i] = '%s\t%s\n' % (lines[i].rstrip(), + str(sym).strip('\xb7')) self.text = ''.join(lines) return self.text ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] extradoc extradoc: add me & friend to london sprint
Author: Remi Meier Branch: extradoc Changeset: r5008:2be03f146718 Date: 2013-07-25 12:49 +0200 http://bitbucket.org/pypy/extradoc/changeset/2be03f146718/ Log:add me & friend to london sprint diff --git a/sprintinfo/london-2013/people.txt b/sprintinfo/london-2013/people.txt --- a/sprintinfo/london-2013/people.txt +++ b/sprintinfo/london-2013/people.txt @@ -17,6 +17,8 @@ Edd Barrett ? ? Armin Rigo ? ? Richard Emslie 25/8-2/9 some hotel +Remi Meier 24/8-1/9 ? +Marko Bencun 24/8-1/9 ? == === ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-ootype: Remove oosend support from translator.backendopt
Author: Ronan Lamy Branch: kill-ootype Changeset: r65643:5168fe5f82b9 Date: 2013-07-25 13:42 +0200 http://bitbucket.org/pypy/pypy/changeset/5168fe5f82b9/ Log:Remove oosend support from translator.backendopt diff --git a/rpython/translator/backendopt/canraise.py b/rpython/translator/backendopt/canraise.py --- a/rpython/translator/backendopt/canraise.py +++ b/rpython/translator/backendopt/canraise.py @@ -20,10 +20,6 @@ fnobj = op.args[0].value._obj return getattr(fnobj, 'canraise', True) -def analyze_external_method(self, op, TYPE, meth): -assert op.opname == 'oosend' -return getattr(meth, '_can_raise', True) - def analyze_exceptblock(self, block, seen=None): return True diff --git a/rpython/translator/backendopt/graphanalyze.py b/rpython/translator/backendopt/graphanalyze.py --- a/rpython/translator/backendopt/graphanalyze.py +++ b/rpython/translator/backendopt/graphanalyze.py @@ -63,9 +63,6 @@ result, self.analyze_direct_call(graph, seen)) return result -def analyze_external_method(self, op, TYPE, meth): -return self.top_result() - def analyze_link(self, graph, link): return self.bottom_result() @@ -96,14 +93,6 @@ if self.verbose and x: self.dump_info('analyze_indirect_call(%s): %r' % (graphs, x)) return x -elif op.opname == "oosend": -name = op.args[0].value -TYPE = op.args[1].concretetype -_, meth = TYPE._lookup(name) -graph = getattr(meth, 'graph', None) -if graph is None: -return self.analyze_external_method(op, TYPE, meth) -return self.analyze_oosend(TYPE, name, seen) x = self.analyze_simple_operation(op, graphinfo) if self.verbose and x: self.dump_info('%s: %r' % (op, x)) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy refactor-str-types: Try to use interpindirect2app.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65644:a2881bd0264c Date: 2013-07-25 15:27 +0200 http://bitbucket.org/pypy/pypy/changeset/a2881bd0264c/ Log:Try to use interpindirect2app. diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -3,7 +3,7 @@ from pypy.interpreter.baseobjspace import ObjSpace, W_Root from pypy.interpreter.buffer import RWBuffer from pypy.interpreter.error import OperationError, operationerrfmt -from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault +from pypy.interpreter.gateway import interp2app, interpindirect2app, unwrap_spec, WrappedDefault from pypy.interpreter.signature import Signature from pypy.objspace.std import bytesobject from pypy.objspace.std.intobject import W_IntObject @@ -427,58 +427,58 @@ __repr__ = interp2app(W_BytearrayObject.descr_repr), __str__ = interp2app(W_BytearrayObject.descr_str), -__eq__ = interp2app(W_BytearrayObject.descr_eq), -__ne__ = interp2app(W_BytearrayObject.descr_ne), -__lt__ = interp2app(W_BytearrayObject.descr_lt), -__le__ = interp2app(W_BytearrayObject.descr_le), -__gt__ = interp2app(W_BytearrayObject.descr_gt), -__ge__ = interp2app(W_BytearrayObject.descr_ge), +__eq__ = interpindirect2app(W_BytearrayObject.descr_eq), +__ne__ = interpindirect2app(W_BytearrayObject.descr_ne), +__lt__ = interpindirect2app(W_BytearrayObject.descr_lt), +__le__ = interpindirect2app(W_BytearrayObject.descr_le), +__gt__ = interpindirect2app(W_BytearrayObject.descr_gt), +__ge__ = interpindirect2app(W_BytearrayObject.descr_ge), -__len__ = interp2app(W_BytearrayObject.descr_len), -__contains__ = interp2app(W_BytearrayObject.descr_contains), +__len__ = interpindirect2app(W_BytearrayObject.descr_len), +__contains__ = interpindirect2app(W_BytearrayObject.descr_contains), -__add__ = interp2app(W_BytearrayObject.descr_add), -__mul__ = interp2app(W_BytearrayObject.descr_mul), -__rmul__ = interp2app(W_BytearrayObject.descr_mul), +__add__ = interpindirect2app(W_BytearrayObject.descr_add), +__mul__ = interpindirect2app(W_BytearrayObject.descr_mul), +__rmul__ = interpindirect2app(W_BytearrayObject.descr_mul), -__getitem__ = interp2app(W_BytearrayObject.descr_getitem), +__getitem__ = interpindirect2app(W_BytearrayObject.descr_getitem), -capitalize = interp2app(W_BytearrayObject.descr_capitalize), -center = interp2app(W_BytearrayObject.descr_center), -count = interp2app(W_BytearrayObject.descr_count), -decode = interp2app(W_BytearrayObject.descr_decode), -expandtabs = interp2app(W_BytearrayObject.descr_expandtabs), -find = interp2app(W_BytearrayObject.descr_find), -rfind = interp2app(W_BytearrayObject.descr_rfind), -index = interp2app(W_BytearrayObject.descr_index), -rindex = interp2app(W_BytearrayObject.descr_rindex), -isalnum = interp2app(W_BytearrayObject.descr_isalnum), -isalpha = interp2app(W_BytearrayObject.descr_isalpha), -isdigit = interp2app(W_BytearrayObject.descr_isdigit), -islower = interp2app(W_BytearrayObject.descr_islower), -isspace = interp2app(W_BytearrayObject.descr_isspace), -istitle = interp2app(W_BytearrayObject.descr_istitle), -isupper = interp2app(W_BytearrayObject.descr_isupper), -join = interp2app(W_BytearrayObject.descr_join), -ljust = interp2app(W_BytearrayObject.descr_ljust), -rjust = interp2app(W_BytearrayObject.descr_rjust), -lower = interp2app(W_BytearrayObject.descr_lower), -partition = interp2app(W_BytearrayObject.descr_partition), -rpartition = interp2app(W_BytearrayObject.descr_rpartition), -replace = interp2app(W_BytearrayObject.descr_replace), -split = interp2app(W_BytearrayObject.descr_split), -rsplit = interp2app(W_BytearrayObject.descr_rsplit), -splitlines = interp2app(W_BytearrayObject.descr_splitlines), -startswith = interp2app(W_BytearrayObject.descr_startswith), -endswith = interp2app(W_BytearrayObject.descr_endswith), -strip = interp2app(W_BytearrayObject.descr_strip), -lstrip = interp2app(W_BytearrayObject.descr_lstrip), -rstrip = interp2app(W_BytearrayObject.descr_rstrip), -swapcase = interp2app(W_BytearrayObject.descr_swapcase), -title = interp2app(W_BytearrayObject.descr_title), -translate = interp2app(W_BytearrayObject.descr_translate), -upper = interp2app(W_BytearrayObject.descr_upper), -zfill = interp2app(W_BytearrayObject.descr_zfill), +capitalize = interpindirect2app(W_BytearrayObject.descr_capitalize), +center = interpindirect2app(W_BytearrayObject.descr_center), +count = interpindirect2app(W_BytearrayObject.descr_count), +decode = interpindirect2app(W_BytearrayObject.descr_decode), +expandtabs = interpindirect2app(W_BytearrayObject.descr_expandtabs), +find = interpindirect2a
[pypy-commit] pypy default: skip test_statvfs if statvfs is not available
Author: David Schneider Branch: Changeset: r65646:e02836bd3823 Date: 2013-07-25 15:55 +0200 http://bitbucket.org/pypy/pypy/changeset/e02836bd3823/ Log:skip test_statvfs if statvfs is not available diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -184,14 +184,15 @@ assert isinstance(e, WindowsError) assert e.winerror == 3 -def test_statvfs(self): -st = self.posix.statvfs(".") -assert isinstance(st, self.posix.statvfs_result) -for field in [ -'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail', -'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax', -]: -assert hasattr(st, field) +if hasattr(__import__(os.name), "statvfs"): +def test_statvfs(self): +st = self.posix.statvfs(".") +assert isinstance(st, self.posix.statvfs_result) +for field in [ +'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail', +'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax', +]: +assert hasattr(st, field) def test_pickle(self): import pickle, os ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: update relase notes for 2.1 beta2
Author: David Schneider Branch: Changeset: r65645:46dbb7a9edb2 Date: 2013-07-25 15:43 +0200 http://bitbucket.org/pypy/pypy/changeset/46dbb7a9edb2/ Log:update relase notes for 2.1 beta2 diff --git a/pypy/doc/release-2.1.0-beta2.rst b/pypy/doc/release-2.1.0-beta2.rst --- a/pypy/doc/release-2.1.0-beta2.rst +++ b/pypy/doc/release-2.1.0-beta2.rst @@ -3,14 +3,16 @@ === We're pleased to announce the second beta of the upcoming 2.1 release of PyPy. -This beta does not add any new features to the 2.1 release, but contains several bugfixes listed below. +This beta adds one new feature to the 2.1 release and contains several bugfixes listed below. Highlights == +* Support for os.statvfs and os.fstatvfs on unix systems. + * Fixed issue `1533`_: fix an RPython-level OverflowError for space.float_w(w_big_long_number). -* Fixed issue `1552`_: GreenletExit should inherit from BaseException +* Fixed issue `1552`_: GreenletExit should inherit from BaseException. * Fixed issue `1537`_: numpypy __array_interface__ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy release-2.1.x: Added tag release-2.1-beta2 for changeset 06f936c49498
Author: David Schneider Branch: release-2.1.x Changeset: r65648:cfa007494f7f Date: 2013-07-25 16:35 +0200 http://bitbucket.org/pypy/pypy/changeset/cfa007494f7f/ Log:Added tag release-2.1-beta2 for changeset 06f936c49498 diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -8,3 +8,4 @@ a0e2bc9ceccdd7e734d4c881a051320441ea5200 pypy-2.1-beta a0e2bc9ceccdd7e734d4c881a051320441ea5200 pypy-2.1-beta daf1b0412bfbd0666c19d567e37b29e4a3be5734 pypy-2.1-beta +06f936c494985d62764937336f65cb0131a4e3b6 release-2.1-beta2 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy release-2.1.x: skip test_statvfs if statvfs is not available
Author: David Schneider Branch: release-2.1.x Changeset: r65647:06f936c49498 Date: 2013-07-25 15:55 +0200 http://bitbucket.org/pypy/pypy/changeset/06f936c49498/ Log:skip test_statvfs if statvfs is not available (transplanted from e02836bd3823d5c3db5b2dea56fba55f8e15094f) diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py --- a/pypy/module/posix/test/test_posix2.py +++ b/pypy/module/posix/test/test_posix2.py @@ -184,14 +184,15 @@ assert isinstance(e, WindowsError) assert e.winerror == 3 -def test_statvfs(self): -st = self.posix.statvfs(".") -assert isinstance(st, self.posix.statvfs_result) -for field in [ -'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail', -'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax', -]: -assert hasattr(st, field) +if hasattr(__import__(os.name), "statvfs"): +def test_statvfs(self): +st = self.posix.statvfs(".") +assert isinstance(st, self.posix.statvfs_result) +for field in [ +'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail', +'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax', +]: +assert hasattr(st, field) def test_pickle(self): import pickle, os ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy stmgc-c4: add first part of a fastpath to stm_read_barrier (makes targettlc slower)
Author: Remi Meier Branch: stmgc-c4 Changeset: r65649:5f5f1a605cb3 Date: 2013-07-25 17:02 +0200 http://bitbucket.org/pypy/pypy/changeset/5f5f1a605cb3/ Log:add first part of a fastpath to stm_read_barrier (makes targettlc slower) 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 @@ -35,6 +35,8 @@ from rpython.rlib.rarithmetic import intmask, r_uint from rpython.rlib.objectmodel import compute_unique_id from rpython.jit.backend.x86 import stmtlocal +from rpython.rlib import rstm +from rpython.memory.gc.stmgc import StmGC class Assembler386(BaseAssembler): @@ -517,9 +519,9 @@ clt.allgcrefs = [] clt.frame_info.clear() # for now -if log: -operations = self._inject_debugging_code(looptoken, operations, - 'e', looptoken.number) +# if log: +# operations = self._inject_debugging_code(looptoken, operations, +# 'e', looptoken.number) regalloc = RegAlloc(self, self.cpu.translate_support_code) # @@ -578,9 +580,9 @@ self.setup(original_loop_token) descr_number = compute_unique_id(faildescr) -if log: -operations = self._inject_debugging_code(faildescr, operations, - 'b', descr_number) +# if log: +# operations = self._inject_debugging_code(faildescr, operations, +# 'b', descr_number) arglocs = self.rebuild_faillocs_from_descr(faildescr, inputargs) regalloc = RegAlloc(self, self.cpu.translate_support_code) @@ -2180,27 +2182,49 @@ assert isinstance(result_loc, RegLoc) mc.POP_r(result_loc.value) +def _get_private_rev_num_addr(self): +assert self.cpu.gc_ll_descr.stm +rn = rstm.get_adr_of_private_rev_num() +rn = rn - stmtlocal.threadlocal_base() +assert rx86.fits_in_32bits(rn) +return rn def _stm_barrier_fastpath(self, mc, descr, arglocs, is_frame=False, align_stack=False): assert self.cpu.gc_ll_descr.stm -from rpython.jit.backend.llsupport.gc import STMBarrierDescr +from rpython.jit.backend.llsupport.gc import ( +STMBarrierDescr, STMReadBarrierDescr, STMWriteBarrierDescr) assert isinstance(descr, STMBarrierDescr) assert descr.returns_modified_object loc_base = arglocs[0] assert isinstance(loc_base, RegLoc) -# Write only a CALL to the helper prepared in advance, passing it as -# argument the address of the structure we are writing into -# (the first argument to COND_CALL_GC_WB). + helper_num = 0 if is_frame: helper_num = 4 elif self._regalloc is not None and self._regalloc.xrm.reg_bindings: helper_num += 2 # +# FASTPATH: +# +rn = self._get_private_rev_num_addr() +if isinstance(descr, STMReadBarrierDescr): +# (obj->h_revision != stm_private_rev_num) +# && (FXCACHE_AT(obj) != obj))) +stmtlocal.tl_segment_prefix(mc) +#mc.CMP_jr(rn, loc_base.value) +mc.MOV_rj(X86_64_SCRATCH_REG.value, rn) +mc.CMP(X86_64_SCRATCH_REG, mem(loc_base, StmGC.H_REVISION)) +mc.J_il8(rx86.Conditions['Z'], 0) # patched below +jz_location = mc.get_relative_pos() +else: +jz_location = 0 +# +# SLOWPATH_START +# if not is_frame: mc.PUSH(loc_base) -if is_frame and align_stack: +elif is_frame and align_stack: # ||retadr| mc.SUB_ri(esp.value, 16 - WORD) # erase the return address # ||retadr|...|| @@ -2214,10 +2238,15 @@ # result where argument was: mc.POP_r(loc_base.value) - if is_frame and align_stack: mc.ADD_ri(esp.value, 16 - WORD) # erase the return address - +# +# SLOWPATH_END +# +if isinstance(descr, STMReadBarrierDescr): +offset = mc.get_relative_pos() - jz_location +assert 0 < offset <= 127 +mc.overwrite(jz_location - 1, chr(offset)) diff --git a/rpython/rlib/rstm.py b/rpython/rlib/rstm.py --- a/rpython/rlib/rstm.py +++ b/rpython/rlib/rstm.py @@ -3,6 +3,9 @@ from rpython.rtyper.lltypesystem.lloperation import llop from rpython.rtyper.extregistry import ExtRegistryEntry +def get_adr_of_private_rev_num(): +addr = llop.stm_get_adr_of_private_rev_num(llmemory.Address) +return rffi.cast(lltype.Signed, addr) def become_inevitable(): llop.stm_become_inevitable(llty
[pypy-commit] pypy kill-ootype: Fix/hack handling of delayed pointers in getgraph()
Author: Ronan Lamy Branch: kill-ootype Changeset: r65650:76a086e7dd24 Date: 2013-07-25 16:03 +0100 http://bitbucket.org/pypy/pypy/changeset/76a086e7dd24/ Log:Fix/hack handling of delayed pointers in getgraph() diff --git a/rpython/translator/backendopt/graphanalyze.py b/rpython/translator/backendopt/graphanalyze.py --- a/rpython/translator/backendopt/graphanalyze.py +++ b/rpython/translator/backendopt/graphanalyze.py @@ -1,3 +1,4 @@ +from rpython.rtyper.lltypesystem.lltype import DelayedPointer from rpython.translator.simplify import get_graph from rpython.tool.algo.unionfind import UnionFind @@ -52,7 +53,10 @@ return self.bottom_result() def analyze_external_call(self, op, seen=None): -funcobj = op.args[0].value._obj +try: +funcobj = op.args[0].value._obj +except DelayedPointer: +return self.bottom_result() result = self.bottom_result() if hasattr(funcobj, '_callbacks'): bk = self.translator.annotator.bookkeeper diff --git a/rpython/translator/simplify.py b/rpython/translator/simplify.py --- a/rpython/translator/simplify.py +++ b/rpython/translator/simplify.py @@ -20,7 +20,10 @@ f = arg.value if not isinstance(f, lltype._ptr): return None -funcobj = f._obj +try: +funcobj = f._getobj() +except lltype.DelayedPointer: +return None try: callable = funcobj._callable except (AttributeError, KeyError, AssertionError): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: In-progress: refactor gcpage.visit() and related code
Author: Armin Rigo Branch: copy-over-original2 Changeset: r435:d86ab3aa636d Date: 2013-07-25 17:24 +0200 http://bitbucket.org/pypy/stmgc/changeset/d86ab3aa636d/ Log:In-progress: refactor gcpage.visit() and related code diff --git a/c4/et.h b/c4/et.h --- a/c4/et.h +++ b/c4/et.h @@ -67,7 +67,7 @@ static const revision_t GCFLAG_PREBUILT_ORIGINAL = STM_FIRST_GCFLAG << 3; static const revision_t GCFLAG_PUBLIC_TO_PRIVATE = STM_FIRST_GCFLAG << 4; // in stmgc.h: GCFLAG_WRITE_BARRIER = STM_FIRST_GCFLAG << 5; -static const revision_t GCFLAG_MOVED = STM_FIRST_GCFLAG << 6; +static const revision_t GCFLAG_MOVED = STM_FIRST_GCFLAG << 6; static const revision_t GCFLAG_BACKUP_COPY /*debug*/ = STM_FIRST_GCFLAG << 7; static const revision_t GCFLAG_STUB /*debug*/ = STM_FIRST_GCFLAG << 8; static const revision_t GCFLAG_PRIVATE_FROM_PROTECTED = STM_FIRST_GCFLAG << 9; diff --git a/c4/gcpage.c b/c4/gcpage.c --- a/c4/gcpage.c +++ b/c4/gcpage.c @@ -212,35 +212,160 @@ static struct GcPtrList objects_to_trace; -static void keep_original_alive(gcptr obj) +static gcptr copy_over_original(gcptr obj, gcptr id_copy) { -/* keep alive the original of a visited object */ -gcptr id_copy = (gcptr)obj->h_original; -/* prebuilt original objects may have a predifined - hash in h_original */ -if (id_copy && !(obj->h_tid & GCFLAG_PREBUILT_ORIGINAL)) { -assert(id_copy->h_tid & GCFLAG_PUBLIC); -if (!(id_copy->h_tid & GCFLAG_PREBUILT_ORIGINAL)) { -id_copy->h_tid &= ~GCFLAG_PUBLIC_TO_PRIVATE; -/* see fix_outdated() */ -if (!(id_copy->h_tid & GCFLAG_VISITED)) { -id_copy->h_tid |= GCFLAG_VISITED; -assert(!(id_copy->h_tid & GCFLAG_MOVED)); +assert(obj != id_copy); +assert(!(id_copy->h_revision & 1)); /* not head-revision itself */ -/* XXX: may not always need tracing? */ -if (!(id_copy->h_tid & GCFLAG_STUB)) -gcptrlist_insert(&objects_to_trace, id_copy); +/* check a few flags */ +assert(obj->h_tid & GCFLAG_PUBLIC); +assert(!(obj->h_tid & GCFLAG_PREBUILT_ORIGINAL)); +assert(!(obj->h_tid & GCFLAG_BACKUP_COPY)); + +assert(id_copy->h_tid & GCFLAG_PUBLIC); +assert(!(id_copy->h_tid & GCFLAG_BACKUP_COPY)); + +/* id_copy may be a stub, but in this case, as the original, it + should have been allocated with a big enough chunk of memory. + Also, obj itself might be a stub. */ +assert(!(id_copy->h_tid & GCFLAG_SMALLSTUB)); +if (!(id_copy->h_tid & GCFLAG_STUB) && !(obj->h_tid & GCFLAG_STUB)) { +assert(stmgc_size(id_copy) == stmgc_size(obj)); +} + +/* add the MOVED flag to 'obj' */ +obj->h_tid |= GCFLAG_MOVED; + +/* copy the object's content */ +dprintf(("copy %p over %p\n", obj, id_copy)); +memcpy(id_copy + 1, obj + 1, stmgc_size(obj) - sizeof(struct stm_object_s)); + +/* copy the object's h_revision number */ +id_copy->h_revision = obj->h_revision; + +/* copy the STUB flag */ +id_copy->h_tid &= ~GCFLAG_STUB; +id_copy->h_tid |= (obj->h_tid & GCFLAG_STUB); + +return id_copy; +} + +static void visit_nonpublic(gcptr obj) +{ +assert(!(obj->h_tid & GCFLAG_PUBLIC)); +assert(!(obj->h_tid & GCFLAG_STUB)); +assert(!(obj->h_tid & GCFLAG_HAS_ID)); +assert(!(obj->h_tid & GCFLAG_SMALLSTUB)); +assert(!(obj->h_tid & GCFLAG_MOVED)); + +if (obj->h_tid & GCFLAG_VISITED) +return;/* already visited */ + +obj->h_tid |= GCFLAG_VISITED; +gcptrlist_insert(&objects_to_trace, obj); +} + +static gcptr visit_public(gcptr obj) +{ +/* The goal is to walk to the most recent copy, then copy its + content back into the h_original, and finally returns this + h_original. +*/ +gcptr original; +if (obj->h_original != 0 && +!(obj->h_tid & GCFLAG_PREBUILT_ORIGINAL)) +original = (gcptr)obj->h_original; +else +original = obj; + +/* the original object must also be a public object, and cannot + be a small stub. */ +assert(original->h_tid & GCFLAG_PUBLIC); +assert(!(original->h_tid & GCFLAG_SMALLSTUB)); + +assert(!(obj->h_tid & GCFLAG_BACKUP_COPY)); +assert(!(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED)); +assert(!(original->h_tid & GCFLAG_BACKUP_COPY)); +assert(!(original->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED)); + +/* if 'original' was already visited, we are done */ +if (original->h_tid & GCFLAG_VISITED) +return original; + +/* walk to the head of the chained list */ +while (IS_POINTER(obj->h_revision)) { +if (!(obj->h_revision & 2)) { +obj = (gcptr)obj->h_revision; +assert(obj->h_tid & GCFLAG_PUBLIC); +continue; +} + +/* it's a stub: check the current stealing status */ +assert(obj->h_tid & GCFLAG_STUB); +gcptr obj2 = (
[pypy-commit] stmgc copy-over-original2: Some fixes
Author: Armin Rigo Branch: copy-over-original2 Changeset: r436:e007ec3d53f3 Date: 2013-07-25 17:29 +0200 http://bitbucket.org/pypy/stmgc/changeset/e007ec3d53f3/ Log:Some fixes diff --git a/c4/gcpage.c b/c4/gcpage.c --- a/c4/gcpage.c +++ b/c4/gcpage.c @@ -332,8 +332,10 @@ } else { /* the stub target is just a protected object. - The head of the public chain is obj. */ + The head of the public chain is obj. We have to + explicitly keep obj2 alive. */ assert(!IS_POINTER(obj2->h_revision)); +visit_nonpublic(obj2); break; } } @@ -355,7 +357,7 @@ survived. */ gcptr obj = *pobj; -if (obj == NULL); +if (obj == NULL) return; if (!(obj->h_tid & GCFLAG_PUBLIC)) { ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: Fix the test
Author: Armin Rigo Branch: copy-over-original2 Changeset: r437:3afacc15e34b Date: 2013-07-25 17:30 +0200 http://bitbucket.org/pypy/stmgc/changeset/3afacc15e34b/ Log:Fix the test diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py --- a/c4/test/test_gcpage.py +++ b/c4/test/test_gcpage.py @@ -193,12 +193,12 @@ major_collect() major_collect() p1b = lib.stm_pop_root() -assert p1b == p2 -check_free_old(p1) -check_not_free(p2) -p3 = lib.stm_write_barrier(p2) -assert p3 != p2 -assert p3 == lib.stm_write_barrier(p2) +assert p1b == p1 +check_not_free(p1) +check_free_old(p2) +p3 = lib.stm_write_barrier(p1) +assert p3 != p1 +assert p3 == lib.stm_write_barrier(p1) def test_new_version_id_alive(): p1 = oalloc(HDR); make_public(p1) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: More fixes in the tests
Author: Armin Rigo Branch: copy-over-original2 Changeset: r438:f6b4d8cafc3e Date: 2013-07-25 17:35 +0200 http://bitbucket.org/pypy/stmgc/changeset/f6b4d8cafc3e/ Log:More fixes in the tests diff --git a/c4/test/support.py b/c4/test/support.py --- a/c4/test/support.py +++ b/c4/test/support.py @@ -589,6 +589,12 @@ p1.h_tid |= GCFLAG_PUBLIC_TO_PRIVATE if p1.h_tid & GCFLAG_PREBUILT_ORIGINAL: lib.stm_add_prebuilt_root(p1) +assert p2.h_original == 0 +assert p1 != p2 +if (p1.h_original == 0) or (p1.h_tid & GCFLAG_PREBUILT_ORIGINAL): +p2.h_original = ffi.cast("revision_t", p1) +else: +p2.h_original = p1.h_original def delegate_original(p1, p2): # no h_original or it is a prebuilt with a specified hash in h_original diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py --- a/c4/test/test_gcpage.py +++ b/c4/test/test_gcpage.py @@ -204,7 +204,6 @@ p1 = oalloc(HDR); make_public(p1) p2 = oalloc(HDR); make_public(p2) delegate(p1, p2) -delegate_original(p1, p2) lib.stm_push_root(p1) major_collect() major_collect() @@ -226,14 +225,14 @@ major_collect() major_collect() p2b = lib.stm_pop_root() -assert p2b == p4 -check_free_old(p1) +assert p2b == p1 +check_not_free(p1) check_free_old(p2) check_free_old(p3) -check_not_free(p4) -p5 = lib.stm_write_barrier(p4) -assert p5 != p4 -assert p5 == lib.stm_write_barrier(p4) +check_free_old(p4) +p5 = lib.stm_write_barrier(p1) +assert p5 != p1 +assert p5 == lib.stm_write_barrier(p1) assert p5 == lib.stm_write_barrier(p5) def test_new_version_kill_intermediate_non_root(): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: More test fixes
Author: Armin Rigo Branch: copy-over-original2 Changeset: r439:c00f65b25cce Date: 2013-07-25 17:39 +0200 http://bitbucket.org/pypy/stmgc/changeset/c00f65b25cce/ Log:More test fixes diff --git a/c4/test/support.py b/c4/test/support.py --- a/c4/test/support.py +++ b/c4/test/support.py @@ -589,22 +589,16 @@ p1.h_tid |= GCFLAG_PUBLIC_TO_PRIVATE if p1.h_tid & GCFLAG_PREBUILT_ORIGINAL: lib.stm_add_prebuilt_root(p1) +# no h_original or it is a prebuilt with a specified hash in h_original assert p2.h_original == 0 assert p1 != p2 +assert p1.h_tid & GCFLAG_OLD +assert p2.h_tid & GCFLAG_OLD if (p1.h_original == 0) or (p1.h_tid & GCFLAG_PREBUILT_ORIGINAL): p2.h_original = ffi.cast("revision_t", p1) else: p2.h_original = p1.h_original -def delegate_original(p1, p2): -# no h_original or it is a prebuilt with a specified hash in h_original -assert (p1.h_original == 0) or (p1.h_tid & GCFLAG_PREBUILT_ORIGINAL) -assert p1.h_tid & GCFLAG_OLD -assert p2.h_original == 0 -assert p1 != p2 -p2.h_original = ffi.cast("revision_t", p1) - - def make_public(p1): """Hack at an object returned by oalloc() to force it public.""" assert classify(p1) == "protected" diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py --- a/c4/test/test_gcpage.py +++ b/c4/test/test_gcpage.py @@ -250,41 +250,43 @@ major_collect() lib.stm_pop_root() check_not_free(p1) -check_free_old(p2) +check_not_free(p2) check_free_old(p3) check_free_old(p4) -check_not_free(p5) +check_free_old(p5) print 'p1:', p1 print ' containing:', rawgetptr(p1, 0) print 'p2:', p2 print 'p3:', p3 print 'p4:', p4 print 'p5:', p5 -assert rawgetptr(p1, 0) == p5 +assert rawgetptr(p1, 0) == p2 def test_new_version_not_kill_intermediate_original(): p1 = oalloc_refs(1); make_public(p1) -p2 = oalloc(HDR);make_public(p2) -p3 = oalloc(HDR);make_public(p3) -p4 = oalloc(HDR);make_public(p4) -p5 = oalloc(HDR);make_public(p5) +p2 = oalloc(HDR + WORD); make_public(p2) +p3 = oalloc(HDR + WORD); make_public(p3) +p4 = oalloc(HDR + WORD); make_public(p4) +p5 = oalloc(HDR + WORD); make_public(p5) delegate(p2, p3) delegate(p3, p4) delegate(p4, p5) rawsetptr(p1, 0, p3) -delegate_original(p3, p2) -delegate_original(p3, p4) -delegate_original(p3, p5) +lib.rawsetlong(p2, 0, 222) +lib.rawsetlong(p3, 0, 333) +lib.rawsetlong(p4, 0, 444) +lib.rawsetlong(p5, 0, 555) lib.stm_push_root(p1) major_collect() lib.stm_pop_root() check_not_free(p1) -check_free_old(p2) -check_not_free(p3) # original +check_not_free(p2) +check_free_old(p3) check_free_old(p4) check_free_old(p5) -assert rawgetptr(p1, 0) == p3 +assert rawgetptr(p1, 0) == p2 +assert lib.rawgetlong(p2, 0) == 555 # copied over from p5 def test_prebuilt_version_1(): p1 = lib.pseudoprebuilt(HDR, 42 + HDR) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy refactor-str-types: Add '@specialize.argtype(0)' to each descr_*() method in StringMethods.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65652:f280f4ca6565 Date: 2013-07-25 18:58 +0200 http://bitbucket.org/pypy/pypy/changeset/f280f4ca6565/ Log:Add '@specialize.argtype(0)' to each descr_*() method in StringMethods. diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -27,6 +27,7 @@ space, lenself, w_start, w_end, upper_bound=upper_bound) return (value, start, end) +@specialize.argtype(0) def descr_eq(self, space, w_other): try: return space.newbool(self._val(space) == self._op_val(space, w_other)) @@ -42,6 +43,7 @@ return space.w_False raise +@specialize.argtype(0) def descr_ne(self, space, w_other): try: return space.newbool(self._val(space) != self._op_val(space, w_other)) @@ -57,6 +59,7 @@ return space.w_True raise +@specialize.argtype(0) def descr_lt(self, space, w_other): try: return space.newbool(self._val(space) < self._op_val(space, w_other)) @@ -64,6 +67,7 @@ if e.match(space, space.w_TypeError): return space.w_NotImplemented +@specialize.argtype(0) def descr_le(self, space, w_other): try: return space.newbool(self._val(space) <= self._op_val(space, w_other)) @@ -71,6 +75,7 @@ if e.match(space, space.w_TypeError): return space.w_NotImplemented +@specialize.argtype(0) def descr_gt(self, space, w_other): try: return space.newbool(self._val(space) > self._op_val(space, w_other)) @@ -78,6 +83,7 @@ if e.match(space, space.w_TypeError): return space.w_NotImplemented +@specialize.argtype(0) def descr_ge(self, space, w_other): try: return space.newbool(self._val(space) >= self._op_val(space, w_other)) @@ -85,12 +91,15 @@ if e.match(space, space.w_TypeError): return space.w_NotImplemented +@specialize.argtype(0) def descr_len(self, space): return space.wrap(self._len()) +@specialize.argtype(0) #def descr_iter(self, space): #pass +@specialize.argtype(0) def descr_contains(self, space, w_sub): from pypy.objspace.std.bytearrayobject import W_BytearrayObject if (isinstance(self, W_BytearrayObject) and @@ -105,9 +114,11 @@ return space.w_False return space.newbool(self._val(space).find(self._op_val(space, w_sub)) >= 0) +@specialize.argtype(0) def descr_add(self, space, w_other): return self._new(self._val(space) + self._op_val(space, w_other)) +@specialize.argtype(0) def descr_mul(self, space, w_times): try: times = space.getindex_w(w_times, space.w_OverflowError) @@ -121,6 +132,7 @@ return self._new(self._val(space)[0] * times) return self._new(self._val(space) * times) +@specialize.argtype(0) def descr_getitem(self, space, w_index): if isinstance(w_index, W_SliceObject): selfvalue = self._val(space) @@ -149,6 +161,7 @@ #return wrapchar(space, selfvalue[index]) return self._new(selfvalue[index]) +@specialize.argtype(0) def descr_getslice(self, space, w_start, w_stop): selfvalue = self._val(space) start, stop = normalize_simple_slice(space, len(selfvalue), w_start, @@ -158,6 +171,7 @@ else: return self._sliced(space, selfvalue, start, stop, self) +@specialize.argtype(0) def descr_capitalize(self, space): value = self._val(space) if len(value) == 0: @@ -170,6 +184,7 @@ return self._new(builder.build()) @unwrap_spec(width=int, w_fillchar=WrappedDefault(' ')) +@specialize.argtype(0) def descr_center(self, space, width, w_fillchar): value = self._val(space) fillchar = self._op_val(space, w_fillchar) @@ -187,10 +202,12 @@ return self._new(u_centered) +@specialize.argtype(0) def descr_count(self, space, w_sub, w_start=None, w_end=None): value, start, end = self._convert_idx_params(space, w_start, w_end) return wrapint(space, value.count(self._op_val(space, w_sub), start, end)) +@specialize.argtype(0) def descr_decode(self, space, w_encoding=None, w_errors=None): from pypy.objspace.std.unicodeobject import _get_encoding_and_errors, \ unicode_from_string, decode_object @@ -199,6 +216,7 @@ return unicode_from_string(space, self) return decode_object(space, self, encoding, errors) +@specialize.argtype(0) def descr_encode(self, space, w_encoding=None, w_errors=None): from pypy.objspace.std.unicodeobject import _get_enc
[pypy-commit] pypy refactor-str-types: Back out changeset a2881bd0264c.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65651:a1d09ff7418a Date: 2013-07-25 18:55 +0200 http://bitbucket.org/pypy/pypy/changeset/a1d09ff7418a/ Log:Back out changeset a2881bd0264c. diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -3,7 +3,7 @@ from pypy.interpreter.baseobjspace import ObjSpace, W_Root from pypy.interpreter.buffer import RWBuffer from pypy.interpreter.error import OperationError, operationerrfmt -from pypy.interpreter.gateway import interp2app, interpindirect2app, unwrap_spec, WrappedDefault +from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault from pypy.interpreter.signature import Signature from pypy.objspace.std import bytesobject from pypy.objspace.std.intobject import W_IntObject @@ -427,58 +427,58 @@ __repr__ = interp2app(W_BytearrayObject.descr_repr), __str__ = interp2app(W_BytearrayObject.descr_str), -__eq__ = interpindirect2app(W_BytearrayObject.descr_eq), -__ne__ = interpindirect2app(W_BytearrayObject.descr_ne), -__lt__ = interpindirect2app(W_BytearrayObject.descr_lt), -__le__ = interpindirect2app(W_BytearrayObject.descr_le), -__gt__ = interpindirect2app(W_BytearrayObject.descr_gt), -__ge__ = interpindirect2app(W_BytearrayObject.descr_ge), +__eq__ = interp2app(W_BytearrayObject.descr_eq), +__ne__ = interp2app(W_BytearrayObject.descr_ne), +__lt__ = interp2app(W_BytearrayObject.descr_lt), +__le__ = interp2app(W_BytearrayObject.descr_le), +__gt__ = interp2app(W_BytearrayObject.descr_gt), +__ge__ = interp2app(W_BytearrayObject.descr_ge), -__len__ = interpindirect2app(W_BytearrayObject.descr_len), -__contains__ = interpindirect2app(W_BytearrayObject.descr_contains), +__len__ = interp2app(W_BytearrayObject.descr_len), +__contains__ = interp2app(W_BytearrayObject.descr_contains), -__add__ = interpindirect2app(W_BytearrayObject.descr_add), -__mul__ = interpindirect2app(W_BytearrayObject.descr_mul), -__rmul__ = interpindirect2app(W_BytearrayObject.descr_mul), +__add__ = interp2app(W_BytearrayObject.descr_add), +__mul__ = interp2app(W_BytearrayObject.descr_mul), +__rmul__ = interp2app(W_BytearrayObject.descr_mul), -__getitem__ = interpindirect2app(W_BytearrayObject.descr_getitem), +__getitem__ = interp2app(W_BytearrayObject.descr_getitem), -capitalize = interpindirect2app(W_BytearrayObject.descr_capitalize), -center = interpindirect2app(W_BytearrayObject.descr_center), -count = interpindirect2app(W_BytearrayObject.descr_count), -decode = interpindirect2app(W_BytearrayObject.descr_decode), -expandtabs = interpindirect2app(W_BytearrayObject.descr_expandtabs), -find = interpindirect2app(W_BytearrayObject.descr_find), -rfind = interpindirect2app(W_BytearrayObject.descr_rfind), -index = interpindirect2app(W_BytearrayObject.descr_index), -rindex = interpindirect2app(W_BytearrayObject.descr_rindex), -isalnum = interpindirect2app(W_BytearrayObject.descr_isalnum), -isalpha = interpindirect2app(W_BytearrayObject.descr_isalpha), -isdigit = interpindirect2app(W_BytearrayObject.descr_isdigit), -islower = interpindirect2app(W_BytearrayObject.descr_islower), -isspace = interpindirect2app(W_BytearrayObject.descr_isspace), -istitle = interpindirect2app(W_BytearrayObject.descr_istitle), -isupper = interpindirect2app(W_BytearrayObject.descr_isupper), -join = interpindirect2app(W_BytearrayObject.descr_join), -ljust = interpindirect2app(W_BytearrayObject.descr_ljust), -rjust = interpindirect2app(W_BytearrayObject.descr_rjust), -lower = interpindirect2app(W_BytearrayObject.descr_lower), -partition = interpindirect2app(W_BytearrayObject.descr_partition), -rpartition = interpindirect2app(W_BytearrayObject.descr_rpartition), -replace = interpindirect2app(W_BytearrayObject.descr_replace), -split = interpindirect2app(W_BytearrayObject.descr_split), -rsplit = interpindirect2app(W_BytearrayObject.descr_rsplit), -splitlines = interpindirect2app(W_BytearrayObject.descr_splitlines), -startswith = interpindirect2app(W_BytearrayObject.descr_startswith), -endswith = interpindirect2app(W_BytearrayObject.descr_endswith), -strip = interpindirect2app(W_BytearrayObject.descr_strip), -lstrip = interpindirect2app(W_BytearrayObject.descr_lstrip), -rstrip = interpindirect2app(W_BytearrayObject.descr_rstrip), -swapcase = interpindirect2app(W_BytearrayObject.descr_swapcase), -title = interpindirect2app(W_BytearrayObject.descr_title), -translate = interpindirect2app(W_BytearrayObject.descr_translate), -upper = interpindirect2app(W_BytearrayObject.descr_upper), -zfill = interpindirect2app(W_BytearrayObject.descr_zfill), +capitalize = interp2app(W_BytearrayObject.descr_capitalize), +center = in
[pypy-commit] pypy refactor-str-types: Inline unicode_from_object2().
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65653:4b34bd28d384 Date: 2013-07-25 19:01 +0200 http://bitbucket.org/pypy/pypy/changeset/4b34bd28d384/ Log:Inline unicode_from_object2(). diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -79,8 +79,9 @@ return self._value def _op_val(self, space, w_other): -return unicode_from_object2(space, w_other)._value -#return w_other._value +if isinstance(w_other, W_UnicodeObject): +return w_other._value +return unicode_from_encoded_object(space, w_other, None, "strict")._value def _chr(self, char): return unicode(char) @@ -334,14 +335,6 @@ return w_res return unicode_from_encoded_object(space, w_res, None, "strict") -# XXX refactor / rename / share with unicode_from_object -def unicode_from_object2(space, w_obj): -if space.is_w(space.type(w_obj), space.w_unicode): -return w_obj -elif isinstance(w_obj, W_UnicodeObject): -return W_UnicodeObject(w_obj._value) -return unicode_from_encoded_object(space, w_obj, None, "strict") - def unicode_from_string(space, w_str): # this is a performance and bootstrapping hack encoding = getdefaultencoding(space) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: Fix
Author: Armin Rigo Branch: copy-over-original2 Changeset: r441:102fc9863345 Date: 2013-07-25 18:13 +0200 http://bitbucket.org/pypy/stmgc/changeset/102fc9863345/ Log:Fix diff --git a/c4/gcpage.c b/c4/gcpage.c --- a/c4/gcpage.c +++ b/c4/gcpage.c @@ -540,7 +540,8 @@ if (obj->h_tid & GCFLAG_MOVED) { assert(!(obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED)); -obj = (gcptr)obj->h_revision; +assert(IS_POINTER(obj->h_original)); +obj = (gcptr)obj->h_original; items[i] = obj; } else if (obj->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED) { ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: in-progress
Author: Armin Rigo Branch: copy-over-original2 Changeset: r440:0c2bd2af9b0f Date: 2013-07-25 18:11 +0200 http://bitbucket.org/pypy/stmgc/changeset/0c2bd2af9b0f/ Log:in-progress diff --git a/c4/gcpage.c b/c4/gcpage.c --- a/c4/gcpage.c +++ b/c4/gcpage.c @@ -237,8 +237,13 @@ obj->h_tid |= GCFLAG_MOVED; /* copy the object's content */ -dprintf(("copy %p over %p\n", obj, id_copy)); -memcpy(id_copy + 1, obj + 1, stmgc_size(obj) - sizeof(struct stm_object_s)); +size_t objsize; +if (obj->h_tid & GCFLAG_STUB) +objsize = sizeof(struct stm_stub_s); +else +objsize = stmgc_size(obj); +dprintf(("copy %p over %p (%ld bytes)\n", obj, id_copy, objsize)); +memcpy(id_copy + 1, obj + 1, objsize - sizeof(struct stm_object_s)); /* copy the object's h_revision number */ id_copy->h_revision = obj->h_revision; @@ -346,7 +351,8 @@ /* return this original */ original->h_tid |= GCFLAG_VISITED; -gcptrlist_insert(&objects_to_trace, original); +if (!(original->h_tid & GCFLAG_STUB)) +gcptrlist_insert(&objects_to_trace, original); return original; } diff --git a/c4/test/test_gcpage.py b/c4/test/test_gcpage.py --- a/c4/test/test_gcpage.py +++ b/c4/test/test_gcpage.py @@ -303,19 +303,14 @@ major_collect() check_prebuilt(p1) check_free_old(p2) -check_not_free(p3) # XXX replace with p1 +check_free_old(p3) -def test_prebuilt_version_2_copy_over_prebuilt(): +def test_prebuilt_with_hash(): p1 = lib.pseudoprebuilt_with_hash(HDR, 42 + HDR, 99) p2 = oalloc(HDR); make_public(p2) p3 = oalloc(HDR); make_public(p3) delegate(p1, p2) -delegate_original(p1, p2) delegate(p2, p3) -delegate_original(p1, p3) -# added by delegate, remove, otherwise -# major_collect will not copy over prebuilt p1: -p1.h_tid &= ~GCFLAG_PUBLIC_TO_PRIVATE major_collect() check_prebuilt(p1) assert lib.stm_hash(p1) == 99 ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] stmgc copy-over-original2: Use the dbgmem.c logic for the shadowstack too
Author: Armin Rigo Branch: copy-over-original2 Changeset: r442:5e88d98b36de Date: 2013-07-25 19:28 +0200 http://bitbucket.org/pypy/stmgc/changeset/5e88d98b36de/ Log:Use the dbgmem.c logic for the shadowstack too diff --git a/c4/stmsync.c b/c4/stmsync.c --- a/c4/stmsync.c +++ b/c4/stmsync.c @@ -52,7 +52,7 @@ static void init_shadowstack(void) { struct tx_descriptor *d = thread_descriptor; -d->shadowstack = malloc(sizeof(gcptr) * LENGTH_SHADOW_STACK); +d->shadowstack = stm_malloc(sizeof(gcptr) * LENGTH_SHADOW_STACK); if (!d->shadowstack) { stm_fatalerror("out of memory: shadowstack\n"); } @@ -68,7 +68,7 @@ assert(x == END_MARKER_ON); assert(stm_shadowstack == d->shadowstack); stm_shadowstack = NULL; -free(d->shadowstack); +stm_free(d->shadowstack, sizeof(gcptr) * LENGTH_SHADOW_STACK); } void stm_set_max_aborts(int max_aborts) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy refactor-str-types: Remove use of unicode.is* which isn't supported in RPython.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65654:cfc74ab95eda Date: 2013-07-25 19:29 +0200 http://bitbucket.org/pypy/pypy/changeset/cfc74ab95eda/ Log:Remove use of unicode.is* which isn't supported in RPython. diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -336,12 +336,12 @@ v = self._val(space) if len(v) == 1: c = v[0] -return space.newbool(c.islower()) +return space.newbool(self._islower(c)) cased = False for idx in range(len(v)): -if v[idx].isupper(): +if self._isupper(v[idx]): return space.w_False -elif not cased and v[idx].islower(): +elif not cased and self._islower(v[idx]): cased = True return space.newbool(cased) @@ -357,12 +357,12 @@ for pos in range(0, len(input)): ch = input[pos] -if ch.isupper(): +if self._isupper(ch): if previous_is_cased: return space.w_False previous_is_cased = True cased = True -elif ch.islower(): +elif self._islower(ch): if not previous_is_cased: return space.w_False cased = True @@ -376,12 +376,12 @@ v = self._val(space) if len(v) == 1: c = v[0] -return space.newbool(c.isupper()) +return space.newbool(self._isupper(c)) cased = False for idx in range(len(v)): -if v[idx].islower(): +if self._islower(v[idx]): return space.w_False -elif not cased and v[idx].isupper(): +elif not cased and self._isupper(v[idx]): cased = True return space.newbool(cased) @@ -535,7 +535,7 @@ while True: # find the beginning of the next word while i < length: -if not value[i].isspace(): +if not self._isspace(value[i]): break # found i += 1 else: @@ -546,7 +546,7 @@ j = length # take all the rest of the string else: j = i + 1 -while j < length and not value[j].isspace(): +while j < length and not self._isspace(value[j]): j += 1 maxsplit -= 1 # NB. if it's already < 0, it stays < 0 @@ -575,7 +575,7 @@ while True: # starting from the end, find the end of the next word while i >= 0: -if not value[i].isspace(): +if not self._isspace(value[i]): break # found i -= 1 else: @@ -587,7 +587,7 @@ j = -1 # take all the rest of the string else: j = i - 1 -while j >= 0 and not value[j].isspace(): +while j >= 0 and not self._isspace(value[j]): j -= 1 maxsplit -= 1 # NB. if it's already < 0, it stays < 0 @@ -692,11 +692,11 @@ if left: #print "while %d < %d and -%s- in -%s-:"%(lpos, rpos, value[lpos],w_chars) -while lpos < rpos and value[lpos].isspace(): +while lpos < rpos and self._isspace(value[lpos]): lpos += 1 if right: -while rpos > lpos and value[rpos - 1].isspace(): +while rpos > lpos and self._isspace(value[rpos - 1]): rpos -= 1 assert rpos >= lpos# annotator hint, don't remove diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -89,25 +89,25 @@ _builder = UnicodeBuilder def _isupper(self, ch): -return ch.isupper() +return unicodedb.isupper(ord(ch)) def _islower(self, ch): -return ch.islower() +return unicodedb.islower(ord(ch)) def _istitle(self, ch): -return ch.istitle() +return unicodedb.istitle(ord(ch)) def _isspace(self, ch): -return ch.isspace() +return unicodedb.isspace(ord(ch)) def _isalpha(self, ch): -return ch.isalpha() +return unicodedb.isalpha(ord(ch)) def _isalnum(self, ch): -return ch.isalnum() +return unicodedb.isalnum(ord(ch)) def _isdigit(self, ch): -return ch.isdigit() +return unicodedb.isdigit(ord(ch)) def _iscased(self, ch): return unicodedb.iscased(ord(ch)) ___ p
[pypy-commit] pypy refactor-str-types: Make the annotator happy.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65655:e38a40e646e8 Date: 2013-07-25 19:38 +0200 http://bitbucket.org/pypy/pypy/changeset/e38a40e646e8/ Log:Make the annotator happy. diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -29,7 +29,7 @@ return "%s(%s)" % (w_self.__class__.__name__, ''.join(w_self.data)) def _new(self, value): -return W_BytearrayObject(value) +return W_BytearrayObject(list(value)) def _len(self): return len(self.data) @@ -41,7 +41,8 @@ return space.bufferstr_new_w(w_other) def _chr(self, char): -return str(char) +assert len(char) == 1 +return str(char)[0] _builder = StringBuilder diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py --- a/pypy/objspace/std/bytesobject.py +++ b/pypy/objspace/std/bytesobject.py @@ -83,7 +83,8 @@ #return w_other._value def _chr(self, char): -return str(char) +assert len(char) == 1 +return str(char)[0] _builder = StringBuilder diff --git a/pypy/objspace/std/unicodeobject.py b/pypy/objspace/std/unicodeobject.py --- a/pypy/objspace/std/unicodeobject.py +++ b/pypy/objspace/std/unicodeobject.py @@ -84,7 +84,8 @@ return unicode_from_encoded_object(space, w_other, None, "strict")._value def _chr(self, char): -return unicode(char) +assert len(char) == 1 +return unicode(char)[0] _builder = UnicodeBuilder ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-ootype: Remove ootype support from pypy
Author: Ronan Lamy Branch: kill-ootype Changeset: r65657:7ab1bd7d7871 Date: 2013-07-25 18:39 +0100 http://bitbucket.org/pypy/pypy/changeset/7ab1bd7d7871/ Log:Remove ootype support from pypy diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -340,10 +340,6 @@ if not IS_64_BITS: config.objspace.std.suggest(withsmalllong=True) -# some optimizations have different effects depending on the typesystem -if type_system == 'ootype': -config.objspace.std.suggest(multimethods="doubledispatch") - # extra optimizations with the JIT if level == 'jit': config.objspace.std.suggest(withcelldict=True) @@ -351,10 +347,7 @@ def enable_allworkingmodules(config): -if config.translation.type_system == 'ootype': -modules = working_oo_modules -else: -modules = working_modules +modules = working_modules if config.translation.sandbox: modules = default_modules # ignore names from 'essential_modules', notably 'exceptions', which diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -234,9 +234,6 @@ from pypy.config.pypyoption import enable_translationmodules enable_translationmodules(config) -## if config.translation.type_system == 'ootype': -## config.objspace.usemodules.suggest(rbench=True) - config.translation.suggest(check_str_without_nul=True) if config.translation.thread: @@ -271,12 +268,6 @@ elif config.objspace.usemodules.pypyjit: config.translation.jit = True -if config.translation.backend == "cli": -config.objspace.usemodules.clr = True -# XXX did it ever work? -#elif config.objspace.usemodules.clr: -#config.translation.backend == "cli" - if config.translation.sandbox: config.objspace.lonepycfiles = False config.objspace.usepycfiles = False @@ -292,16 +283,6 @@ wrapstr = 'space.wrap(%r)' % (options) pypy.module.sys.Module.interpleveldefs['pypy_translation_info'] = wrapstr -if config.translation.backend in ["cli", "jvm"] and sys.platform == "win32": -# HACK: The ftruncate implementation in streamio.py which is used for the Win32 platform -# is specific for the C backend and can't be generated on CLI or JVM. Because of that, -# we have to patch it out. -from rpython.rlib import streamio -def ftruncate_win32_dummy(fd, size): pass -def _setfd_binary_dummy(fd): pass -streamio.ftruncate_win32 = ftruncate_win32_dummy -streamio._setfd_binary = _setfd_binary_dummy - return self.get_entry_point(config) def jitpolicy(self, driver): diff --git a/pypy/module/_codecs/__init__.py b/pypy/module/_codecs/__init__.py --- a/pypy/module/_codecs/__init__.py +++ b/pypy/module/_codecs/__init__.py @@ -18,10 +18,10 @@ The builtin Unicode codecs use the following interface: - _encode(Unicode_object[,errors='strict']) -> + _encode(Unicode_object[,errors='strict']) -> (string object, bytes consumed) - _decode(char_buffer_obj[,errors='strict']) -> + _decode(char_buffer_obj[,errors='strict']) -> (Unicode object, bytes consumed) _encode() interfaces also accept non-Unicode object as @@ -90,8 +90,7 @@ "NOT_RPYTHON" # mbcs codec is Windows specific, and based on rffi. -if (hasattr(runicode, 'str_decode_mbcs') and -space.config.translation.type_system != 'ootype'): +if (hasattr(runicode, 'str_decode_mbcs')): self.interpleveldefs['mbcs_encode'] = 'interp_codecs.mbcs_encode' self.interpleveldefs['mbcs_decode'] = 'interp_codecs.mbcs_decode' diff --git a/pypy/module/_file/__init__.py b/pypy/module/_file/__init__.py --- a/pypy/module/_file/__init__.py +++ b/pypy/module/_file/__init__.py @@ -12,18 +12,6 @@ "set_file_encoding": "interp_file.set_file_encoding", } -def __init__(self, space, *args): -"NOT_RPYTHON" - -# on windows with oo backends, remove file.truncate, -# because the implementation is based on rffi -if (sys.platform == 'win32' and -space.config.translation.type_system == 'ootype'): -from pypy.module._file.interp_file import W_File -del W_File.typedef.rawdict['truncate'] - -MixedModule.__init__(self, space, *args) - def shutdown(self, space): # at shutdown, flush all open streams. Ignore I/O errors. from pypy.module._file.interp_file import getopenstreams, StreamErrors diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py --- a/pypy/module/posix/__init__.py +++ b/pyp
[pypy-commit] pypy kill-ootype: hg rm pypy/module/clr/
Author: Ronan Lamy Branch: kill-ootype Changeset: r65656:9483b6d294d3 Date: 2013-07-25 18:10 +0100 http://bitbucket.org/pypy/pypy/changeset/9483b6d294d3/ Log:hg rm pypy/module/clr/ diff --git a/pypy/module/clr/__init__.py b/pypy/module/clr/__init__.py deleted file mode 100644 --- a/pypy/module/clr/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# Package initialisation -from pypy.interpreter.mixedmodule import MixedModule - -import boxing_rules # with side effects - -class Module(MixedModule): -"""CLR module""" - -appleveldefs = { -'dotnetimporter': 'app_importer.importer' -} - -interpleveldefs = { -'_CliObject_internal': 'interp_clr.W_CliObject', -'call_staticmethod': 'interp_clr.call_staticmethod', -'load_cli_class': 'interp_clr.load_cli_class', -'get_assemblies_info': 'interp_clr.get_assemblies_info', -'AddReferenceByPartialName': 'interp_clr.AddReferenceByPartialName', -} - -def startup(self, space): -self.space.appexec([self], """(clr_module): -import sys -clr_module.get_assemblies_info() # load info for std assemblies -sys.meta_path.append(clr_module.dotnetimporter()) -""") diff --git a/pypy/module/clr/app_clr.py b/pypy/module/clr/app_clr.py deleted file mode 100644 --- a/pypy/module/clr/app_clr.py +++ /dev/null @@ -1,204 +0,0 @@ -# NOT_RPYTHON - -class StaticMethodWrapper(object): -__slots__ = ('class_name', 'meth_name',) - -def __init__(self, class_name, meth_name): -self.class_name = class_name -self.meth_name = meth_name - -def __call__(self, *args): -import clr -return clr.call_staticmethod(self.class_name, self.meth_name, args) - -def __repr__(self): -return '' % (self.class_name, self.meth_name) - - -class MethodWrapper(object): -__slots__ = ('meth_name',) - -def __init__(self, meth_name): -self.meth_name = meth_name - -def __get__(self, obj, type_): -if obj is None: -return UnboundMethod(type_, self.meth_name) -else: -return BoundMethod(self.meth_name, obj) - -def __repr__(self): -return '%s(%s)' % (self.__class__.__name__, repr(self.meth_name)) - - -class UnboundMethod(object): -__slots__ = ('im_class', 'im_name') - -def __init__(self, im_class, im_name): -self.im_class = im_class -self.im_name = im_name - -def __raise_TypeError(self, thing): -raise TypeError, 'unbound method %s() must be called with %s ' \ - 'instance as first argument (got %s instead)' % \ - (self.im_name, self.im_class.__cliclass__, thing) - -def __call__(self, *args): -if len(args) == 0: -self.__raise_TypeError('nothing') -im_self = args[0] -if not isinstance(im_self, self.im_class): -self.__raise_TypeError('%s instance' % im_self.__class__.__name__) -return im_self.__cliobj__.call_method(self.im_name, args, 1) # ignore the first arg - -def __repr__(self): -return '' % (self.im_class.__cliclass__, self.im_name) - - -class BoundMethod(object): -__slots__ = ('im_name', 'im_self') - -def __init__(self, im_name, im_self): -self.im_name = im_name -self.im_self = im_self - -def __call__(self, *args): -return self.im_self.__cliobj__.call_method(self.im_name, args) - -def __repr__(self): -return '' % (self.im_self.__class__.__cliclass__, - self.im_name, - self.im_self) - -class StaticProperty(object): -def __init__(self, fget=None, fset=None): -self.fget = fget -self.fset = fset - -def __get__(self, obj, type_): -return self.fget() - -def _qualify(t): -mscorlib = 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' -return '%s, %s' % (t, mscorlib) - -class MetaGenericCliClassWrapper(type): -_cli_types = { -int: _qualify('System.Int32'), -str: _qualify('System.String'), -bool: _qualify('System.Boolean'), -float: _qualify('System.Double'), -} -_System_Object = _qualify('System.Object') - -def _cli_name(cls, ttype): -if isinstance(ttype, MetaCliClassWrapper): -return '[%s]' % ttype.__fullyqualifiedname__ -else: -return '[%s]' % cls._cli_types.get(ttype, cls._System_Object) - -def __setattr__(cls, name, value): -obj = cls.__dict__.get(name, None) -if isinstance(obj, StaticProperty): -obj.fset(value) -else: -type.__setattr__(cls, name, value) - -def __getitem__(cls, type_or_tuple): -import clr -if isinstance(type_or_tuple, tuple): -types = type_or_tuple -else: -types = (type_or_tuple,) -namespace, generic_class
[pypy-commit] pypy refactor-str-types: Fix.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65658:9d73701fdecb Date: 2013-07-25 19:58 +0200 http://bitbucket.org/pypy/pypy/changeset/9d73701fdecb/ Log:Fix. diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py --- a/pypy/objspace/std/bytearrayobject.py +++ b/pypy/objspace/std/bytearrayobject.py @@ -47,7 +47,7 @@ _builder = StringBuilder def _newlist_unwrapped(self, space, res): -return space.wrap([W_BytearrayObject(list(i)) for i in res]) +return space.newlist([W_BytearrayObject(list(i)) for i in res]) def _isupper(self, ch): return ch.isupper() diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -490,8 +490,8 @@ if isinstance(self, W_BytearrayObject): w_sub = self._new(sub) return space.newtuple( -[self._sliced(space, value, 0, pos, value), w_sub, - self._sliced(space, value, pos+len(sub), len(value), value)]) +[self._sliced(space, value, 0, pos, self), w_sub, + self._sliced(space, value, pos+len(sub), len(value), self)]) @specialize.argtype(0) def descr_rpartition(self, space, w_sub): @@ -508,8 +508,8 @@ if isinstance(self, W_BytearrayObject): w_sub = self._new(sub) return space.newtuple( -[self._sliced(space, value, 0, pos, value), w_sub, - self._sliced(space, value, pos+len(sub), len(value), value)]) +[self._sliced(space, value, 0, pos, self), w_sub, + self._sliced(space, value, pos+len(sub), len(value), self)]) @unwrap_spec(count=int) @specialize.argtype(0) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-ootype: removed some more ootype stuff around stat and configuration
Author: Alex Gaynor Branch: kill-ootype Changeset: r65659:35ef76608d04 Date: 2013-07-25 11:00 -0700 http://bitbucket.org/pypy/pypy/changeset/35ef76608d04/ Log:removed some more ootype stuff around stat and configuration diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -48,11 +48,6 @@ "termios", "_minimal_curses", ])) -working_oo_modules = default_modules.copy() -working_oo_modules.update(dict.fromkeys( -["_md5", "_sha", "cStringIO", "itertools"] -)) - # XXX this should move somewhere else, maybe to platform ("is this posixish" # check or something) if sys.platform == "win32": diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py --- a/pypy/module/posix/interp_posix.py +++ b/pypy/module/posix/interp_posix.py @@ -208,11 +208,8 @@ # -# For LL backends, expose all fields. -# For OO backends, only the portable fields (the first 10). STAT_FIELDS = unrolling_iterable(enumerate(ll_os_stat.STAT_FIELDS)) -PORTABLE_STAT_FIELDS = unrolling_iterable( - enumerate(ll_os_stat.PORTABLE_STAT_FIELDS)) + def build_stat_result(space, st): FIELDS = STAT_FIELDS# also when not translating at all diff --git a/rpython/rtyper/module/r_os_stat.py b/rpython/rtyper/module/r_os_stat.py --- a/rpython/rtyper/module/r_os_stat.py +++ b/rpython/rtyper/module/r_os_stat.py @@ -19,10 +19,7 @@ def __init__(self, rtyper): self.rtyper = rtyper -if rtyper.type_system.name == "lltypesystem": -self.stat_fields = ll_os_stat.STAT_FIELDS -else: -self.stat_fields = ll_os_stat.PORTABLE_STAT_FIELDS +self.stat_fields = ll_os_stat.STAT_FIELDS self.stat_field_indexes = {} for i, (name, TYPE) in enumerate(self.stat_fields): ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy refactor-str-types: Use unicode_from_encoded_object() instead of decode_object(). decode_object() doesn't always return unicode.
Author: Manuel Jacob Branch: refactor-str-types Changeset: r65660:b23dd3b042f3 Date: 2013-07-25 20:08 +0200 http://bitbucket.org/pypy/pypy/changeset/b23dd3b042f3/ Log:Use unicode_from_encoded_object() instead of decode_object(). decode_object() doesn't always return unicode. diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py --- a/pypy/objspace/std/bytesobject.py +++ b/pypy/objspace/std/bytesobject.py @@ -10,7 +10,7 @@ from pypy.objspace.std.stdtypedef import StdTypeDef from pypy.objspace.std.stringmethods import StringMethods from pypy.objspace.std.unicodeobject import (unicode_from_string, -decode_object, _get_encoding_and_errors) +decode_object, unicode_from_encoded_object, _get_encoding_and_errors) from rpython.rlib.jit import we_are_jitted from rpython.rlib.objectmodel import compute_hash, compute_unique_id from rpython.rlib.rstring import StringBuilder @@ -177,7 +177,7 @@ def descr_add(self, space, w_other): if space.isinstance_w(w_other, space.w_unicode): -self_as_unicode = decode_object(space, self, None, None) +self_as_unicode = unicode_from_encoded_object(space, self, None, None) return space.add(self_as_unicode, w_other) elif space.isinstance_w(w_other, space.w_bytearray): # XXX: eliminate double-copy @@ -188,13 +188,13 @@ def _startswith(self, space, value, w_prefix, start, end): if space.isinstance_w(w_prefix, space.w_unicode): -self_as_unicode = decode_object(space, self, None, None) +self_as_unicode = unicode_from_encoded_object(space, self, None, None) return self_as_unicode._startswith(space, value, w_prefix, start, end) return StringMethods._startswith(self, space, value, w_prefix, start, end) def _endswith(self, space, value, w_suffix, start, end): if space.isinstance_w(w_suffix, space.w_unicode): -self_as_unicode = decode_object(space, self, None, None) +self_as_unicode = unicode_from_encoded_object(space, self, None, None) return self_as_unicode._endswith(space, value, w_suffix, start, end) return StringMethods._endswith(self, space, value, w_suffix, start, end) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-ootype: fix a somewhat silly test
Author: Ronan Lamy Branch: kill-ootype Changeset: r65661:6d258e2626a5 Date: 2013-07-25 19:25 +0100 http://bitbucket.org/pypy/pypy/changeset/6d258e2626a5/ Log:fix a somewhat silly test diff --git a/rpython/jit/codewriter/test/test_call.py b/rpython/jit/codewriter/test/test_call.py --- a/rpython/jit/codewriter/test/test_call.py +++ b/rpython/jit/codewriter/test/test_call.py @@ -101,20 +101,24 @@ Variable()) assert cc.guess_call_kind(op) == 'recursive' -op = SpaceOperation('direct_call', [Constant(object())], +class fakeresidual: +_obj = object() +op = SpaceOperation('direct_call', [Constant(fakeresidual)], Variable()) assert cc.guess_call_kind(op) == 'residual' class funcptr: -class graph: -class func: -oopspec = "spec" +class _obj: +class graph: +class func: +oopspec = "spec" op = SpaceOperation('direct_call', [Constant(funcptr)], Variable()) assert cc.guess_call_kind(op) == 'builtin' class funcptr: -graph = g +class _obj: +graph = g op = SpaceOperation('direct_call', [Constant(funcptr)], Variable()) res = cc.graphs_from(op) @@ -122,7 +126,8 @@ assert cc.guess_call_kind(op) == 'regular' class funcptr: -graph = object() +class _obj: +graph = object() op = SpaceOperation('direct_call', [Constant(funcptr)], Variable()) res = cc.graphs_from(op) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy kill-ootype: remove the last (?) oosend references
Author: Ronan Lamy Branch: kill-ootype Changeset: r65662:d9308fb479f6 Date: 2013-07-25 21:30 +0100 http://bitbucket.org/pypy/pypy/changeset/d9308fb479f6/ Log:remove the last (?) oosend references diff --git a/rpython/jit/codewriter/call.py b/rpython/jit/codewriter/call.py --- a/rpython/jit/codewriter/call.py +++ b/rpython/jit/codewriter/call.py @@ -65,7 +65,7 @@ while todo: top_graph = todo.pop() for _, op in top_graph.iterblockops(): -if op.opname not in ("direct_call", "indirect_call", "oosend"): +if op.opname not in ("direct_call", "indirect_call"): continue kind = self.guess_call_kind(op, is_candidate) # use callers() to view the calling chain in pdb @@ -90,13 +90,8 @@ if is_candidate(graph): return [graph] # common case: look inside this graph else: -assert op.opname in ('indirect_call', 'oosend') -if op.opname == 'indirect_call': -graphs = op.args[-1].value -else: -v_obj = op.args[1].concretetype -graphs = v_obj._lookup_graphs(op.args[0].value) -# +assert op.opname == 'indirect_call' +graphs = op.args[-1].value if graphs is None: # special case: handle the indirect call that goes to # the 'instantiate' methods. This check is a bit imprecise @@ -141,10 +136,6 @@ return 'residual' if hasattr(targetgraph.func, 'oopspec'): return 'builtin' -elif op.opname == 'oosend': -SELFTYPE, methname, opargs = support.decompose_oosend(op) -if SELFTYPE.oopspec_name is not None: -return 'builtin' if self.graphs_from(op, is_candidate) is None: return 'residual' return 'regular' diff --git a/rpython/jit/codewriter/support.py b/rpython/jit/codewriter/support.py --- a/rpython/jit/codewriter/support.py +++ b/rpython/jit/codewriter/support.py @@ -814,15 +814,3 @@ rtyper._builtin_func_for_spec_cache[key] = (c_func, LIST_OR_DICT) # return c_func, LIST_OR_DICT - - -def decompose_oosend(op): -name = op.args[0].value -opargs = op.args[1:] -SELFTYPE = opargs[0].concretetype -return SELFTYPE, name, opargs - -def lookup_oosend_method(op): -SELFTYPE, methname, args_v = decompose_oosend(op) -_, meth = SELFTYPE._lookup(methname) -return SELFTYPE, methname, meth diff --git a/rpython/jit/metainterp/jitprof.py b/rpython/jit/metainterp/jitprof.py --- a/rpython/jit/metainterp/jitprof.py +++ b/rpython/jit/metainterp/jitprof.py @@ -112,7 +112,7 @@ def count_ops(self, opnum, kind=Counters.OPS): from rpython.jit.metainterp.resoperation import rop self.counters[kind] += 1 -if opnum == rop.CALL and kind == Counters.RECORDED_OPS:# or opnum == rop.OOSEND: +if opnum == rop.CALL and kind == Counters.RECORDED_OPS: self.calls += 1 def print_stats(self): diff --git a/rpython/translator/backendopt/graphanalyze.py b/rpython/translator/backendopt/graphanalyze.py --- a/rpython/translator/backendopt/graphanalyze.py +++ b/rpython/translator/backendopt/graphanalyze.py @@ -156,10 +156,6 @@ break return self.finalize_builder(result) -def analyze_oosend(self, TYPE, name, seen=None): -graphs = TYPE._lookup_graphs(name) -return self.analyze_indirect_call(graphs, seen) - def analyze_all(self, graphs=None): if graphs is None: graphs = self.translator.graphs ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: attempt to fix app_main
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65665:0806ff7d7880 Date: 2013-07-23 23:00 +0200 http://bitbucket.org/pypy/pypy/changeset/0806ff7d7880/ Log:attempt to fix app_main diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -460,8 +460,11 @@ if os.getenv('PYTHONVERBOSE'): options["verbose"] = 1 +# skip environment cache since PYTHONINSPECT could be set in same process +from __pypy__.os import real_getenv + if (options["interactive"] or -(not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))): +(not options["ignore_environment"] and real_getenv('PYTHONINSPECT'))): options["inspect"] = 1 ##We don't print the warning, because it offers no additional security ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: failing test
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65663:5dff0c40663d Date: 2013-07-23 01:02 +0200 http://bitbucket.org/pypy/pypy/changeset/5dff0c40663d/ Log:failing test diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -48,7 +48,7 @@ pdir = _get_next_path(ext='') p = pdir.ensure(dir=1).join('__main__.py') p.write(str(py.code.Source(source))) -# return relative path for testing purposes +# return relative path for testing purposes return py.path.local().bestrelpath(pdir) demo_script = getscript(""" @@ -706,6 +706,15 @@ assert 'hello world\n' in data assert '42\n' in data +def test_putenv_fires_interactive_within_process(self): +# should be noninteractive when piped in +data = 'import os\nos.putenv("PYTHONINSPECT", "1")\n' +self.run('', senddata=data, expect_prompt=False) + +# should go interactive with -c +data = data.replace('\n', ';') +self.run("-c '%s'" % data, expect_prompt=True) + def test_option_S_copyright(self): data = self.run('-S -i', expect_prompt=True, expect_banner=True) assert 'copyright' not in data @@ -971,7 +980,7 @@ pypy_c = os.path.join(self.trunkdir, 'pypy', 'goal', 'pypy-c') app_main.setup_bootstrap_path(pypy_c) newpath = sys.path[:] -# we get at least lib_pypy +# we get at least lib_pypy # lib-python/X.Y.Z, and maybe more (e.g. plat-linux2) assert len(newpath) >= 2 for p in newpath: ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: fix merge, typos
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65671:7d2d7703eb8b Date: 2013-07-25 22:20 +0200 http://bitbucket.org/pypy/pypy/changeset/7d2d7703eb8b/ Log:fix merge, typos 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 @@ -32,13 +32,12 @@ .. branch: ssl_moving_write_buffer -<<< local .. branch: pythoninspect-fix Make PyPy respect PYTHONINSPECT variable set via os.putenv in the same process to start interactive prompt when the script execution finishes. This adds new __pypy__.os.real_getenv call that bypasses Python cache and looksup env in the underlying OS. Translatorshell now works on PyPy. -=== + .. branch: add-statvfs Added os.statvfs and os.fstatvfs diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -710,7 +710,7 @@ try: import __pypy__ except ImportError: -py.test.skip("This can be only tested on PyPy with get_realenv") +py.test.skip("This can be only tested on PyPy with real_getenv") # should be noninteractive when piped in data = 'import os\nos.putenv("PYTHONINSPECT", "1")\n' ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: no None allowed
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65667:0f1dbffcb578 Date: 2013-07-24 21:46 +0200 http://bitbucket.org/pypy/pypy/changeset/0f1dbffcb578/ Log:no None allowed diff --git a/pypy/module/__pypy__/interp_os.py b/pypy/module/__pypy__/interp_os.py --- a/pypy/module/__pypy__/interp_os.py +++ b/pypy/module/__pypy__/interp_os.py @@ -3,7 +3,7 @@ from pypy.interpreter.gateway import unwrap_spec -@unwrap_spec(name=str) +@unwrap_spec(name='str0') def real_getenv(space, name): """Get an OS environment value skipping Python cache""" -return space.wrap(os.getenv(name)) +return space.wrap(os.environ.get(name)) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: use __pypy__.os
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65668:c1575d6e1de5 Date: 2013-07-25 15:45 +0200 http://bitbucket.org/pypy/pypy/changeset/c1575d6e1de5/ Log:use __pypy__.os diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -460,11 +460,8 @@ if os.getenv('PYTHONVERBOSE'): options["verbose"] = 1 -# skip environment cache since PYTHONINSPECT could be set in same process -from __pypy__.os import real_getenv - if (options["interactive"] or -(not options["ignore_environment"] and real_getenv('PYTHONINSPECT'))): +(not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))): options["inspect"] = 1 ##We don't print the warning, because it offers no additional security @@ -559,8 +556,15 @@ # or # * PYTHONINSPECT is set and stdin is a tty. # +try: +# we need a version of getenv that bypasses Python caching +from __pypy__.os import real_getenv +except ImportError: +# dont fail on CPython here +real_getenv = os.getenv + return (interactive or -((inspect or (readenv and os.getenv('PYTHONINSPECT'))) +((inspect or (readenv and real_getenv('PYTHONINSPECT'))) and sys.stdin.isatty())) success = True ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: try using RPython os.getenv instead of LL version
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65666:9a20d5ede0ec Date: 2013-07-24 08:45 +0200 http://bitbucket.org/pypy/pypy/changeset/9a20d5ede0ec/ Log:try using RPython os.getenv instead of LL version diff --git a/pypy/module/__pypy__/interp_os.py b/pypy/module/__pypy__/interp_os.py --- a/pypy/module/__pypy__/interp_os.py +++ b/pypy/module/__pypy__/interp_os.py @@ -1,4 +1,4 @@ -from rpython.rtyper.module.ll_os_environ import getenv_llimpl +import os from pypy.interpreter.gateway import unwrap_spec @@ -6,4 +6,4 @@ @unwrap_spec(name=str) def real_getenv(space, name): """Get an OS environment value skipping Python cache""" -return space.wrap(getenv_llimpl(name)) +return space.wrap(os.getenv(name)) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Merged in squeaky/pypy/pythoninspect-fix (pull request #168)
Author: Philip Jenvey Branch: Changeset: r65673:eec382ffd965 Date: 2013-07-25 13:45 -0700 http://bitbucket.org/pypy/pypy/changeset/eec382ffd965/ Log:Merged in squeaky/pypy/pythoninspect-fix (pull request #168) Fix PYTHONINSPECT behaviour 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 @@ -32,6 +32,12 @@ .. branch: ssl_moving_write_buffer +.. branch: pythoninspect-fix +Make PyPy respect PYTHONINSPECT variable set via os.putenv in the same process +to start interactive prompt when the script execution finishes. This adds +new __pypy__.os.real_getenv call that bypasses Python cache and looksup env +in the underlying OS. Translatorshell now works on PyPy. + .. branch: add-statvfs Added os.statvfs and os.fstatvfs diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -556,8 +556,15 @@ # or # * PYTHONINSPECT is set and stdin is a tty. # +try: +# we need a version of getenv that bypasses Python caching +from __pypy__.os import real_getenv +except ImportError: +# dont fail on CPython here +real_getenv = os.getenv + return (interactive or -((inspect or (readenv and os.getenv('PYTHONINSPECT'))) +((inspect or (readenv and real_getenv('PYTHONINSPECT'))) and sys.stdin.isatty())) success = True diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -48,7 +48,7 @@ pdir = _get_next_path(ext='') p = pdir.ensure(dir=1).join('__main__.py') p.write(str(py.code.Source(source))) -# return relative path for testing purposes +# return relative path for testing purposes return py.path.local().bestrelpath(pdir) demo_script = getscript(""" @@ -706,6 +706,20 @@ assert 'hello world\n' in data assert '42\n' in data +def test_putenv_fires_interactive_within_process(self): +try: +import __pypy__ +except ImportError: +py.test.skip("This can be only tested on PyPy with real_getenv") + +# should be noninteractive when piped in +data = 'import os\nos.putenv("PYTHONINSPECT", "1")\n' +self.run('', senddata=data, expect_prompt=False) + +# should go interactive with -c +data = data.replace('\n', ';') +self.run("-c '%s'" % data, expect_prompt=True) + def test_option_S_copyright(self): data = self.run('-S -i', expect_prompt=True, expect_banner=True) assert 'copyright' not in data @@ -971,7 +985,7 @@ pypy_c = os.path.join(self.trunkdir, 'pypy', 'goal', 'pypy-c') app_main.setup_bootstrap_path(pypy_c) newpath = sys.path[:] -# we get at least lib_pypy +# we get at least lib_pypy # lib-python/X.Y.Z, and maybe more (e.g. plat-linux2) assert len(newpath) >= 2 for p in newpath: diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py --- a/pypy/module/__pypy__/__init__.py +++ b/pypy/module/__pypy__/__init__.py @@ -50,6 +50,13 @@ } +class OsModule(MixedModule): +appleveldefs = {} +interpleveldefs = { +'real_getenv': 'interp_os.real_getenv' +} + + class Module(MixedModule): appleveldefs = { } @@ -82,6 +89,7 @@ "time": TimeModule, "thread": ThreadModule, "intop": IntOpModule, +"os": OsModule, } def setup_after_space_initialization(self): diff --git a/pypy/module/__pypy__/interp_os.py b/pypy/module/__pypy__/interp_os.py new file mode 100644 --- /dev/null +++ b/pypy/module/__pypy__/interp_os.py @@ -0,0 +1,9 @@ +import os + +from pypy.interpreter.gateway import unwrap_spec + + +@unwrap_spec(name='str0') +def real_getenv(space, name): +"""Get an OS environment value skipping Python cache""" +return space.wrap(os.environ.get(name)) diff --git a/pypy/module/__pypy__/test/test_os.py b/pypy/module/__pypy__/test/test_os.py new file mode 100644 --- /dev/null +++ b/pypy/module/__pypy__/test/test_os.py @@ -0,0 +1,16 @@ +class AppTestOs: +spaceconfig = dict(usemodules=['__pypy__']) + +def test_real_getenv(self): +import __pypy__.os +import os + +key = 'UNLIKELY_SET' +assert key not in os.environ +os.putenv(key, '42') +# this one skips Python cache +assert __pypy__.os.real_getenv(key) == '42' +# this one can only see things set on interpter start (cached) +assert os.getenv(key) is None +os.unsetenv(key) +assert __pypy__.os.real_getenv(key) is None ___ pypy-commit
[pypy-commit] pypy pythoninspect-fix: implement __pypy__.os.real_getenv with a test
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65664:8f98f2b808f9 Date: 2013-07-23 22:52 +0200 http://bitbucket.org/pypy/pypy/changeset/8f98f2b808f9/ Log:implement __pypy__.os.real_getenv with a test diff --git a/pypy/module/__pypy__/__init__.py b/pypy/module/__pypy__/__init__.py --- a/pypy/module/__pypy__/__init__.py +++ b/pypy/module/__pypy__/__init__.py @@ -50,6 +50,13 @@ } +class OsModule(MixedModule): +appleveldefs = {} +interpleveldefs = { +'real_getenv': 'interp_os.real_getenv' +} + + class Module(MixedModule): appleveldefs = { } @@ -82,6 +89,7 @@ "time": TimeModule, "thread": ThreadModule, "intop": IntOpModule, +"os": OsModule, } def setup_after_space_initialization(self): diff --git a/pypy/module/__pypy__/interp_os.py b/pypy/module/__pypy__/interp_os.py new file mode 100644 --- /dev/null +++ b/pypy/module/__pypy__/interp_os.py @@ -0,0 +1,9 @@ +from rpython.rtyper.module.ll_os_environ import getenv_llimpl + +from pypy.interpreter.gateway import unwrap_spec + + +@unwrap_spec(name=str) +def real_getenv(space, name): +"""Get an OS environment value skipping Python cache""" +return space.wrap(getenv_llimpl(name)) diff --git a/pypy/module/__pypy__/test/test_os.py b/pypy/module/__pypy__/test/test_os.py new file mode 100644 --- /dev/null +++ b/pypy/module/__pypy__/test/test_os.py @@ -0,0 +1,16 @@ +class AppTestOs: +spaceconfig = dict(usemodules=['__pypy__']) + +def test_real_getenv(self): +import __pypy__.os +import os + +key = 'UNLIKELY_SET' +assert key not in os.environ +os.putenv(key, '42') +# this one skips Python cache +assert __pypy__.os.real_getenv(key) == '42' +# this one can only see things set on interpter start (cached) +assert os.getenv(key) is None +os.unsetenv(key) +assert __pypy__.os.real_getenv(key) is None ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: argh
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65672:e026c95e2f05 Date: 2013-07-25 22:25 +0200 http://bitbucket.org/pypy/pypy/changeset/e026c95e2f05/ Log:argh 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 @@ -43,4 +43,3 @@ .. branch: statvfs_tests Added some addition tests for statvfs. ->>> other ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pythoninspect-fix: skip on CPython, whatsnew
Author: Paweł Piotr Przeradowski Branch: pythoninspect-fix Changeset: r65669:a4689d27a2ef Date: 2013-07-25 21:49 +0200 http://bitbucket.org/pypy/pypy/changeset/a4689d27a2ef/ Log:skip on CPython, 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 @@ -31,3 +31,9 @@ more precise information about which functions can be called. Needed for Topaz. .. branch: ssl_moving_write_buffer + +.. branch: pythoninspect-fix +Make PyPy respect PYTHONINSPECT variable set via os.putenv in the same process +to start interactive prompt when the script execution finishes. This adds +new __pypy__.os.real_getenv call that bypasses Python cache and looksup env +in the underlying OS. Translatorshell now works on PyPy. diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -707,6 +707,11 @@ assert '42\n' in data def test_putenv_fires_interactive_within_process(self): +try: +import __pypy__ +except ImportError: +py.test.skip("This can be only tested on PyPy with get_realenv") + # should be noninteractive when piped in data = 'import os\nos.putenv("PYTHONINSPECT", "1")\n' self.run('', senddata=data, expect_prompt=False) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] cffi windows: un-tabify, function call needs at least 40 bytes stack size
Author: matti Branch: windows Changeset: r1294:7cc661ada4a5 Date: 2013-07-25 23:34 +0300 http://bitbucket.org/cffi/cffi/changeset/7cc661ada4a5/ Log:un-tabify, function call needs at least 40 bytes stack size diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -3987,8 +3987,13 @@ if (cif_descr != NULL) { /* exchange data size */ +#ifdef _WIN64 +cif_descr->exchange_size = exchange_offset<40? 40 : exchange_offset; +#else cif_descr->exchange_size = exchange_offset; -} +#endif + } + return 0; } diff --git a/c/libffi_msvc/ffi.c b/c/libffi_msvc/ffi.c --- a/c/libffi_msvc/ffi.c +++ b/c/libffi_msvc/ffi.c @@ -62,46 +62,46 @@ /* Align if necessary */ if ((sizeof(void *) - 1) & (size_t) argp) - argp = (char *) ALIGN(argp, sizeof(void *)); + argp = (char *) ALIGN(argp, sizeof(void *)); z = (*p_arg)->size; if (z < sizeof(int)) - { - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; + { +z = sizeof(int); +switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: +*(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); +break; - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; + case FFI_TYPE_UINT8: +*(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); +break; - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; + case FFI_TYPE_SINT16: +*(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); +break; - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; + case FFI_TYPE_UINT16: +*(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); +break; - case FFI_TYPE_SINT32: - *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); - break; + case FFI_TYPE_SINT32: +*(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); +break; - case FFI_TYPE_UINT32: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - break; + case FFI_TYPE_UINT32: +*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); +break; - case FFI_TYPE_STRUCT: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - break; + case FFI_TYPE_STRUCT: +*(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); +break; - default: - FFI_ASSERT(0); - } - } + default: +FFI_ASSERT(0); + } + } #ifdef _WIN64 else if (z > 8) { @@ -112,9 +112,9 @@ } #endif else - { - memcpy(argp, *p_argv, z); - } + { +memcpy(argp, *p_argv, z); + } p_argv++; argp += z; } @@ -170,34 +170,34 @@ #ifdef _WIN32 extern int ffi_call_x86(void (*)(char *, extended_cif *), -/*@out@*/ extended_cif *, -unsigned, unsigned, -/*@out@*/ unsigned *, -void (*fn)()); + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, + void (*fn)()); #endif #ifdef _WIN64 extern int ffi_call_AMD64(void (*)(char *, extended_cif *), -/*@out@*/ extended_cif *, -unsigned, unsigned, -/*@out@*/ unsigned *, -void (*fn)()); + /*@out@*/ extended_cif *, + unsigned, unsigned, + /*@out@*/ unsigned *, + void (*fn)()); #endif int ffi_call(/*@dependent@*/ ffi_cif *cif, -void (*fn)(), -/*@out@*/ void *rvalue, -/*@dependent@*/ void **avalue) + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; - /* If the return value is a struct and we don't have a return*/ - /* value address then we need to make one*/ + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one*/ if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) @@ -216,14 +216,14 @@ case FFI_SYSV: case FFI_STDCALL: return ffi_call_x86(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); +cif->flags, ecif.rvalue, fn); break; #else case FFI_SYSV: /*@-usedef@*/ /* Function call needs at least 40 bytes stack size, on win64 AMD64 */ return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes ? cif->bytes : 40, -
[pypy-commit] cffi windows: another place where function call needs at least 40 bytes stack size
Author: matti Branch: windows Changeset: r1295:55d1624ba4be Date: 2013-07-26 00:46 +0300 http://bitbucket.org/cffi/cffi/changeset/55d1624ba4be/ Log:another place where function call needs at least 40 bytes stack size diff --git a/c/libffi_msvc/prep_cif.c b/c/libffi_msvc/prep_cif.c --- a/c/libffi_msvc/prep_cif.c +++ b/c/libffi_msvc/prep_cif.c @@ -161,13 +161,16 @@ /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); - + #endif bytes += STACK_ARG_SIZE((*ptr)->size); } #endif } +#if defined(_MSC_VER) && defined(_WIN64) + bytes = bytes < 40 ? 40 : bytes; +#endif cif->bytes = bytes; /* Perform machine dependent cif processing */ ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: merge default
Author: Philip Jenvey Branch: py3k Changeset: r65675:c8db1997988c Date: 2013-07-25 16:40 -0700 http://bitbucket.org/pypy/pypy/changeset/c8db1997988c/ Log:merge default diff --git a/lib-python/2.7/test/test_os.py b/lib-python/2.7/test/test_os.py --- a/lib-python/2.7/test/test_os.py +++ b/lib-python/2.7/test/test_os.py @@ -275,7 +275,7 @@ try: result.f_bfree = 1 self.fail("No exception thrown") -except TypeError: +except (TypeError, AttributeError): pass try: diff --git a/pypy/doc/coding-guide.rst b/pypy/doc/coding-guide.rst --- a/pypy/doc/coding-guide.rst +++ b/pypy/doc/coding-guide.rst @@ -626,7 +626,7 @@ Here is the order in which PyPy looks up Python modules: -*pypy/modules* +*pypy/module* mixed interpreter/app-level builtin modules, such as the ``sys`` and ``__builtin__`` module. @@ -657,7 +657,7 @@ on some classes being old-style. We just maintain those changes in place, -to see what is changed we have a branch called `vendot/stdlib` +to see what is changed we have a branch called `vendor/stdlib` wich contains the unmodified cpython stdlib .. _`mixed module mechanism`: diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst --- a/pypy/doc/how-to-release.rst +++ b/pypy/doc/how-to-release.rst @@ -30,7 +30,7 @@ * update README * change the tracker to have a new release tag to file bugs against * go to pypy/tool/release and run: - force-builds.py /release/ + force-builds.py * wait for builds to complete, make sure there are no failures * upload binaries to https://bitbucket.org/pypy/pypy/downloads diff --git a/pypy/doc/release-2.1.0-beta2.rst b/pypy/doc/release-2.1.0-beta2.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-2.1.0-beta2.rst @@ -0,0 +1,62 @@ +=== +PyPy 2.1 beta 2 +=== + +We're pleased to announce the second beta of the upcoming 2.1 release of PyPy. +This beta adds one new feature to the 2.1 release and contains several bugfixes listed below. + +Highlights +== + +* Support for os.statvfs and os.fstatvfs on unix systems. + +* Fixed issue `1533`_: fix an RPython-level OverflowError for space.float_w(w_big_long_number). + +* Fixed issue `1552`_: GreenletExit should inherit from BaseException. + +* Fixed issue `1537`_: numpypy __array_interface__ + +* Fixed issue `1238`_: Writing to an SSL socket in pypy sometimes failed with a "bad write retry" message. + +* `distutils`_: copy CPython's implementation of customize_compiler, dont call + split on environment variables, honour CFLAGS, CPPFLAGS, LDSHARED and + LDFLAGS. + +* During packaging, compile the CFFI tk extension. + +.. _`1533`: https://bugs.pypy.org/issue1533 +.. _`1552`: https://bugs.pypy.org/issue1552 +.. _`1537`: https://bugs.pypy.org/issue1537 +.. _`1238`: https://bugs.pypy.org/issue1238 +.. _`distutils`: https://bitbucket.org/pypy/pypy/src/0c6eeae0316c11146f47fcf83e21e24f11378be1/?at=distutils-cppldflags + + +What is PyPy? += + +PyPy is a very compliant Python interpreter, almost a drop-in replacement for +CPython 2.7.3. It's fast due to its integrated tracing JIT compiler. + +This release supports x86 machines running Linux 32/64, Mac OS X 64 or Windows +32. Also this release supports ARM machines running Linux 32bit - anything with +``ARMv6`` (like the Raspberry Pi) or ``ARMv7`` (like Beagleboard, +Chromebook, Cubieboard, etc.) that supports ``VFPv3`` should work. + +Windows 64 work is still stalling, we would welcome a volunteer +to handle that. + +How to use PyPy? + + +We suggest using PyPy from a `virtualenv`_. Once you have a virtualenv +installed, you can follow instructions from `pypy documentation`_ on how +to proceed. This document also covers other `installation schemes`_. + +.. _`pypy documentation`: http://doc.pypy.org/en/latest/getting-started.html#installing-using-virtualenv +.. _`virtualenv`: http://www.virtualenv.org/en/latest/ +.. _`installation schemes`: http://doc.pypy.org/en/latest/getting-started.html#installing-pypy +.. _`PyPy and pip`: http://doc.pypy.org/en/latest/getting-started.html#installing-pypy + + +Cheers, +The PyPy Team. diff --git a/pypy/doc/rffi.rst b/pypy/doc/rffi.rst --- a/pypy/doc/rffi.rst +++ b/pypy/doc/rffi.rst @@ -43,7 +43,7 @@ See cbuild_ for more info on ExternalCompilationInfo. .. _`low level types`: rtyper.html#low-level-type -.. _cbuild: https://bitbucket.org/pypy/pypy/src/tip/pypy/translator/tool/cbuild.py +.. _cbuild: https://bitbucket.org/pypy/pypy/src/tip/rpython/translator/tool/cbuild.py Types @@ -69,9 +69,3 @@ as a fake low-level implementation for tests performed by an llinterp. .. _`extfunc.py`: https://bitbucket.org/pypy/pypy/src/tip/pypy/rpython/extfunc.py - - -OO backends - -XXX to be written 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 @@ -31,3 +31,15
[pypy-commit] pypy py3k: now bytes on py3
Author: Philip Jenvey Branch: py3k Changeset: r65676:d962b5d6ed78 Date: 2013-07-25 17:01 -0700 http://bitbucket.org/pypy/pypy/changeset/d962b5d6ed78/ Log:now bytes on py3 diff --git a/pypy/module/_ffi/test/test_type_converter.py b/pypy/module/_ffi/test/test_type_converter.py --- a/pypy/module/_ffi/test/test_type_converter.py +++ b/pypy/module/_ffi/test/test_type_converter.py @@ -119,7 +119,7 @@ def test_strings(self): # first, try automatic conversion from applevel -self.check(app_types.char_p, self.space.wrap('foo'), 'foo') +self.check(app_types.char_p, self.space.wrapbytes('foo'), 'foo') self.check(app_types.unichar_p, self.space.wrap(u'foo\u1234'), u'foo\u1234') self.check(app_types.unichar_p, self.space.wrap('foo'), u'foo') # then, try to pass explicit pointers ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: path of least resistance: workaround dlerror returning junk messages under
Author: Philip Jenvey Branch: py3k Changeset: r65677:191650bed89e Date: 2013-07-25 17:02 -0700 http://bitbucket.org/pypy/pypy/changeset/191650bed89e/ Log:path of least resistance: workaround dlerror returning junk messages under ll2ctypes on the buildbot diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py --- a/pypy/module/_rawffi/interp_rawffi.py +++ b/pypy/module/_rawffi/interp_rawffi.py @@ -5,6 +5,7 @@ from pypy.objspace.std.stringtype import getbytevalue from rpython.rlib.clibffi import * +from rpython.rlib.objectmodel import we_are_translated from rpython.rtyper.lltypesystem import lltype, rffi from rpython.rtyper.tool import rffi_platform from rpython.rlib.unroll import unrolling_iterable @@ -142,7 +143,13 @@ space.wrap("not supported by libffi")) def wrap_dlopenerror(space, e, filename): -msg = e.msg if e.msg else 'unspecified error' +if e.msg: +# dlerror can return garbage messages under ll2ctypes (not +# we_are_translated()), so repr it to avoid potential problems +# converting to unicode later +msg = e.msg if we_are_translated() else repr(e.msg) +else: +msg = 'unspecified error' return operationerrfmt(space.w_OSError, 'Cannot load library %s: %s', filename, msg) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: add a wrap_dlopenerror for consistency's sake
Author: Philip Jenvey Branch: Changeset: r65674:29a9e38aedb6 Date: 2013-07-25 16:26 -0700 http://bitbucket.org/pypy/pypy/changeset/29a9e38aedb6/ Log:add a wrap_dlopenerror for consistency's sake diff --git a/pypy/module/_cffi_backend/libraryobj.py b/pypy/module/_cffi_backend/libraryobj.py --- a/pypy/module/_cffi_backend/libraryobj.py +++ b/pypy/module/_cffi_backend/libraryobj.py @@ -4,6 +4,7 @@ from pypy.interpreter.error import operationerrfmt from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.typedef import TypeDef +from pypy.module._rawffi.interp_rawffi import wrap_dlopenerror from rpython.rtyper.lltypesystem import rffi from rpython.rlib.rdynload import DLLHANDLE, dlopen, dlsym, dlclose, DLOpenError @@ -24,9 +25,7 @@ try: self.handle = dlopen(ll_libname, flags) except DLOpenError, e: -raise operationerrfmt(space.w_OSError, - "cannot load library %s: %s", - filename, e.msg) +raise wrap_dlopenerror(space, e, filename) self.name = filename def __del__(self): diff --git a/pypy/module/_ffi/interp_funcptr.py b/pypy/module/_ffi/interp_funcptr.py --- a/pypy/module/_ffi/interp_funcptr.py +++ b/pypy/module/_ffi/interp_funcptr.py @@ -14,7 +14,7 @@ from rpython.rlib.rarithmetic import r_uint from rpython.rlib.objectmodel import we_are_translated from pypy.module._ffi.type_converter import FromAppLevelConverter, ToAppLevelConverter -from pypy.module._rawffi.interp_rawffi import got_libffi_error +from pypy.module._rawffi.interp_rawffi import got_libffi_error, wrap_dlopenerror import os if os.name == 'nt': @@ -324,8 +324,7 @@ try: self.cdll = libffi.CDLL(name, mode) except DLOpenError, e: -raise operationerrfmt(space.w_OSError, '%s: %s', self.name, - e.msg or 'unspecified error') +raise wrap_dlopenerror(space, e, self.name) def getfunc(self, space, w_name, w_argtypes, w_restype): return _getfunc(space, self, w_name, w_argtypes, w_restype) diff --git a/pypy/module/_rawffi/interp_rawffi.py b/pypy/module/_rawffi/interp_rawffi.py --- a/pypy/module/_rawffi/interp_rawffi.py +++ b/pypy/module/_rawffi/interp_rawffi.py @@ -140,6 +140,11 @@ raise OperationError(space.w_SystemError, space.wrap("not supported by libffi")) +def wrap_dlopenerror(space, e, filename): +msg = e.msg if e.msg else 'unspecified error' +return operationerrfmt(space.w_OSError, 'Cannot load library %s: %s', + filename, msg) + class W_CDLL(W_Root): def __init__(self, space, name, cdll): @@ -219,8 +224,7 @@ try: cdll = CDLL(name) except DLOpenError, e: -raise operationerrfmt(space.w_OSError, '%s: %s', name, - e.msg or 'unspecified error') +raise wrap_dlopenerror(space, e, name) except OSError, e: raise wrap_oserror(space, e) return space.wrap(W_CDLL(space, name, cdll)) diff --git a/pypy/module/_rawffi/test/test__rawffi.py b/pypy/module/_rawffi/test/test__rawffi.py --- a/pypy/module/_rawffi/test/test__rawffi.py +++ b/pypy/module/_rawffi/test/test__rawffi.py @@ -223,7 +223,8 @@ _rawffi.CDLL("x_this_name_does_not_exist_x") except OSError, e: print e -assert str(e).startswith("x_this_name_does_not_exist_x: ") +assert str(e).startswith( +"Cannot load library x_this_name_does_not_exist_x: ") else: raise AssertionError("did not fail??") ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy pypy3-release-2.1.x: branch for the pypy3 2.1.0 release
Author: Philip Jenvey Branch: pypy3-release-2.1.x Changeset: r65678:1fc106b34e94 Date: 2013-07-25 22:32 -0700 http://bitbucket.org/pypy/pypy/changeset/1fc106b34e94/ Log:branch for the pypy3 2.1.0 release diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py --- a/pypy/doc/conf.py +++ b/pypy/doc/conf.py @@ -47,7 +47,7 @@ # The short X.Y version. version = '2.0' # The full version, including alpha/beta/rc tags. -release = '2.0.2' +release = '2.1.0-beta1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pypy/doc/release-pypy3-2.1.0-beta1.rst b/pypy/doc/release-pypy3-2.1.0-beta1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-pypy3-2.1.0-beta1.rst @@ -0,0 +1,60 @@ +== +PyPy3 2.1.0 beta 1 +== + +We're pleased to announce the first beta of the upcoming 2.1.0 release of +PyPy3. This is the first release of PyPy which targets Python 3.2 +compatibility. + +We would like to thank all of the people who donated_ to the `py3k proposal`_ +for supporting the work that went into this and future releases. + +You can download the PyPy3 2.1.0 beta 1 release here: + +http://pypy.org/download.html + +Highlights +== + +* The first release of PyPy3: support for Python 3, targetting CPython 3.2.3! + Albeit with a few missing features: + + - The stdlib test_memoryview includes some failing tests (marked to +skip) and test_multiprocessing is known to deadlock on some +platforms + + - There are some known performance regressions (issues `#1540`_ & +`#1541`_) slated to be resolved before the final release + + - NumPyPy is currently disabled + +What is PyPy3? +== + +PyPy3 is a very compliant Python interpreter, almost a drop-in replacement for +CPython 3.2.3. It's fast due to its integrated tracing JIT compiler. + +This release supports x86 machines running Linux 32/64, Mac OS X 64 or Windows +32. However Windows 32 support could use some improvement. + +Windows 64 work is still stalling and we would welcome a volunteer to handle +that. + +How to use PyPy3? += + +We suggest using PyPy from a `virtualenv`_. Once you have a virtualenv +installed, you can follow instructions from `pypy documentation`_ on how +to proceed. This document also covers other `installation schemes`_. + +.. _donated: http://morepypy.blogspot.com/2012/01/py3k-and-numpy-first-stage-thanks-to.html +.. _`py3k proposal`: http://pypy.org/py3donate.html +.. _`#1540`: https://bugs.pypy.org/issue1540 +.. _`#1541`: https://bugs.pypy.org/issue1541 +.. _`pypy documentation`: http://doc.pypy.org/en/latest/getting-started.html#installing-using-virtualenv +.. _`virtualenv`: http://www.virtualenv.org/en/latest/ +.. _`installation schemes`: http://doc.pypy.org/en/latest/getting-started.html#installing-pypy + + +Cheers, +the PyPy team diff --git a/pypy/doc/whatsnew-pypy3-2.1.0-beta1.rst b/pypy/doc/whatsnew-pypy3-2.1.0-beta1.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-pypy3-2.1.0-beta1.rst @@ -0,0 +1,3 @@ += +What's new in PyPy3 2.1.0 += diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h --- a/pypy/module/cpyext/include/patchlevel.h +++ b/pypy/module/cpyext/include/patchlevel.h @@ -29,7 +29,7 @@ #define PY_VERSION "3.2.3" /* PyPy version as a string */ -#define PYPY_VERSION "2.1.0-alpha0" +#define PYPY_VERSION "2.1.0-beta1" /* Subversion Revision number of this file (not of the repository). * Empty since Mercurial migration. */ 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 @@ -11,7 +11,7 @@ #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py CPYTHON_API_VERSION= 1013 #XXX # sync with include/modsupport.h -PYPY_VERSION = (2, 1, 0, "alpha", 0)#XXX # sync patchlevel.h +PYPY_VERSION = (2, 1, 0, "beta", 1)#XXX # sync patchlevel.h if platform.name == 'msvc': COMPILER_INFO = 'MSC v.%d 32 bit' % (platform.version * 10 + 600) ___ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit