mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
GH-131798: Split CALL_LEN into several uops (GH-133180)
This commit is contained in:
parent
893034cf93
commit
9cc77aaf9d
11 changed files with 314 additions and 281 deletions
42
Python/executor_cases.c.h
generated
42
Python/executor_cases.c.h
generated
|
@ -5788,35 +5788,31 @@
|
|||
break;
|
||||
}
|
||||
|
||||
case _CALL_LEN: {
|
||||
_PyStackRef *args;
|
||||
_PyStackRef self_or_null;
|
||||
case _GUARD_CALLABLE_LEN: {
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
oparg = CURRENT_OPARG();
|
||||
args = &stack_pointer[-oparg];
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
callable = stack_pointer[-3];
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
int total_args = oparg;
|
||||
if (!PyStackRef_IsNull(self_or_null)) {
|
||||
args--;
|
||||
total_args++;
|
||||
}
|
||||
if (total_args != 1) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
PyInterpreterState *interp = tstate->interp;
|
||||
if (callable_o != interp->callable_cache.len) {
|
||||
UOP_STAT_INC(uopcode, miss);
|
||||
JUMP_TO_JUMP_TARGET();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case _CALL_LEN: {
|
||||
_PyStackRef arg;
|
||||
_PyStackRef null;
|
||||
_PyStackRef callable;
|
||||
_PyStackRef res;
|
||||
arg = stack_pointer[-1];
|
||||
null = stack_pointer[-2];
|
||||
callable = stack_pointer[-3];
|
||||
(void)null;
|
||||
STAT_INC(CALL, hit);
|
||||
_PyStackRef arg_stackref = args[0];
|
||||
PyObject *arg = PyStackRef_AsPyObjectBorrow(arg_stackref);
|
||||
PyObject *arg_o = PyStackRef_AsPyObjectBorrow(arg);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
Py_ssize_t len_i = PyObject_Length(arg);
|
||||
Py_ssize_t len_i = PyObject_Length(arg_o);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (len_i < 0) {
|
||||
JUMP_TO_ERROR();
|
||||
|
@ -5826,10 +5822,12 @@
|
|||
if (res_o == NULL) {
|
||||
JUMP_TO_ERROR();
|
||||
}
|
||||
stack_pointer += -1;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(arg_stackref);
|
||||
PyStackRef_CLOSE(arg);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
stack_pointer += -2 - oparg;
|
||||
stack_pointer += -2;
|
||||
assert(WITHIN_STACK_BOUNDS());
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
PyStackRef_CLOSE(callable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue