gh-145866: Convert SET_UPDATE to leave its inputs on the stack to be cleaned up by _POP_TOP (GH-145979)

This commit is contained in:
Sacul 2026-03-19 19:17:58 +08:00 committed by GitHub
parent 982459132b
commit 0d37e423d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1030 additions and 981 deletions

View file

@ -8571,11 +8571,12 @@
break;
}
case _SET_UPDATE_r10: {
case _SET_UPDATE_r11: {
CHECK_CURRENT_CACHED_VALUES(1);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef iterable;
_PyStackRef set;
_PyStackRef i;
_PyStackRef _stack_item_0 = _tos_cache0;
oparg = CURRENT_OPARG();
iterable = _stack_item_0;
@ -8587,19 +8588,17 @@
int err = _PySet_Update(PyStackRef_AsPyObjectBorrow(set),
PyStackRef_AsPyObjectBorrow(iterable));
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(iterable);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (err < 0) {
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
_tos_cache0 = PyStackRef_ZERO_BITS;
i = iterable;
_tos_cache0 = i;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(0);
SET_CURRENT_CACHED_VALUES(1);
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}