mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-106529: Implement POP_JUMP_IF_XXX uops (#106551)
- Hand-written uops JUMP_IF_{TRUE,FALSE}. These peek at the top of the stack. The jump target (in superblock space) is absolute. - Hand-written translation for POP_JUMP_IF_{TRUE,FALSE}, assuming the jump is unlikely. Once we implement jump-likelihood profiling, we can implement the jump-unlikely case (in another PR). - Tests (including some test cleanup). - Improvements to len(ex) and ex[i] to expose the whole trace.
This commit is contained in:
parent
18dfbd0357
commit
22988c323a
5 changed files with 181 additions and 72 deletions
|
@ -1338,12 +1338,17 @@ class Analyzer:
|
|||
def write_uop_items(self, make_text: typing.Callable[[str, int], str]) -> None:
|
||||
"""Write '#define XXX NNN' for each uop"""
|
||||
counter = 300 # TODO: Avoid collision with pseudo instructions
|
||||
|
||||
def add(name: str) -> None:
|
||||
nonlocal counter
|
||||
self.out.emit(make_text(name, counter))
|
||||
counter += 1
|
||||
|
||||
add("EXIT_TRACE")
|
||||
add("SAVE_IP")
|
||||
add("_POP_JUMP_IF_FALSE")
|
||||
add("_POP_JUMP_IF_TRUE")
|
||||
|
||||
for instr in self.instrs.values():
|
||||
if instr.kind == "op" and instr.is_viable_uop():
|
||||
add(instr.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue