@@ -383,8 +383,6 @@ pub enum Instruction {
383383 InstrumentedPopJumpIfNone = 252 , // Placeholder
384384 InstrumentedPopJumpIfNotNone = 253 , // Placeholder
385385 InstrumentedLine = 254 , // Placeholder
386- // Pseudos (needs to be moved to `PseudoInstruction` enum.
387- LoadClosure ( Arg < NameIdx > ) = 255 , // TODO: Move to pseudos
388386}
389387
390388const _: ( ) = assert ! ( mem:: size_of:: <Instruction >( ) == 1 ) ;
@@ -415,9 +413,6 @@ impl TryFrom<u8> for Instruction {
415413 let instrumented_start = u8:: from ( Self :: InstrumentedResume ) ;
416414 let instrumented_end = u8:: from ( Self :: InstrumentedLine ) ;
417415
418- // TODO: Remove this; This instruction needs to be pseudo
419- let load_closure = u8:: from ( Self :: LoadClosure ( Arg :: marker ( ) ) ) ;
420-
421416 // RustPython-only opcodes (explicit list to avoid gaps like 125-127)
422417 let custom_ops: & [ u8 ] = & [
423418 u8:: from ( Self :: Break {
@@ -457,7 +452,6 @@ impl TryFrom<u8> for Instruction {
457452
458453 if ( cpython_start..=cpython_end) . contains ( & value)
459454 || value == resume_id
460- || value == load_closure
461455 || custom_ops. contains ( & value)
462456 || ( specialized_start..=specialized_end) . contains ( & value)
463457 || ( instrumented_start..=instrumented_end) . contains ( & value)
@@ -704,7 +698,6 @@ impl InstructionMetadata for Instruction {
704698 Self :: StoreFastStoreFast { .. } => 0 ,
705699 Self :: PopJumpIfNone { .. } => 0 ,
706700 Self :: PopJumpIfNotNone { .. } => 0 ,
707- Self :: LoadClosure ( _) => 1 ,
708701 Self :: BinaryOpAddFloat => 0 ,
709702 Self :: BinaryOpAddInt => 0 ,
710703 Self :: BinaryOpAddUnicode => 0 ,
@@ -935,7 +928,6 @@ impl InstructionMetadata for Instruction {
935928 }
936929 Self :: LoadBuildClass => w ! ( LOAD_BUILD_CLASS ) ,
937930 Self :: LoadFromDictOrDeref ( i) => w ! ( LOAD_FROM_DICT_OR_DEREF , cell_name = i) ,
938- Self :: LoadClosure ( i) => w ! ( LOAD_CLOSURE , cell_name = i) ,
939931 Self :: LoadConst { idx } => fmt_const ( "LOAD_CONST" , arg, f, idx) ,
940932 Self :: LoadDeref ( idx) => w ! ( LOAD_DEREF , cell_name = idx) ,
941933 Self :: LoadFast ( idx) => w ! ( LOAD_FAST , varname = idx) ,
@@ -1037,6 +1029,7 @@ pub enum PseudoInstruction {
10371029 SetupFinally = 265 , // Placeholder
10381030 SetupWith = 266 , // Placeholder
10391031 StoreFastMaybeNull = 267 , // Placeholder
1032+ LoadClosure ( Arg < NameIdx > ) = 268 ,
10401033}
10411034
10421035const _: ( ) = assert ! ( mem:: size_of:: <PseudoInstruction >( ) == 2 ) ;
@@ -1057,7 +1050,7 @@ impl TryFrom<u16> for PseudoInstruction {
10571050 let start = u16:: from ( Self :: Jump {
10581051 target : Arg :: marker ( ) ,
10591052 } ) ;
1060- let end = u16:: from ( Self :: StoreFastMaybeNull ) ;
1053+ let end = u16:: from ( Self :: LoadClosure ( Arg :: marker ( ) ) ) ;
10611054
10621055 if ( start..=end) . contains ( & value) {
10631056 Ok ( unsafe { mem:: transmute :: < u16 , Self > ( value) } )
@@ -1093,6 +1086,7 @@ impl InstructionMetadata for PseudoInstruction {
10931086 Self :: SetupWith => 0 ,
10941087 Self :: StoreFastMaybeNull => 0 ,
10951088 Self :: Reserved258 => 0 ,
1089+ Self :: LoadClosure ( _) => 1 ,
10961090 }
10971091 }
10981092
0 commit comments