gh-144007: Eliminate redundant refcounting in the JIT for BINARY_OP (GH-144011)

This commit is contained in:
AN Long 2026-01-24 18:35:32 +09:00 committed by GitHub
parent 29f1e778fa
commit 4e10fa993a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 105 additions and 48 deletions

View file

@ -16594,12 +16594,14 @@
break;
}
case _BINARY_OP_r21: {
case _BINARY_OP_r23: {
CHECK_CURRENT_CACHED_VALUES(2);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef rhs;
_PyStackRef lhs;
_PyStackRef res;
_PyStackRef l;
_PyStackRef r;
_PyStackRef _stack_item_0 = _tos_cache0;
_PyStackRef _stack_item_1 = _tos_cache1;
oparg = CURRENT_OPARG();
@ -16620,23 +16622,13 @@
JUMP_TO_ERROR();
}
res = PyStackRef_FromPyObjectSteal(res_o);
_PyFrame_SetStackPointer(frame, stack_pointer);
_PyStackRef tmp = lhs;
lhs = res;
stack_pointer[-2] = lhs;
PyStackRef_CLOSE(tmp);
tmp = rhs;
rhs = PyStackRef_NULL;
stack_pointer[-1] = rhs;
PyStackRef_CLOSE(tmp);
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
l = lhs;
r = rhs;
_tos_cache2 = r;
_tos_cache1 = l;
_tos_cache0 = res;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
stack_pointer += -1;
SET_CURRENT_CACHED_VALUES(3);
stack_pointer += -2;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;