gh-134584: Eliminate redundant refcounting from _CALL_TUPLE_1 (GH-135860)

This commit is contained in:
Noam Cohen 2025-12-11 16:31:28 +02:00 committed by GitHub
parent 44d3dc6491
commit a78f43b001
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 71 additions and 41 deletions

View file

@ -4068,17 +4068,14 @@ dummy_func(
DEOPT_IF(callable_o != (PyObject *)&PyTuple_Type);
}
op(_CALL_TUPLE_1, (callable, null, arg -- res)) {
op(_CALL_TUPLE_1, (callable, null, arg -- res, a)) {
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
assert(oparg == 1);
STAT_INC(CALL, hit);
PyObject *res_o = PySequence_Tuple(arg_o);
DEAD(null);
DEAD(callable);
(void)callable; // Silence compiler warnings about unused variables
(void)null;
PyStackRef_CLOSE(arg);
a = arg;
INPUTS_DEAD();
ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
}
@ -4089,6 +4086,7 @@ dummy_func(
_GUARD_NOS_NULL +
_GUARD_CALLABLE_TUPLE_1 +
_CALL_TUPLE_1 +
POP_TOP +
_CHECK_PERIODIC_AT_END;
op(_CHECK_AND_ALLOCATE_OBJECT, (type_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
@ -5455,6 +5453,12 @@ dummy_func(
}
}
label(pop_3_error) {
stack_pointer -= 3;
assert(WITHIN_STACK_BOUNDS());
goto error;
}
label(pop_2_error) {
stack_pointer -= 2;
assert(WITHIN_STACK_BOUNDS());