Fix Pyston speedups (#281)

We remove (i.e. hide behind a debug ifdef) the recursion checking methods,
and the memory hooks and memory allocator methods. ASAN mode has no
PYMALLOC, so we need a macro. Fix build break with des.c stack allocation.
This commit is contained in:
Gautham 2021-10-02 13:58:51 +05:30 committed by GitHub
parent 2fe8571010
commit 57f0eed382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 260 additions and 63 deletions

View file

@ -91,7 +91,9 @@ PYTHON_PROVIDE("sys.float_info");
PYTHON_PROVIDE("sys.float_repr_style");
PYTHON_PROVIDE("sys.get_asyncgen_hooks");
PYTHON_PROVIDE("sys.get_coroutine_wrapper");
#if IsModeDbg()
PYTHON_PROVIDE("sys.getallocatedblocks");
#endif
PYTHON_PROVIDE("sys.getcheckinterval");
PYTHON_PROVIDE("sys.getdefaultencoding");
PYTHON_PROVIDE("sys.getdlopenflags");
@ -1262,6 +1264,7 @@ one higher than you might expect, because it includes the (temporary)\n\
reference as an argument to getrefcount()."
);
#if IsModeDbg()
static PyObject *
sys_getallocatedblocks(PyObject *self)
{
@ -1274,6 +1277,7 @@ PyDoc_STRVAR(getallocatedblocks_doc,
Return the number of memory blocks currently allocated, regardless of their\n\
size."
);
#endif
#ifdef COUNT_ALLOCS
static PyObject *
@ -1382,10 +1386,12 @@ static PyObject *
sys_debugmallocstats(PyObject *self, PyObject *args)
{
#ifdef WITH_PYMALLOC
#if IsModeDbg()
if (_PyMem_PymallocEnabled()) {
_PyObject_DebugMallocStats(stderr);
fputc('\n', stderr);
}
#endif
#endif
_PyObject_DebugTypeStats(stderr);
@ -1455,8 +1461,10 @@ static PyMethodDef sys_methods[] = {
{"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS,
getdlopenflags_doc},
#endif
#if IsModeDbg()
{"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS,
getallocatedblocks_doc},
#endif
#ifdef COUNT_ALLOCS
{"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS},
#endif