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

This commit is contained in:
Sacul 2026-04-08 23:21:37 +08:00 committed by GitHub
parent d2fa4b2b13
commit bb03c8bd02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 140 additions and 74 deletions

View file

@ -17402,13 +17402,15 @@
break;
}
case _CALL_METHOD_DESCRIPTOR_NOARGS_r01: {
case _CALL_METHOD_DESCRIPTOR_NOARGS_r03: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_or_null;
_PyStackRef callable;
_PyStackRef res;
_PyStackRef c;
_PyStackRef s;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
@ -17428,33 +17430,31 @@
stack_pointer = _PyFrame_GetStackPointer(frame);
_Py_LeaveRecursiveCallTstate(tstate);
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(self_stackref);
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(callable);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
c = callable;
s = args[0];
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache2 = s;
_tos_cache1 = c;
_tos_cache0 = res;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
SET_CURRENT_CACHED_VALUES(3);
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}
case _CALL_METHOD_DESCRIPTOR_NOARGS_INLINE_r01: {
case _CALL_METHOD_DESCRIPTOR_NOARGS_INLINE_r03: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef callable;
_PyStackRef res;
_PyStackRef c;
_PyStackRef s;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
callable = stack_pointer[-1 - oparg];
@ -17469,23 +17469,19 @@
stack_pointer = _PyFrame_GetStackPointer(frame);
_Py_LeaveRecursiveCallTstate(tstate);
assert((res_o != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(self_stackref);
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(callable);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
c = callable;
s = args[0];
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache2 = s;
_tos_cache1 = c;
_tos_cache0 = res;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
SET_CURRENT_CACHED_VALUES(3);
stack_pointer += -1 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}