mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
gh-128563: Move GO_TO_INSTRUCTION and PREDICT to cases generator (GH-129115)
This commit is contained in:
parent
767cf70844
commit
86c1a60d5a
5 changed files with 47 additions and 59 deletions
|
@ -127,6 +127,7 @@ class Emitter:
|
|||
"DISPATCH": self.dispatch,
|
||||
"INSTRUCTION_SIZE": self.instruction_size,
|
||||
"POP_INPUT": self.pop_input,
|
||||
"GO_TO_INSTRUCTION": self.go_to_instruction,
|
||||
}
|
||||
self.out = out
|
||||
|
||||
|
@ -402,6 +403,23 @@ class Emitter:
|
|||
self._print_storage(storage)
|
||||
return True
|
||||
|
||||
def go_to_instruction(
|
||||
self,
|
||||
tkn: Token,
|
||||
tkn_iter: TokenIterator,
|
||||
uop: Uop,
|
||||
storage: Storage,
|
||||
inst: Instruction | None,
|
||||
) -> bool:
|
||||
next(tkn_iter)
|
||||
name = next(tkn_iter)
|
||||
next(tkn_iter)
|
||||
next(tkn_iter)
|
||||
assert name.kind == "IDENTIFIER"
|
||||
self.emit("\n")
|
||||
self.emit(f"goto PREDICTED_{name.text};\n")
|
||||
return True
|
||||
|
||||
def emit_save(self, storage: Storage) -> None:
|
||||
storage.save(self.out)
|
||||
self._print_storage(storage)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue