gh-148171: Convert variadic argument opcodes to leave their arguments on the stack (CALL_BUILTIN_FAST_WITH_KEYWORDS) (#148366)

This commit is contained in:
Sacul 2026-04-11 13:27:24 +08:00 committed by GitHub
parent 2b439da972
commit e872c19922
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 87 additions and 60 deletions

View file

@ -4692,7 +4692,7 @@ dummy_func(
EXIT_IF(PyCFunction_GET_FLAGS(callable_o) != (METH_FASTCALL | METH_KEYWORDS));
}
op(_CALL_BUILTIN_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_BUILTIN_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
int total_args = oparg;
_PyStackRef *arguments = args;
@ -4701,12 +4701,13 @@ dummy_func(
total_args++;
}
STAT_INC(CALL, hit);
PyObject *res_o = _Py_BuiltinCallFastWithKeywords_StackRefSteal(callable, arguments, total_args);
DEAD(args);
DEAD(self_or_null);
DEAD(callable);
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
PyObject *res_o = _Py_BuiltinCallFastWithKeywords_StackRef(callable, arguments, total_args);
if (res_o == NULL) {
ERROR_NO_POP();
}
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
PyStackRef_CLOSE(temp);
}
macro(CALL_BUILTIN_FAST_WITH_KEYWORDS) =
@ -4715,6 +4716,8 @@ dummy_func(
unused/2 +
_GUARD_CALLABLE_BUILTIN_FAST_WITH_KEYWORDS +
_CALL_BUILTIN_FAST_WITH_KEYWORDS +
_POP_TOP_OPARG +
POP_TOP +
_CHECK_PERIODIC_AT_END;
macro(CALL_LEN) =