Skip to content

Commit 043ddef

Browse files
authored
gh-161827: Mark _PyEval_EvalFrameDefault as Py_NO_INLINE (GH-161829)
gh-161827: Mark _PyEval_EvalFrameDefault as Py_NO_INLINE Signed-off-by: Iason Krommydas <iason.krom@gmail.com>
1 parent a872024 commit 043ddef

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Keep ``_PyEval_EvalFrameDefault`` as a separate frame in the C call stack
2+
when Python is built with the tail-calling interpreter
3+
(:option:`--with-tail-call-interp`), so that stack unwinders, profilers and
4+
other tools that walk the stack can find the interpreter loop.

‎Python/ceval.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,13 @@ dtrace_function_return(_PyInterpreterFrame *frame)
12001200
}
12011201
#endif
12021202

1203-
PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
1203+
/*
1204+
* _PyEval_EvalFrameDefault must remain a separate frame in the C call stack:
1205+
* stack unwinders, profilers and other tools that walk the stack use it to
1206+
* find the interpreter loop. With the tail-calling interpreter it is small
1207+
* enough to be inlined into its callers, e.g. by Clang with PGO.
1208+
*/
1209+
Py_NO_INLINE PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
12041210
_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
12051211
{
12061212
_Py_EnsureTstateNotNULL(tstate);

0 commit comments

Comments
 (0)