#[repr(u8)]pub enum Instruction {
Show 227 variants
Cache = 0,
BinarySlice = 1,
BuildTemplate = 2,
BinaryOpInplaceAddUnicode = 3,
CallFunctionEx = 4,
CheckEgMatch = 5,
CheckExcMatch = 6,
CleanupThrow = 7,
DeleteSubscr = 8,
EndFor = 9,
EndSend = 10,
ExitInitCheck = 11,
FormatSimple = 12,
FormatWithSpec = 13,
GetAIter = 14,
GetANext = 15,
GetIter = 16,
Reserved = 17,
GetLen = 18,
GetYieldFromIter = 19,
InterpreterExit = 20,
LoadBuildClass = 21,
LoadLocals = 22,
MakeFunction = 23,
MatchKeys = 24,
MatchMapping = 25,
MatchSequence = 26,
Nop = 27,
NotTaken = 28,
PopExcept = 29,
PopIter = 30,
PopTop = 31,
PushExcInfo = 32,
PushNull = 33,
ReturnGenerator = 34,
ReturnValue = 35,
SetupAnnotations = 36,
StoreSlice = 37,
StoreSubscr = 38,
ToBool = 39,
UnaryInvert = 40,
UnaryNegative = 41,
UnaryNot = 42,
WithExceptStart = 43,
BinaryOp {
op: Arg<BinaryOperator>,
},
BuildInterpolation {
format: Arg<u32>,
},
BuildList {
count: Arg<u32>,
},
BuildMap {
count: Arg<u32>,
},
BuildSet {
count: Arg<u32>,
},
BuildSlice {
argc: Arg<BuildSliceArgCount>,
},
BuildString {
count: Arg<u32>,
},
BuildTuple {
count: Arg<u32>,
},
Call {
argc: Arg<u32>,
},
CallIntrinsic1 {
func: Arg<IntrinsicFunction1>,
},
CallIntrinsic2 {
func: Arg<IntrinsicFunction2>,
},
CallKw {
argc: Arg<u32>,
},
CompareOp {
opname: Arg<ComparisonOperator>,
},
ContainsOp {
invert: Arg<Invert>,
},
ConvertValue {
oparg: Arg<ConvertValueOparg>,
},
Copy {
i: Arg<u32>,
},
CopyFreeVars {
n: Arg<u32>,
},
DeleteAttr {
namei: Arg<NameIdx>,
},
DeleteDeref {
i: Arg<VarNum>,
},
DeleteFast {
var_num: Arg<VarNum>,
},
DeleteGlobal {
namei: Arg<NameIdx>,
},
DeleteName {
namei: Arg<NameIdx>,
},
DictMerge {
i: Arg<u32>,
},
DictUpdate {
i: Arg<u32>,
},
EndAsyncFor = 68,
ExtendedArg = 69,
ForIter {
delta: Arg<Label>,
},
GetAwaitable {
where: Arg<u32>,
},
ImportFrom {
namei: Arg<NameIdx>,
},
ImportName {
namei: Arg<NameIdx>,
},
IsOp {
invert: Arg<Invert>,
},
JumpBackward {
delta: Arg<Label>,
},
JumpBackwardNoInterrupt {
delta: Arg<Label>,
},
JumpForward {
delta: Arg<Label>,
},
ListAppend {
i: Arg<u32>,
},
ListExtend {
i: Arg<u32>,
},
LoadAttr {
namei: Arg<LoadAttr>,
},
LoadCommonConstant {
idx: Arg<CommonConstant>,
},
LoadConst {
consti: Arg<ConstIdx>,
},
LoadDeref {
i: Arg<VarNum>,
},
LoadFast {
var_num: Arg<VarNum>,
},
LoadFastAndClear {
var_num: Arg<VarNum>,
},
LoadFastBorrow {
var_num: Arg<VarNum>,
},
LoadFastBorrowLoadFastBorrow {
var_nums: Arg<VarNums>,
},
LoadFastCheck {
var_num: Arg<VarNum>,
},
LoadFastLoadFast {
var_nums: Arg<VarNums>,
},
LoadFromDictOrDeref {
i: Arg<VarNum>,
},
LoadFromDictOrGlobals {
i: Arg<NameIdx>,
},
LoadGlobal {
namei: Arg<NameIdx>,
},
LoadName {
namei: Arg<NameIdx>,
},
LoadSmallInt {
i: Arg<u32>,
},
LoadSpecial {
method: Arg<SpecialMethod>,
},
LoadSuperAttr {
namei: Arg<LoadSuperAttr>,
},
MakeCell {
i: Arg<VarNum>,
},
MapAdd {
i: Arg<u32>,
},
MatchClass {
count: Arg<u32>,
},
PopJumpIfFalse {
delta: Arg<Label>,
},
PopJumpIfNone {
delta: Arg<Label>,
},
PopJumpIfNotNone {
delta: Arg<Label>,
},
PopJumpIfTrue {
delta: Arg<Label>,
},
RaiseVarargs {
argc: Arg<RaiseKind>,
},
Reraise {
depth: Arg<u32>,
},
Send {
delta: Arg<Label>,
},
SetAdd {
i: Arg<u32>,
},
SetFunctionAttribute {
flag: Arg<MakeFunctionFlag>,
},
SetUpdate {
i: Arg<u32>,
},
StoreAttr {
namei: Arg<NameIdx>,
},
StoreDeref {
i: Arg<VarNum>,
},
StoreFast {
var_num: Arg<VarNum>,
},
StoreFastLoadFast {
var_nums: Arg<VarNums>,
},
StoreFastStoreFast {
var_nums: Arg<VarNums>,
},
StoreGlobal {
namei: Arg<NameIdx>,
},
StoreName {
namei: Arg<NameIdx>,
},
Swap {
i: Arg<u32>,
},
UnpackEx {
counts: Arg<UnpackExArgs>,
},
UnpackSequence {
count: Arg<u32>,
},
YieldValue {
arg: Arg<u32>,
},
Resume {
context: Arg<ResumeContext>,
},
BinaryOpAddFloat = 129,
BinaryOpAddInt = 130,
BinaryOpAddUnicode = 131,
BinaryOpExtend = 132,
BinaryOpMultiplyFloat = 133,
BinaryOpMultiplyInt = 134,
BinaryOpSubscrDict = 135,
BinaryOpSubscrGetitem = 136,
BinaryOpSubscrListInt = 137,
BinaryOpSubscrListSlice = 138,
BinaryOpSubscrStrInt = 139,
BinaryOpSubscrTupleInt = 140,
BinaryOpSubtractFloat = 141,
BinaryOpSubtractInt = 142,
CallAllocAndEnterInit = 143,
CallBoundMethodExactArgs = 144,
CallBoundMethodGeneral = 145,
CallBuiltinClass = 146,
CallBuiltinFast = 147,
CallBuiltinFastWithKeywords = 148,
CallBuiltinO = 149,
CallIsinstance = 150,
CallKwBoundMethod = 151,
CallKwNonPy = 152,
CallKwPy = 153,
CallLen = 154,
CallListAppend = 155,
CallMethodDescriptorFast = 156,
CallMethodDescriptorFastWithKeywords = 157,
CallMethodDescriptorNoargs = 158,
CallMethodDescriptorO = 159,
CallNonPyGeneral = 160,
CallPyExactArgs = 161,
CallPyGeneral = 162,
CallStr1 = 163,
CallTuple1 = 164,
CallType1 = 165,
CompareOpFloat = 166,
CompareOpInt = 167,
CompareOpStr = 168,
ContainsOpDict = 169,
ContainsOpSet = 170,
ForIterGen = 171,
ForIterList = 172,
ForIterRange = 173,
ForIterTuple = 174,
JumpBackwardJit = 175,
JumpBackwardNoJit = 176,
LoadAttrClass = 177,
LoadAttrClassWithMetaclassCheck = 178,
LoadAttrGetattributeOverridden = 179,
LoadAttrInstanceValue = 180,
LoadAttrMethodLazyDict = 181,
LoadAttrMethodNoDict = 182,
LoadAttrMethodWithValues = 183,
LoadAttrModule = 184,
LoadAttrNondescriptorNoDict = 185,
LoadAttrNondescriptorWithValues = 186,
LoadAttrProperty = 187,
LoadAttrSlot = 188,
LoadAttrWithHint = 189,
LoadConstImmortal = 190,
LoadConstMortal = 191,
LoadGlobalBuiltin = 192,
LoadGlobalModule = 193,
LoadSuperAttrAttr = 194,
LoadSuperAttrMethod = 195,
ResumeCheck = 196,
SendGen = 197,
StoreAttrInstanceValue = 198,
StoreAttrSlot = 199,
StoreAttrWithHint = 200,
StoreSubscrDict = 201,
StoreSubscrListInt = 202,
ToBoolAlwaysTrue = 203,
ToBoolBool = 204,
ToBoolInt = 205,
ToBoolList = 206,
ToBoolNone = 207,
ToBoolStr = 208,
UnpackSequenceList = 209,
UnpackSequenceTuple = 210,
UnpackSequenceTwoTuple = 211,
InstrumentedEndFor = 234,
InstrumentedPopIter = 235,
InstrumentedEndSend = 236,
InstrumentedForIter = 237,
InstrumentedInstruction = 238,
InstrumentedJumpForward = 239,
InstrumentedNotTaken = 240,
InstrumentedPopJumpIfTrue = 241,
InstrumentedPopJumpIfFalse = 242,
InstrumentedPopJumpIfNone = 243,
InstrumentedPopJumpIfNotNone = 244,
InstrumentedResume = 245,
InstrumentedReturnValue = 246,
InstrumentedYieldValue = 247,
InstrumentedEndAsyncFor = 248,
InstrumentedLoadSuperAttr = 249,
InstrumentedCall = 250,
InstrumentedCallKw = 251,
InstrumentedCallFunctionEx = 252,
InstrumentedJumpBackward = 253,
InstrumentedLine = 254,
EnterExecutor = 255,
}Expand description
A Single bytecode instruction that are executed by the VM.
Currently aligned with CPython 3.14.
§See also
Variants§
Cache = 0
BinarySlice = 1
BuildTemplate = 2
BinaryOpInplaceAddUnicode = 3
CallFunctionEx = 4
CheckEgMatch = 5
CheckExcMatch = 6
CleanupThrow = 7
DeleteSubscr = 8
EndFor = 9
EndSend = 10
ExitInitCheck = 11
FormatSimple = 12
FormatWithSpec = 13
GetAIter = 14
GetANext = 15
GetIter = 16
Reserved = 17
GetLen = 18
GetYieldFromIter = 19
InterpreterExit = 20
LoadBuildClass = 21
LoadLocals = 22
MakeFunction = 23
MatchKeys = 24
MatchMapping = 25
MatchSequence = 26
Nop = 27
NotTaken = 28
PopExcept = 29
PopIter = 30
PopTop = 31
PushExcInfo = 32
PushNull = 33
ReturnGenerator = 34
ReturnValue = 35
SetupAnnotations = 36
StoreSlice = 37
StoreSubscr = 38
ToBool = 39
UnaryInvert = 40
UnaryNegative = 41
UnaryNot = 42
WithExceptStart = 43
BinaryOp
Fields
op: Arg<BinaryOperator>BuildInterpolation
Build an Interpolation from value, expression string, and optional format_spec on stack.
oparg encoding: (conversion << 2) | has_format_spec
- has_format_spec (bit 0): if 1, format_spec is on stack
- conversion (bits 2+): 0=None, 1=Str, 2=Repr, 3=Ascii
Stack: [value, expression_str, format_spec?] -> [interpolation]
BuildList
BuildMap
BuildSet
BuildSlice
Fields
argc: Arg<BuildSliceArgCount>BuildString
BuildTuple
Call
CallIntrinsic1
Fields
func: Arg<IntrinsicFunction1>CallIntrinsic2
Fields
func: Arg<IntrinsicFunction2>CallKw
CompareOp
Fields
opname: Arg<ComparisonOperator>ContainsOp
ConvertValue
Fields
oparg: Arg<ConvertValueOparg>Copy
CopyFreeVars
DeleteAttr
DeleteDeref
DeleteFast
DeleteGlobal
DeleteName
DictMerge
DictUpdate
EndAsyncFor = 68
ExtendedArg = 69
ForIter
GetAwaitable
ImportFrom
ImportName
IsOp
JumpBackward
JumpBackwardNoInterrupt
JumpForward
ListAppend
ListExtend
LoadAttr
LoadCommonConstant
Fields
idx: Arg<CommonConstant>LoadConst
LoadDeref
LoadFast
LoadFastAndClear
LoadFastBorrow
LoadFastBorrowLoadFastBorrow
LoadFastCheck
LoadFastLoadFast
LoadFromDictOrDeref
LoadFromDictOrGlobals
LoadGlobal
LoadName
LoadSmallInt
LoadSpecial
Fields
method: Arg<SpecialMethod>LoadSuperAttr
Fields
namei: Arg<LoadSuperAttr>MakeCell
MapAdd
MatchClass
PopJumpIfFalse
PopJumpIfNone
PopJumpIfNotNone
PopJumpIfTrue
RaiseVarargs
Reraise
Send
SetAdd
SetFunctionAttribute
Fields
flag: Arg<MakeFunctionFlag>SetUpdate
StoreAttr
StoreDeref
StoreFast
StoreFastLoadFast
StoreFastStoreFast
StoreGlobal
StoreName
Swap
UnpackEx
Fields
counts: Arg<UnpackExArgs>UnpackSequence
YieldValue
Resume
Fields
context: Arg<ResumeContext>BinaryOpAddFloat = 129
BinaryOpAddInt = 130
BinaryOpAddUnicode = 131
BinaryOpExtend = 132
BinaryOpMultiplyFloat = 133
BinaryOpMultiplyInt = 134
BinaryOpSubscrDict = 135
BinaryOpSubscrGetitem = 136
BinaryOpSubscrListInt = 137
BinaryOpSubscrListSlice = 138
BinaryOpSubscrStrInt = 139
BinaryOpSubscrTupleInt = 140
BinaryOpSubtractFloat = 141
BinaryOpSubtractInt = 142
CallAllocAndEnterInit = 143
CallBoundMethodExactArgs = 144
CallBoundMethodGeneral = 145
CallBuiltinClass = 146
CallBuiltinFast = 147
CallBuiltinFastWithKeywords = 148
CallBuiltinO = 149
CallIsinstance = 150
CallKwBoundMethod = 151
CallKwNonPy = 152
CallKwPy = 153
CallLen = 154
CallListAppend = 155
CallMethodDescriptorFast = 156
CallMethodDescriptorFastWithKeywords = 157
CallMethodDescriptorNoargs = 158
CallMethodDescriptorO = 159
CallNonPyGeneral = 160
CallPyExactArgs = 161
CallPyGeneral = 162
CallStr1 = 163
CallTuple1 = 164
CallType1 = 165
CompareOpFloat = 166
CompareOpInt = 167
CompareOpStr = 168
ContainsOpDict = 169
ContainsOpSet = 170
ForIterGen = 171
ForIterList = 172
ForIterRange = 173
ForIterTuple = 174
JumpBackwardJit = 175
JumpBackwardNoJit = 176
LoadAttrClass = 177
LoadAttrClassWithMetaclassCheck = 178
LoadAttrGetattributeOverridden = 179
LoadAttrInstanceValue = 180
LoadAttrMethodLazyDict = 181
LoadAttrMethodNoDict = 182
LoadAttrMethodWithValues = 183
LoadAttrModule = 184
LoadAttrNondescriptorNoDict = 185
LoadAttrNondescriptorWithValues = 186
LoadAttrProperty = 187
LoadAttrSlot = 188
LoadAttrWithHint = 189
LoadConstImmortal = 190
LoadConstMortal = 191
LoadGlobalBuiltin = 192
LoadGlobalModule = 193
LoadSuperAttrAttr = 194
LoadSuperAttrMethod = 195
ResumeCheck = 196
SendGen = 197
StoreAttrInstanceValue = 198
StoreAttrSlot = 199
StoreAttrWithHint = 200
StoreSubscrDict = 201
StoreSubscrListInt = 202
ToBoolAlwaysTrue = 203
ToBoolBool = 204
ToBoolInt = 205
ToBoolList = 206
ToBoolNone = 207
ToBoolStr = 208
UnpackSequenceList = 209
UnpackSequenceTuple = 210
UnpackSequenceTwoTuple = 211
InstrumentedEndFor = 234
InstrumentedPopIter = 235
InstrumentedEndSend = 236
InstrumentedForIter = 237
InstrumentedInstruction = 238
InstrumentedJumpForward = 239
InstrumentedNotTaken = 240
InstrumentedPopJumpIfTrue = 241
InstrumentedPopJumpIfFalse = 242
InstrumentedPopJumpIfNone = 243
InstrumentedPopJumpIfNotNone = 244
InstrumentedResume = 245
InstrumentedReturnValue = 246
InstrumentedYieldValue = 247
InstrumentedEndAsyncFor = 248
InstrumentedLoadSuperAttr = 249
InstrumentedCall = 250
InstrumentedCallKw = 251
InstrumentedCallFunctionEx = 252
InstrumentedJumpBackward = 253
InstrumentedLine = 254
EnterExecutor = 255
Implementations§
Source§impl Instruction
impl Instruction
Sourcepub const fn is_instrumented(self) -> bool
pub const fn is_instrumented(self) -> bool
Returns true if this is any instrumented opcode
(regular INSTRUMENTED_*, INSTRUMENTED_LINE, or INSTRUMENTED_INSTRUCTION).
Sourcepub fn to_instrumented(self) -> Option<Self>
pub fn to_instrumented(self) -> Option<Self>
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.
Sourcepub const fn to_base(self) -> Option<Self>
pub const fn to_base(self) -> Option<Self>
Map an INSTRUMENTED_* opcode back to its base variant.
Returns None for non-instrumented opcodes, and also for
InstrumentedLine / InstrumentedInstruction which are event-layer
placeholders without a fixed base opcode (the real opcode is stored in
CoMonitoringData).
The returned base opcode uses Arg::marker() for typed fields —
only the opcode byte matters since replace_op preserves the arg byte.
Sourcepub const fn deopt(self) -> Option<Self>
pub const fn deopt(self) -> Option<Self>
Map a specialized opcode back to its adaptive (base) variant.
_PyOpcode_Deopt
Sourcepub const fn deoptimize(self) -> Self
pub const fn deoptimize(self) -> Self
Map a specialized or instrumented opcode back to its adaptive (base) variant.
Sourcepub const fn cache_entries(self) -> usize
pub const fn cache_entries(self) -> usize
Number of CACHE code units that follow this instruction. _PyOpcode_Caches
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl From<Instruction> for AnyInstruction
impl From<Instruction> for AnyInstruction
Source§fn from(value: Instruction) -> Self
fn from(value: Instruction) -> Self
Source§impl From<Instruction> for u8
impl From<Instruction> for u8
Source§fn from(ins: Instruction) -> Self
fn from(ins: Instruction) -> Self
Source§impl InstructionMetadata for Instruction
impl InstructionMetadata for Instruction
Source§fn label_arg(&self) -> Option<Arg<Label>>
fn label_arg(&self) -> Option<Arg<Label>>
fn is_unconditional_jump(&self) -> bool
fn is_scope_exit(&self) -> bool
Source§fn stack_effect_info(&self, oparg: u32) -> StackEffect
fn stack_effect_info(&self, oparg: u32) -> StackEffect
fn fmt_dis( &self, arg: OpArg, f: &mut Formatter<'_>, ctx: &impl InstrDisplayContext, expand_code_objects: bool, pad: usize, level: usize, ) -> Result
Source§fn stack_effect(&self, oparg: u32) -> i32
fn stack_effect(&self, oparg: u32) -> i32
Self::stack_effect_info.fn display(&self, arg: OpArg, ctx: &impl InstrDisplayContext) -> impl Display
Source§impl TryFrom<u8> for Instruction
impl TryFrom<u8> for Instruction
Source§type Error = MarshalError
type Error = MarshalError
impl Copy for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnsafeUnpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more