Skip to content

Commit 71c91ec

Browse files
Fix for real this time
1 parent ef42327 commit 71c91ec

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Python/ceval.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,15 +1142,27 @@ typedef struct {
11421142
} _PyEntryFrame;
11431143

11441144
/* gh-148284: *Do not* mark this function as _Py_HOT_FUNCTION.
1145-
* On certain compilers (Clang-22 and above), this overrides PGO information
1145+
* On certain compilers (Clang), this overrides PGO information
11461146
* leading possibly to miss-optimization and over-inlining.
1147+
* On GCC, _Py_HOT_FUNCTION is ignored when PGO is enabled.
11471148
*/
11481149
PyObject* DONT_SLP_VECTORIZE
11491150
_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
11501151
{
11511152
_Py_EnsureTstateNotNULL(tstate);
11521153
CALL_STAT_INC(pyeval_calls);
11531154

1155+
/* +1 because vectorcall might use -1 to write self */
1156+
/* gh-138115: This must not be in individual cases for
1157+
non-tail-call interpreters, as it results in excessive
1158+
stack usage in some compilers.
1159+
This must also be placed before any branches to avoid
1160+
interaction with other optimization passes.
1161+
*/
1162+
#if !Py_TAIL_CALL_INTERP
1163+
PyObject *STACKREF_SCRATCH[MAX_STACKREF_SCRATCH+1];
1164+
#endif
1165+
11541166
#if USE_COMPUTED_GOTOS && !Py_TAIL_CALL_INTERP
11551167
/* Import the static jump table */
11561168
#include "opcode_targets.h"
@@ -1172,14 +1184,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11721184
return NULL;
11731185
}
11741186

1175-
/* +1 because vectorcall might use -1 to write self */
1176-
/* gh-138115: This must not be in individual cases for
1177-
non-tail-call interpreters, as it results in excessive
1178-
stack usage in some compilers.
1179-
*/
1180-
#if !Py_TAIL_CALL_INTERP
1181-
PyObject *STACKREF_SCRATCH[MAX_STACKREF_SCRATCH+1];
1182-
#endif
11831187

11841188
/* Local "register" variables.
11851189
* These are cached values from the frame and code object. */

0 commit comments

Comments
 (0)