gh-148171: Convert CALL_BUILTIN_CLASS to leave arguments on the stack (gh-148381)

This commit is contained in:
Donghee Na 2026-04-11 23:01:25 +09:00 committed by GitHub
parent 9831dea3bf
commit a71b043356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 87 additions and 60 deletions

View file

@ -16450,13 +16450,12 @@
break;
}
case _CALL_BUILTIN_CLASS_r01: {
case _CALL_BUILTIN_CLASS_r00: {
CHECK_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
_PyStackRef *args;
_PyStackRef self_or_null;
_PyStackRef callable;
_PyStackRef res;
oparg = CURRENT_OPARG();
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
@ -16469,24 +16468,25 @@
}
STAT_INC(CALL, hit);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyObject *res_o = _Py_CallBuiltinClass_StackRefSteal(
PyObject *res_o = _Py_CallBuiltinClass_StackRef(
callable,
arguments,
total_args);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (res_o == NULL) {
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
JUMP_TO_ERROR();
}
res = PyStackRef_FromPyObjectSteal(res_o);
_tos_cache0 = res;
_PyStackRef temp = callable;
callable = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[-2 - oparg] = callable;
_PyFrame_SetStackPointer(frame, stack_pointer);
PyStackRef_CLOSE(temp);
stack_pointer = _PyFrame_GetStackPointer(frame);
_tos_cache0 = PyStackRef_ZERO_BITS;
_tos_cache1 = PyStackRef_ZERO_BITS;
_tos_cache2 = PyStackRef_ZERO_BITS;
SET_CURRENT_CACHED_VALUES(1);
stack_pointer += -2 - oparg;
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
SET_CURRENT_CACHED_VALUES(0);
assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());
break;
}