diff options
author | Guido van Rossum <guido@python.org> | 2023-08-25 00:36:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 00:36:00 (GMT) |
commit | ddf66b54edea1ea59fdf8a496ed0b64e16424375 (patch) | |
tree | 0c5d6ae41b76c8a767e87c3737145d02ad1ec7a9 /Python/executor_cases.c.h | |
parent | 546cab84448b892c92e68d9c1a3d3b58c13b3463 (diff) | |
download | cpython-ddf66b54edea1ea59fdf8a496ed0b64e16424375.zip cpython-ddf66b54edea1ea59fdf8a496ed0b64e16424375.tar.gz cpython-ddf66b54edea1ea59fdf8a496ed0b64e16424375.tar.bz2 |
gh-106581: Split CALL_BOUND_METHOD_EXACT_ARGS into uops (#108462)
Instead of using `GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS)` we just add the macro elements of the latter to the macro for the former. This requires lengthening the uops array in struct opcode_macro_expansion. (It also required changes to stacking.py that were merged already.)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 89a5bbf..85c60c2 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -2190,6 +2190,32 @@ break; } + case _CHECK_CALL_BOUND_METHOD_EXACT_ARGS: { + PyObject *null; + PyObject *callable; + null = stack_pointer[-1 - oparg]; + callable = stack_pointer[-2 - oparg]; + DEOPT_IF(null != NULL, CALL); + DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); + break; + } + + case _INIT_CALL_BOUND_METHOD_EXACT_ARGS: { + PyObject *callable; + PyObject *func; + PyObject *self; + callable = stack_pointer[-2 - oparg]; + STAT_INC(CALL, hit); + self = Py_NewRef(((PyMethodObject *)callable)->im_self); + stack_pointer[-1 - oparg] = self; // Patch stack as it is used by _INIT_CALL_PY_EXACT_ARGS + func = Py_NewRef(((PyMethodObject *)callable)->im_func); + stack_pointer[-2 - oparg] = func; // This is used by CALL, upon deoptimization + Py_DECREF(callable); + stack_pointer[-2 - oparg] = func; + stack_pointer[-1 - oparg] = self; + break; + } + case _CHECK_PEP_523: { DEOPT_IF(tstate->interp->eval_frame, CALL); break; |