MCPcopy Index your code
hub / github.com/RustPython/RustPython / deopt

Method deopt

crates/compiler-core/src/bytecode/instruction.rs:561–683  ·  view source on GitHub ↗

Map a specialized opcode back to its adaptive (base) variant. `_PyOpcode_Deopt`

(self)

Source from the content-addressed store, hash-verified

559 /// Map a specialized opcode back to its adaptive (base) variant.
560 /// `_PyOpcode_Deopt`
561 pub const fn deopt(self) -> Option<Self> {
562 Some(match self {
563 // RESUME specializations
564 Self::ResumeCheck => Self::Resume {
565 context: Arg::marker(),
566 },
567 // LOAD_CONST specializations
568 Self::LoadConstMortal | Self::LoadConstImmortal => Self::LoadConst {
569 consti: Arg::marker(),
570 },
571 // TO_BOOL specializations
572 Self::ToBoolAlwaysTrue
573 | Self::ToBoolBool
574 | Self::ToBoolInt
575 | Self::ToBoolList
576 | Self::ToBoolNone
577 | Self::ToBoolStr => Self::ToBool,
578 // BINARY_OP specializations
579 Self::BinaryOpMultiplyInt
580 | Self::BinaryOpAddInt
581 | Self::BinaryOpSubtractInt
582 | Self::BinaryOpMultiplyFloat
583 | Self::BinaryOpAddFloat
584 | Self::BinaryOpSubtractFloat
585 | Self::BinaryOpAddUnicode
586 | Self::BinaryOpSubscrListInt
587 | Self::BinaryOpSubscrListSlice
588 | Self::BinaryOpSubscrTupleInt
589 | Self::BinaryOpSubscrStrInt
590 | Self::BinaryOpSubscrDict
591 | Self::BinaryOpSubscrGetitem
592 | Self::BinaryOpExtend
593 | Self::BinaryOpInplaceAddUnicode => Self::BinaryOp { op: Arg::marker() },
594 // STORE_SUBSCR specializations
595 Self::StoreSubscrDict | Self::StoreSubscrListInt => Self::StoreSubscr,
596 // SEND specializations
597 Self::SendGen => Self::Send {
598 delta: Arg::marker(),
599 },
600 // UNPACK_SEQUENCE specializations
601 Self::UnpackSequenceTwoTuple | Self::UnpackSequenceTuple | Self::UnpackSequenceList => {
602 Self::UnpackSequence {
603 count: Arg::marker(),
604 }
605 }
606 // STORE_ATTR specializations
607 Self::StoreAttrInstanceValue | Self::StoreAttrSlot | Self::StoreAttrWithHint => {
608 Self::StoreAttr {
609 namei: Arg::marker(),
610 }
611 }
612 // LOAD_GLOBAL specializations
613 Self::LoadGlobalModule | Self::LoadGlobalBuiltin => Self::LoadGlobal {
614 namei: Arg::marker(),
615 },
616 // LOAD_SUPER_ATTR specializations
617 Self::LoadSuperAttrAttr | Self::LoadSuperAttrMethod => Self::LoadSuperAttr {
618 namei: Arg::marker(),

Callers 2

stack_effectFunction · 0.80
deoptimizeMethod · 0.80

Calls 1

SomeClass · 0.50

Tested by

no test coverage detected