Resolve a label to an offset, if known. May return `UNKNOWN_LABEL_OFFSET`.
(&self, mut label: MachLabel)
| 764 | |
| 765 | /// Resolve a label to an offset, if known. May return `UNKNOWN_LABEL_OFFSET`. |
| 766 | pub(crate) fn resolve_label_offset(&self, mut label: MachLabel) -> CodeOffset { |
| 767 | let mut iters = 0; |
| 768 | while self.label_aliases[label.0 as usize] != UNKNOWN_LABEL { |
| 769 | label = self.label_aliases[label.0 as usize]; |
| 770 | // To protect against an infinite loop (despite our assurances to |
| 771 | // ourselves that the invariants make this impossible), assert out |
| 772 | // after 1M iterations. The number of basic blocks is limited |
| 773 | // in most contexts anyway so this should be impossible to hit with |
| 774 | // a legitimate input. |
| 775 | iters += 1; |
| 776 | assert!(iters < 1_000_000, "Unexpected cycle in label aliases"); |
| 777 | } |
| 778 | self.label_offsets[label.0 as usize] |
| 779 | |
| 780 | // Post-invariant: no mutations. |
| 781 | } |
| 782 | |
| 783 | /// Emit a reference to the given label with the given reference type (i.e., |
| 784 | /// branch-instruction format) at the current offset. This is like a |
no outgoing calls
no test coverage detected