Skip to content

Commit d108567

Browse files
Address Sam's review, fix root cause
1 parent e630cf2 commit d108567

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Modules/_testcapi/vectorcall.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,7 @@ _testcapi_pyobject_vectorcall_impl(PyObject *module, PyObject *func,
9898
PyErr_SetString(PyExc_TypeError, "kwnames must be None or a tuple");
9999
return NULL;
100100
}
101-
PyObject *res;
102-
// The CPython interpreter does not guarantee that vectorcalls are
103-
// checked for recursion limit. It's thus up to the C extension themselves to check.
104-
if (Py_EnterRecursiveCall("in _testcapi.pyobject_vectorcall")) {
105-
return NULL;
106-
}
107-
res = PyObject_Vectorcall(func, stack, nargs, kwnames);
108-
Py_LeaveRecursiveCall();
109-
return res;
101+
return PyObject_Vectorcall(func, stack, nargs, kwnames);
110102
}
111103

112104
static PyObject *

Python/ceval.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,11 @@ typedef struct {
11411141
_PyStackRef stack[1];
11421142
} _PyEntryFrame;
11431143

1144-
PyObject* _Py_HOT_FUNCTION DONT_SLP_VECTORIZE
1144+
/* gh-148284: *Do not* mark this function as _Py_HOT_FUNCTION.
1145+
* On certain compilers (Clang-22 and above), this overrides PGO information
1146+
* leading possibly to miss-optimization and over-inlining.
1147+
*/
1148+
PyObject* DONT_SLP_VECTORIZE
11451149
_PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
11461150
{
11471151
_Py_EnsureTstateNotNULL(tstate);
@@ -1173,7 +1177,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
11731177
non-tail-call interpreters, as it results in excessive
11741178
stack usage in some compilers.
11751179
*/
1180+
#if !Py_TAIL_CALL_INTERP
11761181
PyObject *STACKREF_SCRATCH[MAX_STACKREF_SCRATCH+1];
1182+
#endif
11771183

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

0 commit comments

Comments
 (0)