(self, op: IncRef)
| 643 | ) |
| 644 | |
| 645 | def visit_inc_ref(self, op: IncRef) -> None: |
| 646 | if ( |
| 647 | isinstance(op.src, Box) |
| 648 | and (is_none_rprimitive(op.src.src.type) or is_bool_or_bit_rprimitive(op.src.src.type)) |
| 649 | and HAVE_IMMORTAL |
| 650 | ): |
| 651 | # On Python 3.12+, None/True/False are immortal, and we can skip inc ref |
| 652 | return |
| 653 | |
| 654 | if isinstance(op.src, LoadLiteral) and HAVE_IMMORTAL: |
| 655 | value = op.src.value |
| 656 | # We can skip inc ref for immortal literals on Python 3.12+ |
| 657 | if type(value) is int and -5 <= value <= 256: |
| 658 | # Small integers are immortal |
| 659 | return |
| 660 | |
| 661 | src = self.reg(op.src) |
| 662 | self.emit_inc_ref(src, op.src.type) |
| 663 | |
| 664 | def visit_dec_ref(self, op: DecRef) -> None: |
| 665 | src = self.reg(op.src) |
nothing calls this directly
no test coverage detected