Author: Manuel Jacob <m...@manueljacob.de> Branch: py3k Changeset: r82515:299018381016 Date: 2016-02-25 16:38 +0100 http://bitbucket.org/pypy/pypy/changeset/299018381016/
Log: hg merge default diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -41,29 +41,29 @@ Amaury Forgeot d'Arc Antonio Cuni Samuele Pedroni + Matti Picus Alex Gaynor Brian Kearns - Matti Picus Philip Jenvey Michael Hudson + Ronan Lamy David Schneider + Manuel Jacob Holger Krekel Christian Tismer Hakan Ardo - Manuel Jacob - Ronan Lamy Benjamin Peterson + Richard Plangger Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen - Richard Plangger Richard Emslie Alexander Schremmer Dan Villiom Podlaski Christiansen + Remi Meier Lukas Diekmann Sven Hager Anders Lehmann - Remi Meier Aurelien Campeas Niklaus Haldimann Camillo Bruni @@ -72,8 +72,8 @@ Romain Guillebert Leonardo Santagada Seo Sanghyeon + Ronny Pfannschmidt Justin Peel - Ronny Pfannschmidt David Edelsohn Anders Hammarquist Jakub Gustak @@ -95,6 +95,7 @@ Tyler Wade Michael Foord Stephan Diehl + Vincent Legoll Stefan Schwarzer Valentino Volonghi Tomek Meka @@ -105,9 +106,9 @@ Jean-Paul Calderone Timo Paulssen Squeaky + Marius Gedminas Alexandre Fayolle Simon Burton - Marius Gedminas Martin Matusiak Konstantin Lopuhin Wenzhu Man @@ -116,16 +117,20 @@ Ivan Sichmann Freitas Greg Price Dario Bertini + Stefano Rivera Mark Pearse Simon Cross Andreas Stührk - Stefano Rivera + Edd Barrett Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov + Jeremy Thurgood Paweł Piotr Przeradowski + Spenser Bauman Paul deGrandis Ilya Osadchiy + marky1991 Tobias Oberstein Adrian Kuhn Boris Feigin @@ -134,14 +139,12 @@ Georg Brandl Bert Freudenberg Stian Andreassen - Edd Barrett + Tobias Pape Wanja Saatkamp Gerald Klix Mike Blume - Tobias Pape Oscar Nierstrasz Stefan H. Muller - Jeremy Thurgood Rami Chowdhury Eugene Oden Henry Mason @@ -153,6 +156,8 @@ Lukas Renggli Guenter Jantzen Ned Batchelder + Tim Felgentreff + Anton Gulenko Amit Regmi Ben Young Nicolas Chauvat @@ -162,12 +167,12 @@ Nicholas Riley Jason Chu Igor Trindade Oliveira - Tim Felgentreff + Yichao Yu Rocco Moretti Gintautas Miliauskas Michael Twomey Lucian Branescu Mihaila - Yichao Yu + Devin Jeanpierre Gabriel Lavoie Olivier Dormond Jared Grubb @@ -191,33 +196,33 @@ Stanislaw Halik Mikael Schönenberg Berkin Ilbeyi - Elmo M?ntynen + Elmo Mäntynen + Faye Zhao Jonathan David Riehl Anders Qvist Corbin Simpson Chirag Jadwani Beatrice During Alex Perry - Vincent Legoll + Vaibhav Sood Alan McIntyre - Spenser Bauman + William Leslie Alexander Sedov Attila Gobi + Jasper.Schulz Christopher Pope - Devin Jeanpierre - Vaibhav Sood Christian Tismer Marc Abramowitz Dan Stromberg Arjun Naik Valentina Mukhamedzhanova Stefano Parmesan + Mark Young Alexis Daboville Jens-Uwe Mager Carl Meyer Karl Ramm Pieter Zieschang - Anton Gulenko Gabriel Lukas Vacek Andrew Dalke @@ -225,6 +230,7 @@ Jakub Stasiak Nathan Taylor Vladimir Kryachko + Omer Katz Jacek Generowicz Alejandro J. Cura Jacob Oscarson @@ -239,6 +245,7 @@ Lars Wassermann Philipp Rustemeuer Henrik Vendelbo + Richard Lancaster Dan Buch Miguel de Val Borro Artur Lisiecki @@ -250,18 +257,18 @@ Tomo Cocoa Kim Jin Su Toni Mattis + Amber Brown Lucas Stadler Julian Berman Markus Holtermann roberto@goyle Yury V. Zaytsev Anna Katrina Dominguez - William Leslie Bobby Impollonia - Faye Zhao t...@eistee.fritz.box Andrew Thompson Yusei Tahara + Aaron Tubbs Ben Darnell Roberto De Ioris Juan Francisco Cantero Hurtado @@ -273,6 +280,7 @@ Christopher Armstrong Michael Hudson-Doyle Anders Sigfridsson + Nikolay Zinov Yasir Suhail Jason Michalski rafalgalczyn...@gmail.com @@ -282,6 +290,7 @@ Gustavo Niemeyer Stephan Busemann Rafał Gałczyński + Matt Bogosian Christian Muirhead Berker Peksag James Lan @@ -316,9 +325,9 @@ Stefan Marr jiaaro Mads Kiilerich - Richard Lancaster opassembler.py Antony Lee + Jason Madden Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer @@ -327,6 +336,7 @@ squeaky Zearin soareschen + Jonas Pfannschmidt Kurt Griffiths Mike Bayer Matthew Miller diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -172,9 +172,6 @@ cmdline="--translationmodules", suggests=[("objspace.allworkingmodules", False)]), - BoolOption("usepycfiles", "Write and read pyc files when importing", - default=True), - StrOption("soabi", "Tag to differentiate extension modules built for different Python interpreters", cmdline="--soabi", 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 @@ -1,5 +1,20 @@ -Making a PyPy Release -===================== +The PyPy Release Process +======================== + +Release Policy +++++++++++++++ + +We try to create a stable release a few times a year. These are released on +a branch named like release-2.x or release-4.x, and each release is tagged, +for instance release-4.0.1. + +After release, inevitably there are bug fixes. It is the responsibility of +the commiter who fixes a bug to make sure this fix is on the release branch, +so that we can then create a tagged bug-fix release, which will hopefully +happen more often than stable releases. + +How to Create a PyPy Release +++++++++++++++++++++++++++++ Overview -------- diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py --- a/pypy/doc/tool/makecontributor.py +++ b/pypy/doc/tool/makecontributor.py @@ -72,6 +72,7 @@ 'Anton Gulenko':['anton gulenko', 'anton_gulenko'], 'Richard Lancaster':['richardlancaster'], 'William Leslie':['William ML Leslie'], + 'Spenser Bauman':['Spenser Andrew Bauman'], } alias_map = {} diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -282,9 +282,6 @@ elif config.objspace.usemodules.pypyjit: config.translation.jit = True - if config.translation.sandbox: - config.objspace.usepycfiles = False - config.translating = True import translate diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py --- a/pypy/module/imp/importing.py +++ b/pypy/module/imp/importing.py @@ -76,13 +76,6 @@ if file_exists(pyfile): return PY_SOURCE, ".pyw", "U" - # The .py file does not exist, check the .pyc file - if space.config.objspace.usepycfiles: - pycfile = filepart + ".pyc" - if file_exists(pycfile): - # existing .pyc file - return PY_COMPILED, ".pyc", "rb" - if has_so_extension(space): so_extension = get_so_extension(space) pydfile = filepart + so_extension @@ -978,17 +971,11 @@ """ w = space.wrap - if space.config.objspace.usepycfiles: - src_stat = os.fstat(fd) - cpathname = make_compiled_pathname(pathname) - mtime = int(src_stat[stat.ST_MTIME]) - mode = src_stat[stat.ST_MODE] - stream = check_compiled_module(space, cpathname, mtime) - else: - cpathname = None - mtime = 0 - mode = 0 - stream = None + src_stat = os.fstat(fd) + cpathname = make_compiled_pathname(pathname) + mtime = int(src_stat[stat.ST_MTIME]) + mode = src_stat[stat.ST_MODE] + stream = check_compiled_module(space, cpathname, mtime) if stream: # existing and up-to-date .pyc file @@ -1002,7 +989,7 @@ else: code_w = parse_source_module(space, pathname, source) - if space.config.objspace.usepycfiles and write_pyc: + if write_pyc: if not space.is_true(space.sys.get('dont_write_bytecode')): write_compiled_module(space, code_w, cpathname, mode, mtime) diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py --- a/pypy/module/imp/test/test_import.py +++ b/pypy/module/imp/test/test_import.py @@ -104,6 +104,10 @@ 'a=5\nb=6\rc="""hello\r\nworld"""\r', mode='wb') p.join('mod.py').write( 'a=15\nb=16\rc="""foo\r\nbar"""\r', mode='wb') + setuppkg("test_bytecode", + a = '', + b = '', + c = '') p = setuppkg("encoded", # actually a line 2, setuppkg() sets up a line1 line2 = "# encoding: iso-8859-1\n", @@ -159,7 +163,7 @@ stream.try_to_find_file_descriptor()) finally: stream.close() - if space.config.objspace.usepycfiles: + if not space.config.translation.sandbox: # also create a lone .pyc file p.join('lone.pyc').write(p.join(pycname).read(mode='rb'), mode='wb') @@ -190,6 +194,9 @@ """) def _teardown(space, w_saved_modules): + p = udir.join('impsubdir') + if p.check(): + p.remove() space.appexec([w_saved_modules], """ (path_and_modules): saved_path, saved_modules = path_and_modules @@ -1501,13 +1508,55 @@ assert isinstance(importer, zipimport.zipimporter) -class AppTestNoPycFile(object): +class AppTestWriteBytecode(object): spaceconfig = { - "objspace.usepycfiles": False, + "translation.sandbox": False } + def setup_class(cls): - usepycfiles = cls.spaceconfig['objspace.usepycfiles'] - cls.w_usepycfiles = cls.space.wrap(usepycfiles) + cls.saved_modules = _setup(cls) + sandbox = cls.spaceconfig['translation.sandbox'] + cls.w_sandbox = cls.space.wrap(sandbox) + + def teardown_class(cls): + _teardown(cls.space, cls.saved_modules) + cls.space.appexec([], """ + (): + import sys + sys.dont_write_bytecode = False + """) + + def test_default(self): + import os.path + from test_bytecode import a + assert a.__file__.endswith('a.py') + assert os.path.exists(a.__cached__) == (not self.sandbox) + + def test_write_bytecode(self): + import os.path + import sys + sys.dont_write_bytecode = False + from test_bytecode import b + assert b.__file__.endswith('b.py') + assert os.path.exists(b.__cached__) + + def test_dont_write_bytecode(self): + import os.path + import sys + sys.dont_write_bytecode = True + from test_bytecode import c + assert c.__file__.endswith('c.py') + assert not os.path.exists(c.__cached__) + + +class AppTestWriteBytecodeSandbox(AppTestWriteBytecode): + spaceconfig = { + "translation.sandbox": True + } + + +class AppTestNoLonePycFile(object): + def setup_class(cls): cls.saved_modules = _setup(cls) def teardown_class(cls): @@ -1519,15 +1568,10 @@ try: from compiled import lone except ImportError: - assert not self.usepycfiles + pass else: assert lone.__cached__.endswith('.pyc') -class AppTestNoLonePycFile(AppTestNoPycFile): - spaceconfig = { - "objspace.usepycfiles": True, - } - class AppTestMultithreadedImp(object): spaceconfig = dict(usemodules=['thread', 'time']) diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py --- a/pypy/module/sys/__init__.py +++ b/pypy/module/sys/__init__.py @@ -70,7 +70,7 @@ 'meta_path' : 'space.wrap([])', 'path_hooks' : 'space.wrap([])', 'path_importer_cache' : 'space.wrap({})', - 'dont_write_bytecode' : 'space.w_False', + 'dont_write_bytecode' : 'space.wrap(space.config.translation.sandbox)', 'getdefaultencoding' : 'interp_encoding.getdefaultencoding', 'getfilesystemencoding' : 'interp_encoding.getfilesystemencoding', diff --git a/pypy/module/sys/app.py b/pypy/module/sys/app.py --- a/pypy/module/sys/app.py +++ b/pypy/module/sys/app.py @@ -69,11 +69,11 @@ return None copyright_str = """ -Copyright 2003-2014 PyPy development team. +Copyright 2003-2016 PyPy development team. All Rights Reserved. For further information, see <http://pypy.org> -Portions Copyright (c) 2001-2014 Python Software Foundation. +Portions Copyright (c) 2001-2016 Python Software Foundation. All Rights Reserved. Portions Copyright (c) 2000 BeOpen.com. diff --git a/pypy/objspace/std/tupleobject.py b/pypy/objspace/std/tupleobject.py --- a/pypy/objspace/std/tupleobject.py +++ b/pypy/objspace/std/tupleobject.py @@ -30,6 +30,11 @@ contains_jmp = jit.JitDriver(greens = ['tp'], reds = 'auto', name = 'tuple.contains') +hash_driver = jit.JitDriver( + name='tuple.hash', + greens=['w_type'], + reds='auto') + class W_AbstractTupleObject(W_Root): __slots__ = () @@ -258,8 +263,14 @@ def length(self): return len(self.wrappeditems) - @jit.look_inside_iff(lambda self, _1: _unroll_condition(self)) def descr_hash(self, space): + if _unroll_condition(self): + return self._descr_hash_unroll(space) + else: + return self._descr_hash_jitdriver(space) + + @jit.unroll_safe + def _descr_hash_unroll(self, space): mult = 1000003 x = 0x345678 z = len(self.wrappeditems) @@ -271,6 +282,20 @@ x += 97531 return space.wrap(intmask(x)) + def _descr_hash_jitdriver(self, space): + mult = 1000003 + x = 0x345678 + z = len(self.wrappeditems) + w_type = space.type(self.wrappeditems[0]) + for w_item in self.wrappeditems: + hash_driver.jit_merge_point(w_type=w_type) + y = space.hash_w(w_item) + x = (x ^ y) * mult + z -= 1 + mult += 82520 + z + z + x += 97531 + return space.wrap(intmask(x)) + def descr_eq(self, space, w_other): if not isinstance(w_other, W_AbstractTupleObject): return space.w_NotImplemented diff --git a/pypy/tool/test/test_tab.py b/pypy/tool/test/test_tab.py --- a/pypy/tool/test/test_tab.py +++ b/pypy/tool/test/test_tab.py @@ -6,7 +6,7 @@ from pypy.conftest import pypydir ROOT = os.path.abspath(os.path.join(pypydir, '..')) -EXCLUDE = {} +EXCLUDE = {'/virt_test/lib/python2.7/site-packages/setuptools'} def test_no_tabs(): diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py --- a/rpython/jit/codewriter/jtransform.py +++ b/rpython/jit/codewriter/jtransform.py @@ -2042,6 +2042,11 @@ self.vable_flags[op.args[0]] = op.args[2].value return [] + def rewrite_op_jit_enter_portal_frame(self, op): + return [op] + def rewrite_op_jit_leave_portal_frame(self, op): + return [op] + # --------- # ll_math.sqrt_nonneg() diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -944,6 +944,14 @@ pass @arguments("i") + def bhimpl_jit_enter_portal_frame(x): + pass + + @arguments() + def bhimpl_jit_leave_portal_frame(): + pass + + @arguments("i") def bhimpl_int_assert_green(x): pass @arguments("r") diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -1358,6 +1358,17 @@ self.metainterp.attach_debug_info(op) @arguments("box") + def opimpl_jit_enter_portal_frame(self, uniqueidbox): + unique_id = uniqueidbox.getint() + jd_no = self.metainterp.jitdriver_sd.mainjitcode.index # fish + self.metainterp.enter_portal_frame(jd_no, unique_id) + + @arguments() + def opimpl_jit_leave_portal_frame(self): + jd_no = self.metainterp.jitdriver_sd.mainjitcode.index # fish + self.metainterp.leave_portal_frame(jd_no) + + @arguments("box") def _opimpl_assert_green(self, box): if not isinstance(box, Const): msg = "assert_green failed at %s:%d" % ( diff --git a/rpython/jit/metainterp/test/test_jitdriver.py b/rpython/jit/metainterp/test/test_jitdriver.py --- a/rpython/jit/metainterp/test/test_jitdriver.py +++ b/rpython/jit/metainterp/test/test_jitdriver.py @@ -213,6 +213,21 @@ if op.getopname() == 'enter_portal_frame': assert op.getarg(0).getint() == 0 assert op.getarg(1).getint() == 1 - + + def test_manual_leave_enter_portal_frame(self): + from rpython.rlib import jit + driver = JitDriver(greens=[], reds='auto', is_recursive=True) + + def f(arg): + i = 0 + while i < 100: + driver.jit_merge_point() + jit.enter_portal_frame(42) + jit.leave_portal_frame() + i += 1 + + self.meta_interp(f, [0]) + self.check_resops(enter_portal_frame=1, leave_portal_frame=1) + class TestLLtype(MultipleJitDriversTests, LLJitMixin): pass diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py --- a/rpython/rlib/jit.py +++ b/rpython/rlib/jit.py @@ -284,7 +284,7 @@ def loop_unrolling_heuristic(lst, size, cutoff=2): """ In which cases iterating over items of lst can be unrolled """ - return isvirtual(lst) or (isconstant(size) and size <= cutoff) + return size == 0 or isvirtual(lst) or (isconstant(size) and size <= cutoff) class Entry(ExtRegistryEntry): _about_ = hint @@ -1168,6 +1168,24 @@ hop.exception_is_here() return hop.genop('jit_conditional_call', args_v) +def enter_portal_frame(unique_id): + """call this when starting to interpret a function. calling this is not + necessary for almost all interpreters. The only exception is stackless + interpreters where the portal never calls itself. + """ + from rpython.rtyper.lltypesystem import lltype + from rpython.rtyper.lltypesystem.lloperation import llop + llop.jit_enter_portal_frame(lltype.Void, unique_id) + +def leave_portal_frame(): + """call this after the end of executing a function. calling this is not + necessary for almost all interpreters. The only exception is stackless + interpreters where the portal never calls itself. + """ + from rpython.rtyper.lltypesystem import lltype + from rpython.rtyper.lltypesystem.lloperation import llop + llop.jit_leave_portal_frame(lltype.Void) + class Counters(object): counters=""" TRACING diff --git a/rpython/rlib/test/test_jit.py b/rpython/rlib/test/test_jit.py --- a/rpython/rlib/test/test_jit.py +++ b/rpython/rlib/test/test_jit.py @@ -4,7 +4,8 @@ from rpython.annotator.model import UnionError from rpython.rlib.jit import (hint, we_are_jitted, JitDriver, elidable_promote, JitHintError, oopspec, isconstant, conditional_call, - elidable, unroll_safe, dont_look_inside) + elidable, unroll_safe, dont_look_inside, + enter_portal_frame, leave_portal_frame) from rpython.rlib.rarithmetic import r_uint from rpython.rtyper.test.tool import BaseRtypingTest from rpython.rtyper.lltypesystem import lltype @@ -300,3 +301,11 @@ mix = MixLevelHelperAnnotator(t.rtyper) mix.getgraph(later, [annmodel.s_Bool], annmodel.s_None) mix.finish() + + def test_enter_leave_portal_frame(self): + from rpython.translator.interactive import Translation + def g(): + enter_portal_frame(1) + leave_portal_frame() + t = Translation(g, []) + t.compile_c() # does not crash diff --git a/rpython/rtyper/llinterp.py b/rpython/rtyper/llinterp.py --- a/rpython/rtyper/llinterp.py +++ b/rpython/rtyper/llinterp.py @@ -925,6 +925,21 @@ def op_gc_gcflag_extra(self, subopnum, *args): return self.heap.gcflag_extra(subopnum, *args) + def op_gc_rawrefcount_init(self, *args): + raise NotImplementedError("gc_rawrefcount_init") + + def op_gc_rawrefcount_to_obj(self, *args): + raise NotImplementedError("gc_rawrefcount_to_obj") + + def op_gc_rawrefcount_from_obj(self, *args): + raise NotImplementedError("gc_rawrefcount_from_obj") + + def op_gc_rawrefcount_create_link_pyobj(self, *args): + raise NotImplementedError("gc_rawrefcount_create_link_pyobj") + + def op_gc_rawrefcount_create_link_pypy(self, *args): + raise NotImplementedError("gc_rawrefcount_create_link_pypy") + def op_do_malloc_fixedsize(self): raise NotImplementedError("do_malloc_fixedsize") def op_do_malloc_fixedsize_clear(self): diff --git a/rpython/rtyper/lltypesystem/lloperation.py b/rpython/rtyper/lltypesystem/lloperation.py --- a/rpython/rtyper/lltypesystem/lloperation.py +++ b/rpython/rtyper/lltypesystem/lloperation.py @@ -453,6 +453,8 @@ 'jit_record_exact_class' : LLOp(canrun=True), 'jit_ffi_save_result': LLOp(canrun=True), 'jit_conditional_call': LLOp(), + 'jit_enter_portal_frame': LLOp(canrun=True), + 'jit_leave_portal_frame': LLOp(canrun=True), 'get_exception_addr': LLOp(), 'get_exc_value_addr': LLOp(), 'do_malloc_fixedsize':LLOp(canmallocgc=True), diff --git a/rpython/rtyper/lltypesystem/opimpl.py b/rpython/rtyper/lltypesystem/opimpl.py --- a/rpython/rtyper/lltypesystem/opimpl.py +++ b/rpython/rtyper/lltypesystem/opimpl.py @@ -624,6 +624,12 @@ def op_jit_ffi_save_result(*args): pass +def op_jit_enter_portal_frame(x): + pass + +def op_jit_leave_portal_frame(): + pass + def op_get_group_member(TYPE, grpptr, memberoffset): from rpython.rtyper.lltypesystem import llgroup assert isinstance(memberoffset, llgroup.GroupMemberOffset) diff --git a/rpython/translator/c/funcgen.py b/rpython/translator/c/funcgen.py --- a/rpython/translator/c/funcgen.py +++ b/rpython/translator/c/funcgen.py @@ -842,6 +842,12 @@ def OP_JIT_FFI_SAVE_RESULT(self, op): return '/* JIT_FFI_SAVE_RESULT %s */' % op + def OP_JIT_ENTER_PORTAL_FRAME(self, op): + return '/* JIT_ENTER_PORTAL_FRAME %s */' % op + + def OP_JIT_LEAVE_PORTAL_FRAME(self, op): + return '/* JIT_LEAVE_PORTAL_FRAME %s */' % op + def OP_GET_GROUP_MEMBER(self, op): typename = self.db.gettype(op.result.concretetype) return '%s = (%s)_OP_GET_GROUP_MEMBER(%s, %s);' % ( _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit