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

Method _fixup_external_labels

Tools/jit/_optimizers.py:473–492  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

471 assert prev.link is block
472
473 def _fixup_external_labels(self) -> None:
474 if self._supports_external_relocations:
475 # Nothing to fix up
476 return
477 for index, block in enumerate(self._blocks()):
478 if block.target and block.fallthrough:
479 branch = block.instructions[-1]
480 if branch.kind == InstructionKind.CALL:
481 continue
482 assert branch.is_branch()
483 target = branch.target
484 assert target is not None
485 reloc = self._branches[branch.name][1]
486 if reloc is not None and self._is_far_target(target):
487 name = target[len(self.symbol_prefix) :]
488 label = f"{self.symbol_prefix}{reloc}_JIT_RELOCATION_{name}_JIT_RELOCATION_{index}:"
489 block.instructions[-1] = Instruction(
490 InstructionKind.OTHER, "", label, None
491 )
492 block.instructions.append(branch.update_target("0"))
493
494 def _make_temp_label(self, index: int) -> Instruction:
495 marker = f"jit_temp_{index}:"

Callers 1

runMethod · 0.95

Calls 7

_blocksMethod · 0.95
_is_far_targetMethod · 0.95
enumerateFunction · 0.85
is_branchMethod · 0.80
update_targetMethod · 0.80
InstructionClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected