[pypy-commit] pypy py3.6: merge heads

arigo pypy.commits at gmail.com
Sun Aug 11 17:12:31 EDT 2019


Author: Armin Rigo <arigo at tunes.org>
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__)
+
+ at 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 enumerate(r.all_regs):
     assert CPU_ARM64.all_reg_indexes[_r.value] == _i
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'):
diff --git a/rpython/jit/metainterp/test/test_float.py b/rpython/jit/metainterp/test/test_float.py
--- a/rpython/jit/metainterp/test/test_float.py
+++ b/rpython/jit/metainterp/test/test_float.py
@@ -43,7 +43,7 @@
             a = float(r_singlefloat(a))
             a *= 4.25
             return float(r_singlefloat(a))
-        res = self.interp_operations(f, [-2.0])
+        res = self.interp_operations(f, [-2.0], supports_singlefloats=True)
         assert res == -8.5
 
     def test_cast_float_to_int(self):
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", &thread_id)) {
+        return NULL;
+    }
+
+    if (thread_id) {
+#if SIZEOF_LONG <= SIZEOF_PTHREAD_T
+        th = (pthread_t) thread_id;
+#else
+        th = (pthread_t) *(unsigned long *) &thread_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", &thread_id)) {
+        return NULL;
+    }
+
+    if (thread_id) {
+#if SIZEOF_LONG <= SIZEOF_PTHREAD_T
+        th = (pthread_t) thread_id;
+#else
+        th = (pthread_t) *(unsigned long *) &thread_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);
             }
         }
diff --git a/testrunner/get_info.py b/testrunner/get_info.py
--- a/testrunner/get_info.py
+++ b/testrunner/get_info.py
@@ -13,6 +13,7 @@
     # PyPy uses bin as of PR https://github.com/pypa/virtualenv/pull/1400
     TARGET_DIR = 'bin'
 else:
+    TARGET_NAME = 'pypy-c'
     TARGET_NAME = 'pypy3-c'
     TARGET_DIR = 'bin'
 VENV_DIR = 'pypy-venv'


More information about the pypy-commit mailing list