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

This commit is contained in:
Sacul 2026-03-16 19:58:12 +08:00 committed by GitHub
parent 36b5284f04
commit 37121ef77e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 1257 additions and 1215 deletions

View file

@ -6833,11 +6833,12 @@
break;
}
case _CALL_INTRINSIC_1_r11: {
case _CALL_INTRINSIC_1_r12: {
CHECK_CURRENT_CACHED_VALUES(1);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef value;
_PyStackRef res;
_PyStackRef v;
_PyStackRef _stack_item_0 = _tos_cache0;
oparg = CURRENT_OPARG();
value = _stack_item_0;
@ -6848,20 +6849,18 @@
_PyFrame_SetStackPointer(frame, stack_pointer);
PyObject *res_o = _PyIntrinsics_UnaryFunctions[oparg].func(tstate, PyStackRef_AsPyObjectBorrow(value));
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(value);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
v = value;
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache1 = v;
_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 += -1;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}