mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
gh-106581: Fix two bugs in the code generator's copy optimization (#108380)
I was comparing the last preceding poke with the *last* peek, rather than the *first* peek. Unfortunately this bug obscured another bug: When the last preceding poke is UNUSED, the first peek disappears, leaving the variable unassigned. This is how I fixed it: - Rename CopyEffect to CopyItem. - Change CopyItem to contain StackItems instead of StackEffects. - Update those StackItems when adjusting the manager higher or lower. - Assert that those StackItems' offsets are equivalent. - Other clever things. --------- Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
parent
c494fb333b
commit
88941d665f
2 changed files with 62 additions and 20 deletions
3
Python/generated_cases.c.h
generated
3
Python/generated_cases.c.h
generated
|
@ -3833,7 +3833,6 @@
|
|||
DEOPT_IF(code->co_argcount != oparg + (self_or_null != NULL), CALL);
|
||||
}
|
||||
// _CHECK_STACK_SPACE
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
{
|
||||
PyFunctionObject *func = (PyFunctionObject *)callable;
|
||||
PyCodeObject *code = (PyCodeObject *)func->func_code;
|
||||
|
@ -3841,8 +3840,6 @@
|
|||
}
|
||||
// _INIT_CALL_PY_EXACT_ARGS
|
||||
args = stack_pointer - oparg;
|
||||
self_or_null = stack_pointer[-1 - oparg];
|
||||
callable = stack_pointer[-2 - oparg];
|
||||
{
|
||||
int argcount = oparg;
|
||||
if (self_or_null != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue