summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-10 23:54:57 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-01-10 23:54:57 (GMT)
commit415c5107be9873aba3a0619d7bf5096cfb5b087e (patch)
tree1957ff37ea6dcc963e9512f31807817a5962a70e
parent434723f94cfc27079f5ae91600c8baf384db334e (diff)
downloadcpython-415c5107be9873aba3a0619d7bf5096cfb5b087e.zip
cpython-415c5107be9873aba3a0619d7bf5096cfb5b087e.tar.gz
cpython-415c5107be9873aba3a0619d7bf5096cfb5b087e.tar.bz2
Inline call_function()
Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault() using Py_LOCAL_INLINE to reduce the stack consumption. It reduces the stack consumption, bytes per call, before => after: test_python_call: 1152 => 1040 (-112 B) test_python_getitem: 1008 => 976 (-32 B) test_python_iterator: 1232 => 1120 (-112 B) => total: 3392 => 3136 (- 256 B)
-rw-r--r--Python/ceval.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index cd95642..f86f6aa 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -36,7 +36,7 @@ extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **);
typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *);
/* Forward declarations */
-static PyObject * call_function(PyObject ***, Py_ssize_t, PyObject *);
+Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *);
static PyObject * fast_function(PyObject *, PyObject **, Py_ssize_t, PyObject *);
static PyObject * do_call_core(PyObject *, PyObject *, PyObject *);
@@ -4829,7 +4829,9 @@ if (tstate->use_tracing && tstate->c_profilefunc) { \
x = call; \
}
-static PyObject* _Py_HOT_FUNCTION
+/* Issue #29227: Inline call_function() into _PyEval_EvalFrameDefault()
+ to reduce the stack consumption. */
+Py_LOCAL_INLINE(PyObject *) _Py_HOT_FUNCTION
call_function(PyObject ***pp_stack, Py_ssize_t oparg, PyObject *kwnames)
{
PyObject **pfunc = (*pp_stack) - oparg - 1;