Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove Reverse bytecode
  • Loading branch information
ShaharNaveh committed Jan 9, 2026
commit 2aba3fc9bb465318f6a072d2f345d666acb059d4
5 changes: 2 additions & 3 deletions Lib/_opcode_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@
'JUMP_IF_TRUE_OR_POP': 130,
'JUMP_IF_NOT_EXC_MATCH': 131,
'LOAD_CLASS_DEREF': 132,
'REVERSE': 133,
'SET_EXC_INFO': 134,
'SUBSCRIPT': 135,
'SET_EXC_INFO': 133,
'SUBSCRIPT': 134,
'RESUME': 149,
'JUMP': 252,
'LOAD_CLOSURE': 253,
Expand Down
11 changes: 3 additions & 8 deletions crates/compiler-core/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ pub enum Instruction {
Resume {
arg: Arg<u32>,
} = 149,
// ==================== RustPython-only instructions (119-135) ====================
// ==================== RustPython-only instructions (119-134) ====================
// Ideally, we want to be fully aligned with CPython opcodes, but we still have some leftovers.
// So we assign random IDs to these opcodes.
Break {
Expand Down Expand Up @@ -941,11 +941,8 @@ pub enum Instruction {
} = 130,
JumpIfNotExcMatch(Arg<Label>) = 131,
LoadClassDeref(Arg<NameIdx>) = 132,
Reverse {
amount: Arg<u32>,
} = 133,
SetExcInfo = 134,
Subscript = 135,
SetExcInfo = 133,
Subscript = 134,
Comment thread
ShaharNaveh marked this conversation as resolved.
Outdated
// ===== Pseudo Opcodes (252+) ======
Jump {
target: Arg<Label>,
Expand Down Expand Up @@ -1895,7 +1892,6 @@ impl Instruction {
-1 + before as i32 + 1 + after as i32
}
PopExcept => 0,
Reverse { .. } => 0,
GetAwaitable => 0,
BeforeAsyncWith => 1,
GetAIter => 0,
Expand Down Expand Up @@ -2068,7 +2064,6 @@ impl Instruction {
Resume { arg } => w!(RESUME, arg),
ReturnConst { idx } => fmt_const("RETURN_CONST", arg, f, idx),
ReturnValue => w!(RETURN_VALUE),
Reverse { amount } => w!(REVERSE, amount),
Send { target } => w!(SEND, target),
SetAdd { i } => w!(SET_ADD, i),
SetExcInfo => w!(SET_EXC_INFO),
Expand Down
5 changes: 0 additions & 5 deletions crates/vm/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,11 +1478,6 @@ impl ExecutingFrame<'_> {
let value = self.pop_value();
self.unwind_blocks(vm, UnwindReason::Returning { value })
}
bytecode::Instruction::Reverse { amount } => {
let stack_len = self.state.stack.len();
self.state.stack[stack_len - amount.get(arg) as usize..stack_len].reverse();
Ok(None)
}
bytecode::Instruction::SetAdd { i } => {
let item = self.pop_value();
let obj = self.nth_value(i.get(arg));
Expand Down
Loading