8000 GH-131729: Code-gen better liveness analysis by markshannon · Pull Request #131732 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-131729: Code-gen better liveness analysis #131732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Next Next commit
Remove redundant attribute
  • Loading branch information
markshannon committed Mar 24, 2025
commit 45199ae8c0b6118f89319d8d183df1e581eb2a4c
11 changes: 4 additions & 7 deletions Tools/cases_generator/stack.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def var_size(var: StackItem) -> str:
@dataclass
class Local:
item: StackItem
cached: bool
in_memory: bool
defined: bool

Expand All @@ -47,21 +46,21 @@ def compact_str(self) -> str:

@staticmethod
def unused(defn: StackItem) -> "Local":
return Local(defn, False, defn.is_array(), False)
return Local(defn, defn.is_array(), False)

@staticmethod
def undefined(defn: StackItem) -> "Local":
array = defn.is_array()
return Local(defn, not array, array, False)
return Local(defn, array, False)

@staticmethod
def redefinition(var: StackItem, prev: "Local") -> "Local":
assert var.is_array() == prev.is_array()
return Local(var, prev.cached, prev.in_memory, True)
return Local(var, prev.in_memory, True)

@staticmethod
def from_memory(defn: StackItem) -> "Local":
return Local(defn, True, True, True)
return Local(defn, True, True)

def kill(self) -> None:
self.defined = False
Expand All @@ -70,7 +69,6 @@ def kill(self) -> None:
def copy(self) -> "Local":
return Local(
self.item,
self.cached,
self.in_memory,
self.defined
)
Expand All @@ -91,7 +89,6 @@ def __eq__(self, other: object) -> bool:
return NotImplemented
return (
self.item is other.item
and self.cached is other.cached
and self.in_memory is other.in_memory
and self.defined is other.defined
)
Expand Down
0