gh-134584: Eliminate redundant refcounting from _CALL_TYPE_1 (GH-135818)

This commit is contained in:
Tomas R. 2025-12-23 18:01:10 +01:00 committed by GitHub
parent c8b80f5e23
commit 25c294b6ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 1047 additions and 819 deletions

View file

@ -3986,17 +3986,14 @@ dummy_func(
DEOPT_IF(callable_o != (PyObject *)&PyType_Type);
}
op(_CALL_TYPE_1, (callable, null, arg -- res)) {
op(_CALL_TYPE_1, (callable, null, arg -- res, a)) {
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
assert(oparg == 1);
DEAD(null);
DEAD(callable);
(void)callable; // Silence compiler warnings about unused variables
(void)null;
STAT_INC(CALL, hit);
a = arg;
INPUTS_DEAD();
res = PyStackRef_FromPyObjectNew(Py_TYPE(arg_o));
PyStackRef_CLOSE(arg);
}
macro(CALL_TYPE_1) =
@ -4004,7 +4001,8 @@ dummy_func(
unused/2 +
_GUARD_NOS_NULL +
_GUARD_CALLABLE_TYPE_1 +
_CALL_TYPE_1;
_CALL_TYPE_1 +
POP_TOP;
op(_GUARD_CALLABLE_STR_1, (callable, unused, unused -- callable, unused, unused)) {
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
@ -5258,6 +5256,12 @@ dummy_func(
value = PyStackRef_FromPyObjectBorrow(ptr);
}
tier2 op(_SHUFFLE_2_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- res, a)) {
res = PyStackRef_FromPyObjectBorrow(ptr);
a = arg;
INPUTS_DEAD();
}
tier2 op(_SHUFFLE_3_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- res, a, c)) {
res = PyStackRef_FromPyObjectBorrow(ptr);
a = arg;