Visitar URL original
Sort `Instruction` variants + Ensure each holds a singular oparg type by ShaharNaveh · Pull Request #6312 · RustPython/RustPython · GitHub
Skip to content
Closed
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
Prev Previous commit
Next Next commit
fix Jit's process_instruction
  • Loading branch information
ShaharNaveh committed Nov 29, 2025
commit 845cdd947cdf1f87a4b864693e75419139ae140d
10 changes: 5 additions & 5 deletions crates/jit/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl StackMachine {
names: &[String],
) -> ControlFlow<()> {
match instruction {
Instruction::LoadConst { idx } => {
Instruction::LoadConst(idx) => {
let idx = idx.get(arg);
self.stack.push(constants[idx as usize].clone().into())
}
Expand All @@ -104,12 +104,12 @@ impl StackMachine {
self.locals
.insert(names[idx as usize].clone(), self.stack.pop().unwrap());
}
Instruction::StoreAttr { .. } => {
Instruction::StoreAttr(_) => {
// Do nothing except throw away the stack values
self.stack.pop().unwrap();
self.stack.pop().unwrap();
}
Instruction::BuildMap { size, .. } => {
Instruction::BuildMap(size) => {
let mut map = HashMap::new();
for _ in 0..size.get(arg) {
let value = self.stack.pop().unwrap();
Expand All @@ -134,7 +134,7 @@ impl StackMachine {
annotations: HashMap::new(), // empty annotations, will be set later if needed
}));
}
Instruction::SetFunctionAttribute { attr } => {
Instruction::SetFunctionAttribute(attr) => {
// Stack: [..., attr_value, func] -> [..., func]
let func = if let Some(StackValue::Function(func)) = self.stack.pop() {
func
Expand Down Expand Up @@ -164,7 +164,7 @@ impl StackMachine {
self.stack.push(StackValue::Function(func));
}
}
Instruction::ReturnConst { idx } => {
Instruction::ReturnConst(idx) => {
let idx = idx.get(arg);
self.stack.push(constants[idx as usize].clone().into());
return ControlFlow::Break(());
Expand Down