Map a base opcode to its INSTRUMENTED_* variant. Returns `None` if this opcode has no instrumented counterpart. # Panics (debug) Panics if called on an already-instrumented opcode.
(self)
| 473 | /// # Panics (debug) |
| 474 | /// Panics if called on an already-instrumented opcode. |
| 475 | pub fn to_instrumented(self) -> Option<Self> { |
| 476 | debug_assert!( |
| 477 | !self.is_instrumented(), |
| 478 | "to_instrumented called on already-instrumented opcode {self:?}" |
| 479 | ); |
| 480 | Some(match self { |
| 481 | Self::Resume { .. } => Self::InstrumentedResume, |
| 482 | Self::ReturnValue => Self::InstrumentedReturnValue, |
| 483 | Self::YieldValue { .. } => Self::InstrumentedYieldValue, |
| 484 | Self::Call { .. } => Self::InstrumentedCall, |
| 485 | Self::CallKw { .. } => Self::InstrumentedCallKw, |
| 486 | Self::CallFunctionEx => Self::InstrumentedCallFunctionEx, |
| 487 | Self::LoadSuperAttr { .. } => Self::InstrumentedLoadSuperAttr, |
| 488 | Self::JumpForward { .. } => Self::InstrumentedJumpForward, |
| 489 | Self::JumpBackward { .. } => Self::InstrumentedJumpBackward, |
| 490 | Self::ForIter { .. } => Self::InstrumentedForIter, |
| 491 | Self::EndFor => Self::InstrumentedEndFor, |
| 492 | Self::EndSend => Self::InstrumentedEndSend, |
| 493 | Self::PopJumpIfTrue { .. } => Self::InstrumentedPopJumpIfTrue, |
| 494 | Self::PopJumpIfFalse { .. } => Self::InstrumentedPopJumpIfFalse, |
| 495 | Self::PopJumpIfNone { .. } => Self::InstrumentedPopJumpIfNone, |
| 496 | Self::PopJumpIfNotNone { .. } => Self::InstrumentedPopJumpIfNotNone, |
| 497 | Self::NotTaken => Self::InstrumentedNotTaken, |
| 498 | Self::PopIter => Self::InstrumentedPopIter, |
| 499 | Self::EndAsyncFor => Self::InstrumentedEndAsyncFor, |
| 500 | _ => return None, |
| 501 | }) |
| 502 | } |
| 503 | |
| 504 | /// Map an INSTRUMENTED_* opcode back to its base variant. |
| 505 | /// Returns `None` for non-instrumented opcodes, and also for |