[pypy-commit] pypy default: On GNU/Hurd use the sysconf() method (some day, it'll have SMP...)
Author: Stefano Rivera Branch: Changeset: r97158:7fc3484b9993 Date: 2019-08-11 20:49 -0300 http://bitbucket.org/pypy/pypy/changeset/7fc3484b9993/ Log:On GNU/Hurd use the sysconf() method (some day, it'll have SMP...) diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -2542,7 +2542,7 @@ post_include_bits=['RPY_EXTERN int rpy_cpu_count(void);'] # cpu count for linux, windows and mac (+ bsds) # note that the code is copied from cpython and split up here -if sys.platform.startswith('linux'): +if sys.platform.startswith(('linux', 'gnu')): cpucount_eci = ExternalCompilationInfo(includes=["unistd.h"], separate_module_sources=[""" RPY_EXTERN int rpy_cpu_count(void) { ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy winconsoleio: Added a few more functions
Author: andrewjlawrence Branch: winconsoleio Changeset: r97157:d892abac55ac Date: 2019-08-11 23:17 +0100 http://bitbucket.org/pypy/pypy/changeset/d892abac55ac/ Log:Added a few more functions diff --git a/pypy/module/_io/__init__.py b/pypy/module/_io/__init__.py --- a/pypy/module/_io/__init__.py +++ b/pypy/module/_io/__init__.py @@ -23,7 +23,7 @@ 'BufferedRWPair': 'interp_bufferedio.W_BufferedRWPair', 'BufferedRandom': 'interp_bufferedio.W_BufferedRandom', 'TextIOWrapper': 'interp_textio.W_TextIOWrapper', -'_WindowsConsoleIO': 'interp_win32consoleio.W_WinConsoleIO', +'WindowsConsoleIO': 'interp_win32consoleio.W_WinConsoleIO', 'open': 'interp_io.open', 'IncrementalNewlineDecoder': 'interp_textio.W_IncrementalNewlineDecoder', diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py --- a/pypy/module/_io/interp_io.py +++ b/pypy/module/_io/interp_io.py @@ -95,7 +95,8 @@ rawclass = W_FileIO if _WIN32: from pypy.module._io.interp_win32consoleio import W_WinConsoleIO, _pyio_get_console_type -if _pyio_get_console_type(space, w_file) != '\0': +type = _pyio_get_console_type(space, w_file) +if type != '\0': rawclass = W_WinConsoleIO encoding = "utf-8" diff --git a/pypy/module/_io/interp_win32consoleio.py b/pypy/module/_io/interp_win32consoleio.py --- a/pypy/module/_io/interp_win32consoleio.py +++ b/pypy/module/_io/interp_win32consoleio.py @@ -16,6 +16,10 @@ SMALLBUF = 4 +def err_closed(space): +raise oefmt(space.w_ValueError, +"I/O operation on closed file") + def _get_console_type(handle): mode = lltype.malloc(rwin32.LPDWORD.TO,0,flavor='raw') peek_count = lltype.malloc(rwin32.LPDWORD.TO,0,flavor='raw') @@ -42,7 +46,7 @@ return '\0' return _get_console_type(handle) - +return None decoded = space.fsdecode_w(w_path_or_fd) if not decoded: return '\0' @@ -54,14 +58,15 @@ m = '\0' # In CPython the _wcsicmp function is used to perform case insensitive comparison -normdecoded = unicodedata.normalize("NFKD", decoded.lower()) -if normdecoded == unicodedata.normalize("NFKD", "CONIN$".lower()): +decoded.lower() +if not rwin32.wcsicmp(decoded_wstr, "CONIN$"): m = 'r' -elif normdecoded == unicodedata.normalize("NFKD", "CONOUT$".lower()): +elif not rwin32.wcsicmp(decoded_wstr, "CONOUT$"): m = 'w' -elif normdecoded == unicodedata.normalize("NFKD", "CON".lower()): +elif not rwin32.wcsicmp(decoded_wstr, "CON"): m = 'x' + if m != '\0': return m @@ -85,15 +90,13 @@ if length >= 4 and pname_buf[3] == '\\' and \ (pname_buf[2] == '.' or pname_buf[2] == '?') and \ pname_buf[1] == '\\' and pname_buf[0] == '\\': - pname_buf += 4 -normdecoded = unicodedata.normalize("NFKD", decoded.lower()) -if normdecoded == unicodedata.normalize("NFKD", "CONIN$".lower()): -m = 'r' -elif normdecoded == unicodedata.normalize("NFKD", "CONOUT$".lower()): -m = 'w' -elif normdecoded == unicodedata.normalize("NFKD", "CON".lower()): -m = 'x' - +pname_buf += 4 +if not rwin32.wcsicmp(decoded_wstr, "CONIN$"): +m = 'r' +elif not rwin32.wcsicmp(decoded_wstr, "CONOUT$"): +m = 'w' +elif not rwin32.wcsicmp(decoded_wstr, "CON"): +m = 'x' lltype.free(pname_buf, flavor='raw') return m @@ -109,11 +112,12 @@ self.closehandle = 0 self.blksize = 0 -def _internal_close(self, space): -pass +# def _internal_close(self, space): +# pass @unwrap_spec(w_mode=WrappedDefault("r"), w_closefd=WrappedDefault(True), w_opener=WrappedDefault(None)) def descr_init(self, space, w_nameobj, w_mode, w_closefd, w_opener): +return None #self.fd = -1 #self.created = 0 name = None @@ -220,7 +224,22 @@ lltype.free(self.buf, flavor='raw') return None - + +def readable_w(self, space): +if self.handle == rwin32.INVALID_HANDLE_VALUE: +return err_closed(space) +return space.newbool(self.readable) + +def writable_w(self, space): +if self.handle == rwin32.INVALID_HANDLE_VALUE: +return err_closed(space) +return space.newbool(self.writable) + +def isatty_w(self, space): +if self.handle == rwin32.INVALID_HANDLE_VALUE: +return err_closed(space) +return space.newbool(True) + def repr_w(self, space): typename = space.type(self).name try: @@ -241,12 +260,26 @@ self.fd = rwin32.open_osfhandle(self.handle, rwin32._O_RDONLY |
[pypy-commit] pypy py3.6: Remove the only usage of open() in the py3.6 core parts (as found in the branch
Author: Armin Rigo Branch: py3.6 Changeset: r97153:4006ceea6169 Date: 2019-08-11 22:45 +0200 http://bitbucket.org/pypy/pypy/changeset/4006ceea6169/ Log:Remove the only usage of open() in the py3.6 core parts (as found in the branch py3.6-sandbox-2). Also wrap the raw RPython exceptions that can arise. 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 @@ -7,7 +7,7 @@ from pypy.interpreter.module import Module, init_extra_module_attrs from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.typedef import TypeDef, generic_new_descr -from pypy.interpreter.error import OperationError, oefmt +from pypy.interpreter.error import OperationError, oefmt, wrap_oserror from pypy.interpreter.baseobjspace import W_Root, CannotHaveLock from pypy.interpreter.eval import Code from pypy.interpreter.pycode import PyCode @@ -77,6 +77,22 @@ lib_pypy = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'lib_pypy') +def _readall(space, filename): +try: +fd = os.open(filename, os.O_RDONLY, 0400) +try: +result = [] +while True: +data = os.read(fd, 8192) +if not data: +break +result.append(data) +finally: +os.close(fd) +except OSError as e: +raise wrap_oserror(space, e, filename) +return ''.join(result) + @unwrap_spec(modulename='fsencode', level=int) def importhook(space, modulename, w_globals=None, w_locals=None, w_fromlist=None, level=0): # A minimal version, that can only import builtin and lib_pypy modules! @@ -94,8 +110,7 @@ return space.getbuiltinmodule(modulename) ec = space.getexecutioncontext() -with open(os.path.join(lib_pypy, modulename + '.py')) as fp: -source = fp.read() +source = _readall(space, os.path.join(lib_pypy, modulename + '.py')) pathname = "" % modulename code_w = ec.compiler.compile(source, pathname, 'exec', 0) w_mod = add_module(space, space.newtext(modulename)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6-sandbox-2: comment
Author: Armin Rigo Branch: py3.6-sandbox-2 Changeset: r97155:7f7d17b89d46 Date: 2019-08-11 23:07 +0200 http://bitbucket.org/pypy/pypy/changeset/7f7d17b89d46/ Log:comment diff --git a/pypy/module/posix/interp_scandir.py b/pypy/module/posix/interp_scandir.py --- a/pypy/module/posix/interp_scandir.py +++ b/pypy/module/posix/interp_scandir.py @@ -47,7 +47,7 @@ path_prefix += u'\\' w_path_prefix = space.newtext(path_prefix) if rposix.HAVE_FSTATAT: -dirfd = rposix.c_dirfd(dirp) +dirfd = rposix.c_dirfd(dirp)# may return -1; errors are ignored else: dirfd = -1 return W_ScandirIterator(space, dirp, dirfd, w_path_prefix, result_is_bytes) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6: merge heads
Author: Armin Rigo Branch: py3.6 Changeset: r97156:d21e9a6b4037 Date: 2019-08-11 23:11 +0200 http://bitbucket.org/pypy/pypy/changeset/d21e9a6b4037/ Log:merge heads diff --git a/pypy/module/_cppyy/test/conftest.py b/pypy/module/_cppyy/test/conftest.py --- a/pypy/module/_cppyy/test/conftest.py +++ b/pypy/module/_cppyy/test/conftest.py @@ -5,7 +5,7 @@ @py.test.mark.tryfirst def pytest_runtest_setup(item): -if py.path.local.sysfind('genreflex') is None: +if not disabled and py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi if 'dummy' in lcapi.backend_library: # run only tests that are covered by the dummy backend and tests @@ -33,16 +33,18 @@ def pytest_ignore_collect(path, config): path = str(path) -if py.path.local.sysfind('genreflex') is None and config.option.runappdirect: -return commonprefix([path, THIS_DIR]) == THIS_DIR if disabled: -return commonprefix([path, THIS_DIR]) == THIS_DIR +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True disabled = None def pytest_configure(config): +global disabled if config.getoption('runappdirect') or config.getoption('direct_apptest'): -return # "can't run dummy tests in -A" +if py.path.local.sysfind('genreflex') is None: +disabled = True # can't run dummy tests in -A +return if py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi try: @@ -77,7 +79,6 @@ standalone=False) except CompilationError as e: if '-std=c++14' in str(e): -global disabled disabled = str(e) return raise diff --git a/pypy/module/_vmprof/conftest.py b/pypy/module/_vmprof/conftest.py --- a/pypy/module/_vmprof/conftest.py +++ b/pypy/module/_vmprof/conftest.py @@ -1,8 +1,13 @@ -import py, platform, sys +import pytest +import platform +import sys +from os.path import commonprefix, dirname -def pytest_collect_directory(path, parent): -if platform.machine() == 's390x': -py.test.skip("_vmprof tests skipped") -if sys.platform == 'win32': -py.test.skip("_vmprof tests skipped") -pytest_collect_file = pytest_collect_directory +THIS_DIR = dirname(__file__) + +@pytest.hookimpl(tryfirst=True) +def pytest_ignore_collect(path, config): +path = str(path) +if sys.platform == 'win32' or platform.machine() == 's390x': +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True diff --git a/pypy/testrunner_cfg.py b/pypy/testrunner_cfg.py --- a/pypy/testrunner_cfg.py +++ b/pypy/testrunner_cfg.py @@ -6,6 +6,7 @@ 'memory/test', 'jit/metainterp', 'jit/backend/arm', 'jit/backend/x86', 'jit/backend/zarch', 'module/cpyext/test', +'jit/backend/aarch64', # python3 slowness ... 'module/_cffi_backend/test', 'module/__pypy__/test', ] diff --git a/rpython/jit/backend/aarch64/assembler.py b/rpython/jit/backend/aarch64/assembler.py --- a/rpython/jit/backend/aarch64/assembler.py +++ b/rpython/jit/backend/aarch64/assembler.py @@ -31,6 +31,7 @@ ResOpAssembler.__init__(self, cpu, translate_support_code) self.failure_recovery_code = [0, 0, 0, 0] self.wb_slowpath = [0, 0, 0, 0, 0] +self.stack_check_slowpath = 0 def assemble_loop(self, jd_id, unique_id, logger, loopname, inputargs, operations, looptoken, log): @@ -675,7 +676,7 @@ # new value of nursery_free_adr in r1 and the adr of the new object in # r0. -self.mc.B_ofs_cond(10 * 4, c.LO) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond +self.mc.B_ofs_cond(10 * 4, c.LS) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) @@ -698,7 +699,7 @@ self.mc.CMP_rr(r.x1.value, r.ip0.value) # -self.mc.B_ofs_cond(40, c.LO) # see calculations in malloc_cond +self.mc.B_ofs_cond(40, c.LS) # see calculations in malloc_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) diff --git a/rpython/jit/backend/aarch64/runner.py b/rpython/jit/backend/aarch64/runner.py --- a/rpython/jit/backend/aarch64/runner.py +++ b/rpython/jit/backend/aarch64/runner.py @@ -62,6 +62,12 @@ cast_ptr_to_int._annspecialcase_ = 'specialize:arglltype(0)' cast_ptr_to_int = staticmethod(cast_ptr_to_int) +def build_regalloc(self): +''' for tests''' +from rpython.jit.backend.aarch64.regalloc import Regalloc +assert self.assembler is not None +return Regalloc(self.assembler) + for _i, _r in
[pypy-commit] pypy py3.6-sandbox-2: hg merge py3.6
Author: Armin Rigo Branch: py3.6-sandbox-2 Changeset: r97154:f19d31ff52b6 Date: 2019-08-11 22:55 +0200 http://bitbucket.org/pypy/pypy/changeset/f19d31ff52b6/ Log:hg merge py3.6 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 @@ -7,7 +7,7 @@ from pypy.interpreter.module import Module, init_extra_module_attrs from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.typedef import TypeDef, generic_new_descr -from pypy.interpreter.error import OperationError, oefmt +from pypy.interpreter.error import OperationError, oefmt, wrap_oserror from pypy.interpreter.baseobjspace import W_Root, CannotHaveLock from pypy.interpreter.eval import Code from pypy.interpreter.pycode import PyCode @@ -77,6 +77,22 @@ lib_pypy = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'lib_pypy') +def _readall(space, filename): +try: +fd = os.open(filename, os.O_RDONLY, 0400) +try: +result = [] +while True: +data = os.read(fd, 8192) +if not data: +break +result.append(data) +finally: +os.close(fd) +except OSError as e: +raise wrap_oserror(space, e, filename) +return ''.join(result) + @unwrap_spec(modulename='fsencode', level=int) def importhook(space, modulename, w_globals=None, w_locals=None, w_fromlist=None, level=0): # A minimal version, that can only import builtin and lib_pypy modules! @@ -94,8 +110,7 @@ return space.getbuiltinmodule(modulename) ec = space.getexecutioncontext() -with open(os.path.join(lib_pypy, modulename + '.py')) as fp: -source = fp.read() +source = _readall(space, os.path.join(lib_pypy, modulename + '.py')) pathname = "" % modulename code_w = ec.compiler.compile(source, pathname, 'exec', 0) w_mod = add_module(space, space.newtext(modulename)) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6-sandbox-2: fixes
Author: Armin Rigo Branch: py3.6-sandbox-2 Changeset: r97152:5fadf669fc02 Date: 2019-08-11 22:46 +0200 http://bitbucket.org/pypy/pypy/changeset/5fadf669fc02/ Log:fixes diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -326,7 +326,8 @@ config.translation.jit = True if config.translation.sandbox: -config.objspace.lonepycfiles = False +#config.objspace.lonepycfiles = False --- not available in py3.x +pass if config.objspace.usemodules.cpyext: if config.translation.gc not in ('incminimark', 'boehm'): diff --git a/rpython/rlib/rsiphash.py b/rpython/rlib/rsiphash.py --- a/rpython/rlib/rsiphash.py +++ b/rpython/rlib/rsiphash.py @@ -139,6 +139,8 @@ translator = hop.rtyper.annotator.translator if translator.config.translation.reverse_debugger: return# ignore and use the regular hash, with reverse-debugger +if translator.config.translation.sandbox: +return# ignore and use the regular hash, with sandboxing bk = hop.rtyper.annotator.bookkeeper s_callable = bk.immutablevalue(initialize_from_env) r_callable = hop.rtyper.getrepr(s_callable) ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6: merge default into branch
Author: Matti Picus Branch: py3.6 Changeset: r97151:17f20f51c2cb Date: 2019-08-11 22:47 +0300 http://bitbucket.org/pypy/pypy/changeset/17f20f51c2cb/ Log:merge default into branch diff --git a/pypy/module/_cppyy/test/conftest.py b/pypy/module/_cppyy/test/conftest.py --- a/pypy/module/_cppyy/test/conftest.py +++ b/pypy/module/_cppyy/test/conftest.py @@ -5,7 +5,7 @@ @py.test.mark.tryfirst def pytest_runtest_setup(item): -if py.path.local.sysfind('genreflex') is None: +if not disabled and py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi if 'dummy' in lcapi.backend_library: # run only tests that are covered by the dummy backend and tests @@ -33,16 +33,18 @@ def pytest_ignore_collect(path, config): path = str(path) -if py.path.local.sysfind('genreflex') is None and config.option.runappdirect: -return commonprefix([path, THIS_DIR]) == THIS_DIR if disabled: -return commonprefix([path, THIS_DIR]) == THIS_DIR +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True disabled = None def pytest_configure(config): +global disabled if config.getoption('runappdirect') or config.getoption('direct_apptest'): -return # "can't run dummy tests in -A" +if py.path.local.sysfind('genreflex') is None: +disabled = True # can't run dummy tests in -A +return if py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi try: @@ -77,7 +79,6 @@ standalone=False) except CompilationError as e: if '-std=c++14' in str(e): -global disabled disabled = str(e) return raise diff --git a/pypy/module/_vmprof/conftest.py b/pypy/module/_vmprof/conftest.py --- a/pypy/module/_vmprof/conftest.py +++ b/pypy/module/_vmprof/conftest.py @@ -1,8 +1,13 @@ -import py, platform, sys +import pytest +import platform +import sys +from os.path import commonprefix, dirname -def pytest_collect_directory(path, parent): -if platform.machine() == 's390x': -py.test.skip("_vmprof tests skipped") -if sys.platform == 'win32': -py.test.skip("_vmprof tests skipped") -pytest_collect_file = pytest_collect_directory +THIS_DIR = dirname(__file__) + +@pytest.hookimpl(tryfirst=True) +def pytest_ignore_collect(path, config): +path = str(path) +if sys.platform == 'win32' or platform.machine() == 's390x': +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True diff --git a/pypy/testrunner_cfg.py b/pypy/testrunner_cfg.py --- a/pypy/testrunner_cfg.py +++ b/pypy/testrunner_cfg.py @@ -6,6 +6,7 @@ 'memory/test', 'jit/metainterp', 'jit/backend/arm', 'jit/backend/x86', 'jit/backend/zarch', 'module/cpyext/test', +'jit/backend/aarch64', # python3 slowness ... 'module/_cffi_backend/test', 'module/__pypy__/test', ] diff --git a/rpython/jit/backend/aarch64/assembler.py b/rpython/jit/backend/aarch64/assembler.py --- a/rpython/jit/backend/aarch64/assembler.py +++ b/rpython/jit/backend/aarch64/assembler.py @@ -31,6 +31,7 @@ ResOpAssembler.__init__(self, cpu, translate_support_code) self.failure_recovery_code = [0, 0, 0, 0] self.wb_slowpath = [0, 0, 0, 0, 0] +self.stack_check_slowpath = 0 def assemble_loop(self, jd_id, unique_id, logger, loopname, inputargs, operations, looptoken, log): @@ -675,7 +676,7 @@ # new value of nursery_free_adr in r1 and the adr of the new object in # r0. -self.mc.B_ofs_cond(10 * 4, c.LO) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond +self.mc.B_ofs_cond(10 * 4, c.LS) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) @@ -698,7 +699,7 @@ self.mc.CMP_rr(r.x1.value, r.ip0.value) # -self.mc.B_ofs_cond(40, c.LO) # see calculations in malloc_cond +self.mc.B_ofs_cond(40, c.LS) # see calculations in malloc_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) diff --git a/rpython/jit/backend/aarch64/runner.py b/rpython/jit/backend/aarch64/runner.py --- a/rpython/jit/backend/aarch64/runner.py +++ b/rpython/jit/backend/aarch64/runner.py @@ -62,6 +62,12 @@ cast_ptr_to_int._annspecialcase_ = 'specialize:arglltype(0)' cast_ptr_to_int = staticmethod(cast_ptr_to_int) +def build_regalloc(self): +''' for tests''' +from rpython.jit.backend.aarch64.regalloc import Regalloc +assert self.assembler is not None +return Regalloc(self.assembler) +
[pypy-commit] pypy default: sync with upstream vmprof
Author: Matti Picus Branch: Changeset: r97150:8cb85ca95940 Date: 2019-08-11 22:44 +0300 http://bitbucket.org/pypy/pypy/changeset/8cb85ca95940/ Log:sync with upstream vmprof diff --git a/rpython/rlib/rvmprof/src/shared/_vmprof.c b/rpython/rlib/rvmprof/src/shared/_vmprof.c --- a/rpython/rlib/rvmprof/src/shared/_vmprof.c +++ b/rpython/rlib/rvmprof/src/shared/_vmprof.c @@ -383,8 +383,22 @@ #ifdef VMPROF_UNIX static PyObject * -insert_real_time_thread(PyObject *module, PyObject * noargs) { +insert_real_time_thread(PyObject *module, PyObject * args) { ssize_t thread_count; +unsigned long thread_id = 0; +pthread_t th = pthread_self(); + +if (!PyArg_ParseTuple(args, "|k", _id)) { +return NULL; +} + +if (thread_id) { +#if SIZEOF_LONG <= SIZEOF_PTHREAD_T +th = (pthread_t) thread_id; +#else +th = (pthread_t) *(unsigned long *) _id; +#endif +} if (!vmprof_is_enabled()) { PyErr_SetString(PyExc_ValueError, "vmprof is not enabled"); @@ -397,15 +411,29 @@ } vmprof_aquire_lock(); -thread_count = insert_thread(pthread_self(), -1); +thread_count = insert_thread(th, -1); vmprof_release_lock(); return PyLong_FromSsize_t(thread_count); } static PyObject * -remove_real_time_thread(PyObject *module, PyObject * noargs) { +remove_real_time_thread(PyObject *module, PyObject * args) { ssize_t thread_count; +unsigned long thread_id = 0; +pthread_t th = pthread_self(); + +if (!PyArg_ParseTuple(args, "|k", _id)) { +return NULL; +} + +if (thread_id) { +#if SIZEOF_LONG <= SIZEOF_PTHREAD_T +th = (pthread_t) thread_id; +#else +th = (pthread_t) *(unsigned long *) _id; +#endif +} if (!vmprof_is_enabled()) { PyErr_SetString(PyExc_ValueError, "vmprof is not enabled"); @@ -418,7 +446,7 @@ } vmprof_aquire_lock(); -thread_count = remove_thread(pthread_self(), -1); +thread_count = remove_thread(th, -1); vmprof_release_lock(); return PyLong_FromSsize_t(thread_count); @@ -445,9 +473,9 @@ #ifdef VMPROF_UNIX {"get_profile_path", vmp_get_profile_path, METH_NOARGS, "Profile path the profiler logs to."}, -{"insert_real_time_thread", insert_real_time_thread, METH_NOARGS, +{"insert_real_time_thread", insert_real_time_thread, METH_VARARGS, "Insert a thread into the real time profiling list."}, -{"remove_real_time_thread", remove_real_time_thread, METH_NOARGS, +{"remove_real_time_thread", remove_real_time_thread, METH_VARARGS, "Remove a thread from the real time profiling list."}, #endif {NULL, NULL, 0, NULL}/* Sentinel */ diff --git a/rpython/rlib/rvmprof/src/shared/vmp_stack.c b/rpython/rlib/rvmprof/src/shared/vmp_stack.c --- a/rpython/rlib/rvmprof/src/shared/vmp_stack.c +++ b/rpython/rlib/rvmprof/src/shared/vmp_stack.c @@ -280,7 +280,7 @@ // this is possible because compiler align to 8 bytes. // if (func_addr != 0x0) { -depth = _write_native_stack((void*)(((intptr_t)func_addr) | 0x1), result, depth, max_depth); +depth = _write_native_stack((void*)(((uint64_t)func_addr) | 0x1), result, depth, max_depth); } } diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_unix.c b/rpython/rlib/rvmprof/src/shared/vmprof_unix.c --- a/rpython/rlib/rvmprof/src/shared/vmprof_unix.c +++ b/rpython/rlib/rvmprof/src/shared/vmprof_unix.c @@ -244,11 +244,7 @@ if (commit) { commit_buffer(fd, p); } else { -#ifndef RPYTHON_VMPROF fprintf(stderr, "WARNING: canceled buffer, no stack trace was written\n"); -#else -fprintf(stderr, "WARNING: canceled buffer, no stack trace was written\n"); -#endif cancel_buffer(p); } } ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3.6-sandbox-2: hg merge sandbox-2
Author: Armin Rigo Branch: py3.6-sandbox-2 Changeset: r97149:67130f4a3a0c Date: 2019-08-11 20:54 +0200 http://bitbucket.org/pypy/pypy/changeset/67130f4a3a0c/ Log:hg merge sandbox-2 diff too long, truncating to 2000 out of 2641 lines diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py --- a/pypy/config/pypyoption.py +++ b/pypy/config/pypyoption.py @@ -44,6 +44,12 @@ #" _ssl", "_hashlib", "crypt" ]) +# --sandbox +sandbox_modules = default_modules.copy() +sandbox_modules.update([ +"array", "binascii", +]) + import rpython.rlib.rvmprof.cintf if rpython.rlib.rvmprof.cintf.IS_SUPPORTED: working_modules.add('_vmprof') @@ -271,7 +277,7 @@ def enable_allworkingmodules(config): modules = working_modules.copy() if config.translation.sandbox: -modules = default_modules +modules = sandbox_modules.copy() if config.translation.reverse_debugger: for mod in reverse_debugger_disable_modules: setattr(config.objspace.usemodules, mod, False) diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -326,9 +326,7 @@ config.translation.jit = True if config.translation.sandbox: -assert 0, ("--sandbox is not tested nor maintained. If you " - "really want to try it anyway, remove this line in " - "pypy/goal/targetpypystandalone.py.") +config.objspace.lonepycfiles = False if config.objspace.usemodules.cpyext: if config.translation.gc not in ('incminimark', 'boehm'): @@ -387,6 +385,8 @@ from pypy.module.gc.hook import LowLevelGcHooks if self.space is None: raise Exception("get_gchooks must be called after get_entry_point") +if self.space.config.translation.sandbox: +return None return self.space.fromcache(LowLevelGcHooks) def get_entry_point(self, config): diff --git a/pypy/module/gc/moduledef.py b/pypy/module/gc/moduledef.py --- a/pypy/module/gc/moduledef.py +++ b/pypy/module/gc/moduledef.py @@ -16,7 +16,11 @@ def __init__(self, space, w_name): if (not space.config.translating or -space.config.translation.gctransformer == "framework"): +(space.config.translation.gctransformer == "framework" + and not space.config.translation.sandbox)): +# some of these functions allow app-level code to do invalid +# things by trying hard enough. For safety, in sandbox mode +# we don't provide any of them. self.appleveldefs.update({ 'dump_rpy_heap': 'app_referents.dump_rpy_heap', 'get_stats': 'app_referents.get_stats', diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py --- a/pypy/module/sys/vm.py +++ b/pypy/module/sys/vm.py @@ -66,6 +66,13 @@ from rpython.rlib.rgc import increase_root_stack_depth if new_limit <= 0: raise oefmt(space.w_ValueError, "recursion limit must be positive") +# +if space.config.translation.sandbox: +if new_limit > space.sys.recursionlimit: +msg = "sandbox: cannot increase the recursion limit" +space.warn(space.newtext(msg), space.w_RuntimeWarning) +return +# try: _stack_set_length_fraction(new_limit * 0.001) _stack_check_noinline() diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py --- a/pypy/module/time/interp_time.py +++ b/pypy/module/time/interp_time.py @@ -316,15 +316,15 @@ TM_P = lltype.Ptr(tm) c_time = external('time', [rffi.TIME_TP], rffi.TIME_T) c_gmtime = external('gmtime', [rffi.TIME_TP], TM_P, -save_err=rffi.RFFI_SAVE_ERRNO) -c_mktime = external('mktime', [TM_P], rffi.TIME_T) +save_err=rffi.RFFI_SAVE_ERRNO, sandboxsafe=True) +c_mktime = external('mktime', [TM_P], rffi.TIME_T, sandboxsafe=True) c_localtime = external('localtime', [rffi.TIME_TP], TM_P, - save_err=rffi.RFFI_SAVE_ERRNO) + save_err=rffi.RFFI_SAVE_ERRNO, sandboxsafe=True) if HAS_CLOCK_GETTIME: from rpython.rlib.rtime import TIMESPEC, c_clock_gettime from rpython.rlib.rtime import c_clock_settime, c_clock_getres if _POSIX: -c_tzset = external('tzset', [], lltype.Void) +c_tzset = external('tzset', [], lltype.Void, sandboxsafe=True) if _WIN: win_eci = ExternalCompilationInfo( includes = ["time.h"], @@ -363,7 +363,7 @@ rffi.INT, win_eci, calling_conv='c') c_strftime = external('strftime', [rffi.CCHARP, rffi.SIZE_T, rffi.CCHARP, TM_P], - rffi.SIZE_T) + rffi.SIZE_T, sandboxsafe=True) def _init_timezone(space): timezone = daylight = altzone = 0 @@ -853,7 +853,7 @@ rffi.setintfield(buf_value,
[pypy-commit] pypy default: Try to split the run of individual test files in this directory too
Author: Armin Rigo Branch: Changeset: r97147:872b51a36497 Date: 2019-08-11 20:31 +0200 http://bitbucket.org/pypy/pypy/changeset/872b51a36497/ Log:Try to split the run of individual test files in this directory too diff --git a/pypy/testrunner_cfg.py b/pypy/testrunner_cfg.py --- a/pypy/testrunner_cfg.py +++ b/pypy/testrunner_cfg.py @@ -6,6 +6,7 @@ 'memory/test', 'jit/metainterp', 'jit/backend/arm', 'jit/backend/x86', 'jit/backend/zarch', 'module/cpyext/test', +'jit/backend/aarch64', ] def collect_one_testdir(testdirs, reldir, tests): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] buildbot default: add aarch64 to rpython page
Author: Matti Picus Branch: Changeset: r1090:7ea68e40c299 Date: 2019-08-11 20:40 +0300 http://bitbucket.org/pypy/buildbot/changeset/7ea68e40c299/ Log:add aarch64 to rpython page diff --git a/master/templates/layout.html b/master/templates/layout.html --- a/master/templates/layout.html +++ b/master/templates/layout.html @@ -29,7 +29,7 @@ - Summary (trunk) - Summary (py3.6) - Summary -- RPython +- RPython - Nightly builds ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix test collection on windows and s390x
Author: Ronan Lamy Branch: Changeset: r97146:597f4be1ae97 Date: 2019-08-11 17:51 +0100 http://bitbucket.org/pypy/pypy/changeset/597f4be1ae97/ Log:Fix test collection on windows and s390x diff --git a/pypy/module/_cppyy/test/conftest.py b/pypy/module/_cppyy/test/conftest.py --- a/pypy/module/_cppyy/test/conftest.py +++ b/pypy/module/_cppyy/test/conftest.py @@ -5,7 +5,7 @@ @py.test.mark.tryfirst def pytest_runtest_setup(item): -if py.path.local.sysfind('genreflex') is None: +if not disabled and py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi if 'dummy' in lcapi.backend_library: # run only tests that are covered by the dummy backend and tests @@ -33,16 +33,18 @@ def pytest_ignore_collect(path, config): path = str(path) -if py.path.local.sysfind('genreflex') is None and config.option.runappdirect: -return commonprefix([path, THIS_DIR]) == THIS_DIR if disabled: -return commonprefix([path, THIS_DIR]) == THIS_DIR +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True disabled = None def pytest_configure(config): +global disabled if config.getoption('runappdirect') or config.getoption('direct_apptest'): -return # "can't run dummy tests in -A" +if py.path.local.sysfind('genreflex') is None: +disabled = True # can't run dummy tests in -A +return if py.path.local.sysfind('genreflex') is None: import pypy.module._cppyy.capi.loadable_capi as lcapi try: @@ -77,7 +79,6 @@ standalone=False) except CompilationError as e: if '-std=c++14' in str(e): -global disabled disabled = str(e) return raise diff --git a/pypy/module/_vmprof/conftest.py b/pypy/module/_vmprof/conftest.py --- a/pypy/module/_vmprof/conftest.py +++ b/pypy/module/_vmprof/conftest.py @@ -1,8 +1,13 @@ -import py, platform, sys +import pytest +import platform +import sys +from os.path import commonprefix, dirname -def pytest_collect_directory(path, parent): -if platform.machine() == 's390x': -py.test.skip("_vmprof tests skipped") -if sys.platform == 'win32': -py.test.skip("_vmprof tests skipped") -pytest_collect_file = pytest_collect_directory +THIS_DIR = dirname(__file__) + +@pytest.hookimpl(tryfirst=True) +def pytest_ignore_collect(path, config): +path = str(path) +if sys.platform == 'win32' or platform.machine() == 's390x': +if commonprefix([path, THIS_DIR]) == THIS_DIR: # workaround for bug in pytest<3.0.5 +return True ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: aarch64: fix test_regalloc_integration.py
Author: Armin Rigo Branch: Changeset: r97145:a6010dc54fc4 Date: 2019-08-11 14:09 + http://bitbucket.org/pypy/pypy/changeset/a6010dc54fc4/ Log:aarch64: fix test_regalloc_integration.py diff --git a/rpython/jit/backend/aarch64/runner.py b/rpython/jit/backend/aarch64/runner.py --- a/rpython/jit/backend/aarch64/runner.py +++ b/rpython/jit/backend/aarch64/runner.py @@ -62,6 +62,12 @@ cast_ptr_to_int._annspecialcase_ = 'specialize:arglltype(0)' cast_ptr_to_int = staticmethod(cast_ptr_to_int) +def build_regalloc(self): +''' for tests''' +from rpython.jit.backend.aarch64.regalloc import Regalloc +assert self.assembler is not None +return Regalloc(self.assembler) + for _i, _r in enumerate(r.all_regs): assert CPU_ARM64.all_reg_indexes[_r.value] == _i ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: aarch64: fix test_gc_integration.py
Author: Armin Rigo Branch: Changeset: r97144:381752e5cd15 Date: 2019-08-11 14:06 + http://bitbucket.org/pypy/pypy/changeset/381752e5cd15/ Log:aarch64: fix test_gc_integration.py diff --git a/rpython/jit/backend/aarch64/assembler.py b/rpython/jit/backend/aarch64/assembler.py --- a/rpython/jit/backend/aarch64/assembler.py +++ b/rpython/jit/backend/aarch64/assembler.py @@ -31,6 +31,7 @@ ResOpAssembler.__init__(self, cpu, translate_support_code) self.failure_recovery_code = [0, 0, 0, 0] self.wb_slowpath = [0, 0, 0, 0, 0] +self.stack_check_slowpath = 0 def assemble_loop(self, jd_id, unique_id, logger, loopname, inputargs, operations, looptoken, log): @@ -675,7 +676,7 @@ # new value of nursery_free_adr in r1 and the adr of the new object in # r0. -self.mc.B_ofs_cond(10 * 4, c.LO) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond +self.mc.B_ofs_cond(10 * 4, c.LS) # 4 for gcmap load, 5 for BL, 1 for B_ofs_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) @@ -698,7 +699,7 @@ self.mc.CMP_rr(r.x1.value, r.ip0.value) # -self.mc.B_ofs_cond(40, c.LO) # see calculations in malloc_cond +self.mc.B_ofs_cond(40, c.LS) # see calculations in malloc_cond self.mc.gen_load_int_full(r.ip1.value, rffi.cast(lltype.Signed, gcmap)) self.mc.BL(self.malloc_slowpath) 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 @@ -93,6 +93,8 @@ assert nos == [0, 1, 33] elif self.cpu.backend_name.startswith('zarch'): assert nos == [0, 1, 29] +elif self.cpu.backend_name.startswith('aarch64'): +assert nos == [0, 1, 27] else: raise Exception("write the data here") assert frame.jf_frame[nos[0]] @@ -672,6 +674,8 @@ elif self.cpu.backend_name.startswith('zarch'): # 10 gpr, 14 fpr -> 25 is the first slot assert gcmap == [26, 27, 28] +elif self.cpu.backend_name.startswith('aarch64'): +assert gcmap == [24, 25, 26] elif self.cpu.IS_64_BIT: assert gcmap == [28, 29, 30] elif self.cpu.backend_name.startswith('arm'): ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit