mirror of
https://github.com/python/cpython.git
synced 2025-08-25 11:15:02 +00:00
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.
This commit is contained in:
parent
169324c27a
commit
3eacfc1a4d
9 changed files with 443 additions and 255 deletions
9
Python/executor_cases.c.h
generated
9
Python/executor_cases.c.h
generated
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue