mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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
|
@ -23,7 +23,7 @@ from generators_common import (
|
|||
from cwriter import CWriter
|
||||
from typing import TextIO, Iterator
|
||||
from lexer import Token
|
||||
from stack import Stack, SizeMismatch
|
||||
from stack import Stack, StackError
|
||||
|
||||
DEFAULT_OUTPUT = ROOT / "Python/optimizer_cases.c.h"
|
||||
DEFAULT_ABSTRACT_INPUT = (ROOT / "Python/optimizer_bytecodes.c").absolute().as_posix()
|
||||
|
@ -141,7 +141,7 @@ def write_uop(
|
|||
out.emit(stack.push(var))
|
||||
out.start_line()
|
||||
stack.flush(out, cast_type="_Py_UopsSymbol *", extract_bits=True)
|
||||
except SizeMismatch as ex:
|
||||
except StackError as ex:
|
||||
raise analysis_error(ex.args[0], uop.body[0])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue