diff options
author | Mark Shannon <mark@hotpy.org> | 2024-07-18 11:49:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-18 11:49:24 (GMT) |
commit | 3eacfc1a4d09a9807bedba58ef4037788b6df961 (patch) | |
tree | 3c852f1d2c54a0debe6909e041ff8de08d87b210 /Python/executor_cases.c.h | |
parent | 169324c27a39a4d6a4dd7b313b0de6ab2d1f7e6b (diff) | |
download | cpython-3eacfc1a4d09a9807bedba58ef4037788b6df961.zip cpython-3eacfc1a4d09a9807bedba58ef4037788b6df961.tar.gz cpython-3eacfc1a4d09a9807bedba58ef4037788b6df961.tar.bz2 |
GH-121784: Generate an error during code gen if a variable is marked `unused`, but is used and thus cached in a prior uop. (#121788)
* Reject uop definitions that declare values as 'unused' that are already cached by prior uops
* Track which variables are defined and only load from memory when needed
* Support explicit `flush` in macro definitions.
* Make sure stack is flushed in where needed.
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 8f6bc75..375e1fb 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -3527,7 +3527,6 @@ assert(PyStackRef_IsNull(null)); assert(Py_TYPE(callable_o) == &PyMethod_Type); self = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); - stack_pointer[-1 - oparg] = self; // Patch stack as it is used by _PY_FRAME_GENERAL method = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); assert(PyFunction_Check(PyStackRef_AsPyObjectBorrow(method))); PyStackRef_CLOSE(callable); @@ -3624,13 +3623,9 @@ callable = stack_pointer[-2 - oparg]; PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable); STAT_INC(CALL, hit); - stack_pointer[-1 - oparg] = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); // Patch stack as it is used by _INIT_CALL_PY_EXACT_ARGS - stack_pointer[-2 - oparg] = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); // This is used by CALL, upon deoptimization - self = stack_pointer[-1 - oparg]; - func = stack_pointer[-2 - oparg]; + self = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_self); + func = PyStackRef_FromPyObjectNew(((PyMethodObject *)callable_o)->im_func); PyStackRef_CLOSE(callable); - // self may be unused in tier 1, so silence warnings. - (void)self; stack_pointer[-2 - oparg] = func; stack_pointer[-1 - oparg] = self; break; |