gh-131798: split _CALL_BUILTIN_CLASS to smaller uops (#148094)

This commit is contained in:
Kumar Aditya 2026-04-10 22:58:20 +05:30 committed by GitHub
parent e007631e99
commit 8f17140fc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1299 additions and 1217 deletions

View file

@ -4570,17 +4570,20 @@ dummy_func(
DEAD(should_be_none);
}
op(_CALL_BUILTIN_CLASS, (callable, self_or_null, args[oparg] -- res)) {
op(_GUARD_CALLABLE_BUILTIN_CLASS, (callable, unused, unused[oparg] -- callable, unused, unused[oparg])) {
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
EXIT_IF(!PyType_Check(callable_o));
PyTypeObject *tp = (PyTypeObject *)callable_o;
EXIT_IF(tp->tp_vectorcall == NULL);
}
op(_CALL_BUILTIN_CLASS, (callable, self_or_null, args[oparg] -- res)) {
int total_args = oparg;
_PyStackRef *arguments = args;
if (!PyStackRef_IsNull(self_or_null)) {
arguments--;
total_args++;
}
EXIT_IF(tp->tp_vectorcall == NULL);
STAT_INC(CALL, hit);
PyObject *res_o = _Py_CallBuiltinClass_StackRefSteal(
callable,
@ -4597,6 +4600,7 @@ dummy_func(
_RECORD_CALLABLE +
unused/1 +
unused/2 +
_GUARD_CALLABLE_BUILTIN_CLASS +
_CALL_BUILTIN_CLASS +
_CHECK_PERIODIC_AT_END;
@ -4618,8 +4622,6 @@ dummy_func(
if (!PyStackRef_IsNull(self_or_null)) {
args--;
}
// CPython promises to check all non-vectorcall function calls.
EXIT_IF(_Py_ReachedRecursionLimit(tstate));
STAT_INC(CALL, hit);
PyCFunction cfunc = PyCFunction_GET_FUNCTION(callable_o);
_PyStackRef arg = args[0];
@ -4640,6 +4642,7 @@ dummy_func(
unused/1 +
unused/2 +
_GUARD_CALLABLE_BUILTIN_O +
_CHECK_RECURSION_LIMIT +
_CALL_BUILTIN_O +
POP_TOP +
POP_TOP +