summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-10-09 15:51:30 (GMT)
committerGitHub <noreply@github.com>2021-10-09 15:51:30 (GMT)
commitb4903afd4debbbd71dc49a2c8fefa74a3b6c6832 (patch)
treed5bc6105eb25f47ed2b72f446c66ac4f6d12cc62 /Include
parentec04db74e24a5f5da441bcabbe259157b4938b9b (diff)
downloadcpython-b4903afd4debbbd71dc49a2c8fefa74a3b6c6832.zip
cpython-b4903afd4debbbd71dc49a2c8fefa74a3b6c6832.tar.gz
cpython-b4903afd4debbbd71dc49a2c8fefa74a3b6c6832.tar.bz2
bpo-45256: Remove the usage of the C stack in Python to Python calls (GH-28488)
Ths commit inlines calls to Python functions in the eval loop and steals all the arguments in the call from the caller for performance.
Diffstat (limited to 'Include')
-rw-r--r--Include/internal/pycore_frame.h2
-rw-r--r--Include/internal/pycore_tuple.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h
index 489e115..7e63f58 100644
--- a/Include/internal/pycore_frame.h
+++ b/Include/internal/pycore_frame.h
@@ -31,6 +31,7 @@ typedef struct _interpreter_frame {
int f_lasti; /* Last instruction if called */
int stacktop; /* Offset of TOS from localsplus */
PyFrameState f_state; /* What state the frame is in */
+ int depth; /* Depth of the frame in a ceval loop */
PyObject *localsplus[1];
} InterpreterFrame;
@@ -85,6 +86,7 @@ _PyFrame_InitializeSpecials(
frame->generator = NULL;
frame->f_lasti = -1;
frame->f_state = FRAME_CREATED;
+ frame->depth = 0;
}
/* Gets the pointer to the locals array
diff --git a/Include/internal/pycore_tuple.h b/Include/internal/pycore_tuple.h
index d1d0d2a..79c827f 100644
--- a/Include/internal/pycore_tuple.h
+++ b/Include/internal/pycore_tuple.h
@@ -13,6 +13,7 @@ extern "C" {
#define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item)
extern PyObject *_PyTuple_FromArray(PyObject *const *, Py_ssize_t);
+extern PyObject *_PyTuple_FromArraySteal(PyObject *const *, Py_ssize_t);
#ifdef __cplusplus
}