gh-134584: Eliminate redundant refcounting from _CALL_BUILTION_O (GH-142695)

Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
PuQing 2025-12-14 18:28:02 +08:00 committed by GitHub
parent 11aef219f5
commit a2a400af1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 75 additions and 39 deletions

View file

@ -4186,7 +4186,7 @@ dummy_func(
_CALL_BUILTIN_CLASS +
_CHECK_PERIODIC_AT_END;
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res)) {
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, a, c)) {
/* Builtin METH_O functions */
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@ -4206,12 +4206,12 @@ dummy_func(
PyObject *res_o = _PyCFunction_TrampolineCall(cfunc, PyCFunction_GET_SELF(callable_o), PyStackRef_AsPyObjectBorrow(arg));
_Py_LeaveRecursiveCallTstate(tstate);
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
PyStackRef_CLOSE(arg);
DEAD(args);
DEAD(self_or_null);
PyStackRef_CLOSE(callable);
ERROR_IF(res_o == NULL);
if (res_o == NULL) {
ERROR_NO_POP();
}
a = arg;
c = callable;
INPUTS_DEAD();
res = PyStackRef_FromPyObjectSteal(res_o);
}
@ -4219,6 +4219,8 @@ dummy_func(
unused/1 +
unused/2 +
_CALL_BUILTIN_O +
POP_TOP +
POP_TOP +
_CHECK_PERIODIC_AT_END;
op(_CALL_BUILTIN_FAST, (callable, self_or_null, args[oparg] -- res)) {