8000 gh-109979: Auto-generate the target for DEOPT_IF() by gvanrossum · Pull Request #110193 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-109979: Auto-generate the target for DEOPT_IF() #110193

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 4 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Always set/use .predicted flag
  • Loading branch information
gvanrossum committed Oct 2, 2023
commit 785c3739f91679bccea7aaae4420519f2edb521f
13 changes: 10 additions & 3 deletions Tools/cases_generator/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,19 @@ def analyze(self) -> None:
Raises SystemExit if there is an error.
"""
self.analyze_macros_and_pseudos()
self.find_predictions()
self.map_families()
self.mark_predictions()
self.check_families()

def find_predictions(self) -> None:
"""Find the instructions that need PREDICTED() labels."""
def mark_predictions(self) -> None:
"""Mark the instructions that need PREDICTED() labels."""
# Start with family heads
for family in self.families.values():
if family.name in self.instrs:
self.instrs[family.name].predicted = True
if family.name in self.macro_instrs:
self.macro_instrs[family.name].predicted = True
# Also look for GO_TO_INSTRUCTION() calls
for instr in self.instrs.values():
targets: set[str] = set()
for line in instr.block_text:
Expand Down
2 changes: 1 addition & 1 deletion Tools/cases_generator/stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def write_macro_instr(
]
out.emit("")
with out.block(f"TARGET({mac.name})"):
if mac.predicted or (family is not None and mac.name == family.name):
if mac.predicted:
out.emit(f"PREDICTED({mac.name});")
out.static_assert_family_size(mac.name, family, mac.cache_offset)
try:
Expand Down
0