gh-134584: Eliminate redundant refcounting from _CALL_STR_1 (GH-136070)

Signed-off-by: Manjusaka <me@manjusaka.me>
This commit is contained in:
Nadeshiko Manju 2025-12-14 17:33:05 +08:00 committed by GitHub
parent d3ef5ba34d
commit a154c9ed4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 58 additions and 43 deletions

View file

@ -4040,18 +4040,17 @@ dummy_func(
DEOPT_IF(callable_o != (PyObject *)&PyUnicode_Type);
}
op(_CALL_STR_1, (callable, null, arg -- res)) {
op(_CALL_STR_1, (callable, null, arg -- res, a)) {
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
assert(oparg == 1);
STAT_INC(CALL, hit);
PyObject *res_o = PyObject_Str(arg_o);
DEAD(null);
DEAD(callable);
(void)callable; // Silence compiler warnings about unused variables
(void)null;
PyStackRef_CLOSE(arg);
ERROR_IF(res_o == NULL);
if (res_o == NULL) {
ERROR_NO_POP();
}
a = arg;
INPUTS_DEAD();
res = PyStackRef_FromPyObjectSteal(res_o);
}
@ -4061,6 +4060,7 @@ dummy_func(
_GUARD_NOS_NULL +
_GUARD_CALLABLE_STR_1 +
_CALL_STR_1 +
POP_TOP +
_CHECK_PERIODIC_AT_END;
op(_GUARD_CALLABLE_TUPLE_1, (callable, unused, unused -- callable, unused, unused)) {