diff options
author | Mark Shannon <mark@hotpy.org> | 2024-09-12 15:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 15:32:45 +0100 |
commit | 4ed7d1d6acc22807bfb5983c98fd59f7cb5061db (patch) | |
tree | 1a8fa46bf3f86fda923747b80a500d160009d637 /Python/executor_cases.c.h | |
parent | 3ea51fa2e33797c772af6eaf6ede76d2dc6082ba (diff) | |
download | cpython-4ed7d1d6acc22807bfb5983c98fd59f7cb5061db.tar.gz cpython-4ed7d1d6acc22807bfb5983c98fd59f7cb5061db.zip |
GH-123996: Explicitly mark 'self_or_null' as an array of size 1 to ensure that it is kept in memory for calls (GH-124003)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 221 |
1 files changed, 106 insertions, 115 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 6d687bbb48b..b9f532f9b11 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -3556,31 +3556,26 @@ case _MAYBE_EXPAND_METHOD: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef func; - _PyStackRef maybe_self; + _PyStackRef *maybe_self; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; - args = &stack_pointer[-oparg]; - if (PyStackRef_TYPE(callable) == &PyMethod_Type && PyStackRef_IsNull(self_or_null)) { + maybe_self = &stack_pointer[-1 - oparg]; + if (PyStackRef_TYPE(callable) == &PyMethod_Type && PyStackRef_IsNull(self_or_null[0])) { PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); PyObject *self = ((PyMethodObject *)callable_o)->im_self; - maybe_self = PyStackRef_FromPyObjectNew(self); - stack_pointer[-1 - oparg] = maybe_self; + maybe_self[0] = PyStackRef_FromPyObjectNew(self); PyObject *method = ((PyMethodObject *)callable_o)->im_func; func = PyStackRef_FromPyObjectNew(method); stack_pointer[-2 - oparg] = func; - /* Make sure that callable and all args are in memory */ - args[-2] = func; - args[-1] = maybe_self; PyStackRef_CLOSE(callable); } else { func = callable; - maybe_self = self_or_null; } break; } @@ -3591,18 +3586,17 @@ case _PY_FRAME_GENERAL: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - PyObject *self_or_null_o = PyStackRef_AsPyObjectBorrow(self_or_null); // oparg counts all of the args, but *not* self: int total_args = oparg; - if (self_or_null_o != NULL) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -3645,10 +3639,10 @@ } case _CHECK_METHOD_VERSION: { - _PyStackRef null; + _PyStackRef *null; _PyStackRef callable; oparg = CURRENT_OPARG(); - null = stack_pointer[-1 - oparg]; + null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; uint32_t func_version = (uint32_t)CURRENT_OPERAND(); PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); @@ -3665,7 +3659,7 @@ UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } - if (!PyStackRef_IsNull(null)) { + if (!PyStackRef_IsNull(null[0])) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } @@ -3673,18 +3667,18 @@ } case _EXPAND_METHOD: { - _PyStackRef null; + _PyStackRef *null; _PyStackRef callable; _PyStackRef method; - _PyStackRef self; + _PyStackRef *self; oparg = CURRENT_OPARG(); - null = stack_pointer[-1 - oparg]; + null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; + self = &stack_pointer[-1 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - assert(PyStackRef_IsNull(null)); + assert(PyStackRef_IsNull(null[0])); assert(Py_TYPE(callable_o) == &PyMethod_Type); - self = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); - stack_pointer[-1 - oparg] = self; + self[0] = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); method = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); stack_pointer[-2 - oparg] = method; assert(PyStackRef_FunctionCheck(method)); @@ -3710,20 +3704,19 @@ case _CALL_NON_PY_GENERAL: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; #if TIER_ONE assert(opcode != INSTRUMENTED_CALL); #endif PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - PyObject *self_or_null_o = PyStackRef_AsPyObjectBorrow(self_or_null); int total_args = oparg; - if (self_or_null_o != NULL) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -3731,7 +3724,7 @@ STACKREFS_TO_PYOBJECTS(args, total_args, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -3756,12 +3749,12 @@ } case _CHECK_CALL_BOUND_METHOD_EXACT_ARGS: { - _PyStackRef null; + _PyStackRef *null; _PyStackRef callable; oparg = CURRENT_OPARG(); - null = stack_pointer[-1 - oparg]; + null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; - if (!PyStackRef_IsNull(null)) { + if (!PyStackRef_IsNull(null[0])) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } @@ -3775,13 +3768,13 @@ case _INIT_CALL_BOUND_METHOD_EXACT_ARGS: { _PyStackRef callable; _PyStackRef func; - _PyStackRef self; + _PyStackRef *self; oparg = CURRENT_OPARG(); callable = stack_pointer[-2 - oparg]; + self = &stack_pointer[-1 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); STAT_INC(CALL, hit); - self = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); - stack_pointer[-1 - oparg] = self; + self[0] = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); func = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); stack_pointer[-2 - oparg] = func; PyStackRef_CLOSE(callable); @@ -3797,16 +3790,16 @@ } case _CHECK_FUNCTION_EXACT_ARGS: { - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; oparg = CURRENT_OPARG(); - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); assert(PyFunction_Check(callable_o)); PyFunctionObject *func = (PyFunctionObject *)callable_o; PyCodeObject *code = (PyCodeObject *)func->func_code; - if (code->co_argcount != oparg + (!PyStackRef_IsNull(self_or_null))) { + if (code->co_argcount != oparg + (!PyStackRef_IsNull(self_or_null[0]))) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } @@ -3833,21 +3826,21 @@ case _INIT_CALL_PY_EXACT_ARGS_0: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = 0; assert(oparg == CURRENT_OPARG()); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -3859,21 +3852,21 @@ case _INIT_CALL_PY_EXACT_ARGS_1: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = 1; assert(oparg == CURRENT_OPARG()); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -3885,21 +3878,21 @@ case _INIT_CALL_PY_EXACT_ARGS_2: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = 2; assert(oparg == CURRENT_OPARG()); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -3911,21 +3904,21 @@ case _INIT_CALL_PY_EXACT_ARGS_3: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = 3; assert(oparg == CURRENT_OPARG()); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -3937,21 +3930,21 @@ case _INIT_CALL_PY_EXACT_ARGS_4: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = 4; assert(oparg == CURRENT_OPARG()); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -3963,20 +3956,20 @@ case _INIT_CALL_PY_EXACT_ARGS: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - int has_self = !PyStackRef_IsNull(self_or_null); + int has_self = !PyStackRef_IsNull(self_or_null[0]); STAT_INC(CALL, hit); PyFunctionObject *func = (PyFunctionObject *)callable_o; new_frame = _PyFrame_PushUnchecked(tstate, func, oparg + has_self, frame); _PyStackRef *first_non_self_local = new_frame->localsplus + has_self; - new_frame->localsplus[0] = self_or_null; + new_frame->localsplus[0] = self_or_null[0]; for (int i = 0; i < oparg; i++) { first_non_self_local[i] = args[i]; } @@ -4191,16 +4184,16 @@ case _CALL_BUILTIN_CLASS: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4217,7 +4210,7 @@ STACKREFS_TO_PYOBJECTS(args, total_args, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -4240,17 +4233,17 @@ case _CALL_BUILTIN_O: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; /* Builtin METH_O functions */ PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4290,17 +4283,17 @@ case _CALL_BUILTIN_FAST: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; /* Builtin METH_FASTCALL functions, without keywords */ PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4318,7 +4311,7 @@ STACKREFS_TO_PYOBJECTS(args, total_args, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -4345,17 +4338,17 @@ case _CALL_BUILTIN_FAST_WITH_KEYWORDS: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4375,7 +4368,7 @@ STACKREFS_TO_PYOBJECTS(args, total_args, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -4399,17 +4392,17 @@ case _CALL_LEN: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; /* len(o) */ PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4445,17 +4438,17 @@ case _CALL_ISINSTANCE: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; /* isinstance(o, o2) */ PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4525,16 +4518,16 @@ case _CALL_METHOD_DESCRIPTOR_O: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4585,16 +4578,16 @@ case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4621,7 +4614,7 @@ STACKREFS_TO_PYOBJECTS(args, nargs, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -4645,17 +4638,17 @@ case _CALL_METHOD_DESCRIPTOR_NOARGS: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; assert(oparg == 0 || oparg == 1); PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4702,16 +4695,16 @@ case _CALL_METHOD_DESCRIPTOR_FAST: { _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); args = &stack_pointer[-oparg]; - self_or_null = stack_pointer[-1 - oparg]; + self_or_null = &stack_pointer[-1 - oparg]; callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); int total_args = oparg; - if (!PyStackRef_IsNull(self_or_null)) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4738,7 +4731,7 @@ STACKREFS_TO_PYOBJECTS(args, nargs, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } @@ -4767,19 +4760,18 @@ case _PY_FRAME_KW: { _PyStackRef kwnames; _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyInterpreterFrame *new_frame; oparg = CURRENT_OPARG(); kwnames = stack_pointer[-1]; args = &stack_pointer[-1 - oparg]; - self_or_null = stack_pointer[-2 - oparg]; + self_or_null = &stack_pointer[-2 - oparg]; callable = stack_pointer[-3 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - PyObject *self_or_null_o = PyStackRef_AsPyObjectBorrow(self_or_null); // oparg counts all of the args, but *not* self: int total_args = oparg; - if (self_or_null_o != NULL) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4825,10 +4817,10 @@ } case _CHECK_METHOD_VERSION_KW: { - _PyStackRef null; + _PyStackRef *null; _PyStackRef callable; oparg = CURRENT_OPARG(); - null = stack_pointer[-2 - oparg]; + null = &stack_pointer[-2 - oparg]; callable = stack_pointer[-3 - oparg]; uint32_t func_version = (uint32_t)CURRENT_OPERAND(); PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); @@ -4845,7 +4837,7 @@ UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } - if (!PyStackRef_IsNull(null)) { + if (!PyStackRef_IsNull(null[0])) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); } @@ -4854,19 +4846,19 @@ case _EXPAND_METHOD_KW: { _PyStackRef kwnames; - _PyStackRef null; + _PyStackRef *null; _PyStackRef callable; _PyStackRef method; - _PyStackRef self; + _PyStackRef *self; oparg = CURRENT_OPARG(); kwnames = stack_pointer[-1]; - null = stack_pointer[-2 - oparg]; + null = &stack_pointer[-2 - oparg]; callable = stack_pointer[-3 - oparg]; + self = &stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - assert(PyStackRef_IsNull(null)); + assert(PyStackRef_IsNull(null[0])); assert(Py_TYPE(callable_o) == &PyMethod_Type); - self = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); - stack_pointer[-2 - oparg] = self; + self[0] = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); method = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); stack_pointer[-3 - oparg] = method; assert(PyStackRef_FunctionCheck(method)); @@ -4894,21 +4886,20 @@ case _CALL_KW_NON_PY: { _PyStackRef kwnames; _PyStackRef *args; - _PyStackRef self_or_null; + _PyStackRef *self_or_null; _PyStackRef callable; _PyStackRef res; oparg = CURRENT_OPARG(); kwnames = stack_pointer[-1]; args = &stack_pointer[-1 - oparg]; - self_or_null = stack_pointer[-2 - oparg]; + self_or_null = &stack_pointer[-2 - oparg]; callable = stack_pointer[-3 - oparg]; #if TIER_ONE assert(opcode != INSTRUMENTED_CALL); #endif PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); - PyObject *self_or_null_o = PyStackRef_AsPyObjectBorrow(self_or_null); int total_args = oparg; - if (self_or_null_o != NULL) { + if (!PyStackRef_IsNull(self_or_null[0])) { args--; total_args++; } @@ -4916,7 +4907,7 @@ STACKREFS_TO_PYOBJECTS(args, total_args, args_o); if (CONVERSION_FAILED(args_o)) { PyStackRef_CLOSE(callable); - PyStackRef_CLOSE(self_or_null); + PyStackRef_CLOSE(self_or_null[0]); for (int _i = oparg; --_i >= 0;) { PyStackRef_CLOSE(args[_i]); } |