mirror of
https://github.com/python/cpython.git
synced 2025-10-29 12:44:56 +00:00
GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)
This commit is contained in:
parent
6e3cc72afe
commit
c7f5708714
18 changed files with 562 additions and 758 deletions
|
|
@ -13,6 +13,8 @@
|
|||
import parser
|
||||
from parser import InstDef # TODO: Use parser.InstDef
|
||||
|
||||
RE_PREDICTED = r"(?s)(?:PREDICT\(|GO_TO_INSTRUCTION\(|DEOPT_IF\(.*?,\s*)(\w+)\);"
|
||||
|
||||
arg_parser = argparse.ArgumentParser()
|
||||
arg_parser.add_argument("-i", "--input", type=str, default="Python/bytecodes.c")
|
||||
arg_parser.add_argument("-o", "--output", type=str, default="Python/generated_cases.c.h")
|
||||
|
|
@ -121,7 +123,7 @@ def write_cases(f: TextIO, instrs: list[InstDef], supers: list[parser.Super]):
|
|||
for instr in instrs:
|
||||
assert isinstance(instr, InstDef)
|
||||
assert instr.block is not None
|
||||
for target in re.findall(r"(?:PREDICT|GO_TO_INSTRUCTION)\((\w+)\)", instr.block.text):
|
||||
for target in re.findall(RE_PREDICTED, instr.block.text):
|
||||
predictions.add(target)
|
||||
indent = " "
|
||||
f.write(f"// This file is generated by {os.path.relpath(__file__)}\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue