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

@ -12755,47 +12755,40 @@
break;
}
case _CALL_STR_1_r31: {
case _CALL_STR_1_r32: {
CHECK_CURRENT_CACHED_VALUES(3);
assert(WITHIN_STACK_BOUNDS_WITH_CACHE());
_PyStackRef arg;
_PyStackRef null;
_PyStackRef callable;
_PyStackRef res;
_PyStackRef a;
_PyStackRef _stack_item_0 = _tos_cache0;
_PyStackRef _stack_item_1 = _tos_cache1;
_PyStackRef _stack_item_2 = _tos_cache2;
oparg = CURRENT_OPARG();
arg = _stack_item_2;
null = _stack_item_1;
callable = _stack_item_0;
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
assert(oparg == 1);
STAT_INC(CALL, hit);
stack_pointer[0] = callable;
stack_pointer[1] = null;
stack_pointer[0] = _stack_item_0;
stack_pointer[1] = _stack_item_1;
stack_pointer[2] = arg;
stack_pointer += 3;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyObject *res_o = PyObject_Str(arg_o);
stack_pointer = _PyFrame_GetStackPointer(frame);
(void)callable;
(void)null;
stack_pointer += -3;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(arg);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
a = arg;
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache1 = a;
_tos_cache0 = res;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
SET_CURRENT_CACHED_VALUES(2);
stack_pointer += -3;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_WITH_CACHE());
break;
}