MCPcopy Index your code
hub / github.com/python/cpython / _invert_branch

Method _invert_branch

Tools/jit/_optimizers.py:289–299  ·  view source on GitHub ↗
(self, inst: Instruction, target: str)

Source from the content-addressed store, hash-verified

287 return Instruction(kind, name, line, target)
288
289 def _invert_branch(self, inst: Instruction, target: str) -> Instruction | None:
290 assert inst.is_branch()
291 if inst.kind == InstructionKind.SHORT_BRANCH and self._is_far_target(target):
292 return None
293 inverted_reloc = self._branches.get(inst.name)
294 if inverted_reloc is None:
295 return None
296 inverted = inverted_reloc[0]
297 if not inverted:
298 return None
299 return inst.update_name_and_target(inverted, target)
300
301 def _lookup_label(self, label: str) -> _Block:
302 if label not in self._labels:

Callers 1

_invert_hot_branchesMethod · 0.95

Calls 4

_is_far_targetMethod · 0.95
is_branchMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected