(self)
| 496 | return Instruction(InstructionKind.OTHER, "", marker, None) |
| 497 | |
| 498 | def _fixup_constants(self) -> None: |
| 499 | if not self.supports_small_constants: |
| 500 | return |
| 501 | index = 0 |
| 502 | for block in self._blocks(): |
| 503 | fixed: list[Instruction] = [] |
| 504 | small_const_index = -1 |
| 505 | for inst in block.instructions: |
| 506 | if inst.kind == InstructionKind.SMALL_CONST_1: |
| 507 | marker = f"jit_pending_{inst.target}{index}:" |
| 508 | fixed.append(self._make_temp_label(index)) |
| 509 | index += 1 |
| 510 | small_const_index = len(fixed) |
| 511 | fixed.append(inst) |
| 512 | elif inst.kind == InstructionKind.SMALL_CONST_2: |
| 513 | if small_const_index < 0: |
| 514 | fixed.append(inst) |
| 515 | continue |
| 516 | small_const_1 = fixed[small_const_index] |
| 517 | if not self._small_consts_match(small_const_1, inst): |
| 518 | small_const_index = -1 |
| 519 | fixed.append(inst) |
| 520 | continue |
| 521 | assert small_const_1.target is not None |
| 522 | if small_const_1.target.endswith("16"): |
| 523 | fixed[small_const_index] = self._make_temp_label(index) |
| 524 | index += 1 |
| 525 | else: |
| 526 | assert small_const_1.target.endswith("32") |
| 527 | patch_kind, replacement = self._small_const_1(small_const_1) |
| 528 | if replacement is not None: |
| 529 | label = f"{self.const_reloc}{patch_kind}_JIT_RELOCATION_CONST{small_const_1.target[:-3]}_JIT_RELOCATION_{index}:" |
| 530 | index += 1 |
| 531 | fixed[small_const_index - 1] = Instruction( |
| 532 | InstructionKind.OTHER, "", label, None |
| 533 | ) |
| 534 | fixed[small_const_index] = replacement |
| 535 | patch_kind, replacement = self._small_const_2(inst) |
| 536 | if replacement is not None: |
| 537 | assert inst.target is not None |
| 538 | label = f"{self.const_reloc}{patch_kind}_JIT_RELOCATION_CONST{inst.target[:-3]}_JIT_RELOCATION_{index}:" |
| 539 | index += 1 |
| 540 | fixed.append( |
| 541 | Instruction(InstructionKind.OTHER, "", label, None) |
| 542 | ) |
| 543 | fixed.append(replacement) |
| 544 | small_const_index = -1 |
| 545 | else: |
| 546 | fixed.append(inst) |
| 547 | block.instructions = fixed |
| 548 | |
| 549 | def _small_const_1(self, inst: Instruction) -> tuple[str, Instruction | None]: |
| 550 | raise NotImplementedError() |
no test coverage detected