8000 add instructions · RustPython/RustPython@5c0f70c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c0f70c

Browse files
arihant2mathyouknowone
authored andcommitted
add instructions
1 parent 4e2e0b4 commit 5c0f70c

File tree

3 files changed

+58
-36
lines changed

3 files changed

+58
-36
lines changed

Cargo.lock

Lines changed: 43 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jit/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ num-traits = { workspace = true }
1717
thiserror = { workspace = true }
1818
libffi = { workspace = true, features = ["system"] }
1919

20-
cranelift = "0.118"
21-
cranelift-jit = "0.118"
22-
cranelift-module = "0.118"
20+
cranelift = "0.119"
21+
cranelift-jit = "0.119"
22+
cranelift-module = "0.119"
2323

2424
[dev-dependencies]
2525
rustpython-derive = { path = "../derive", version = "0.4.0" }

jit/src/instructions.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,18 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
600600
_ => Err(JitCompileError::BadBytecode),
601601
}
602602
}
603+
Instruction::Nop => Ok(()),
604+
Instruction::Swap { index } => {
605+
let len = self.stack.len();
606+
let i = len - 1;
607+
let j = len - 1 - index.get(arg) as usize;
608+
self.stack.swap(i, j);
609+
Ok(())
610+
}
611+
Instruction::Pop => {
612+
self.stack.pop();
613+
Ok(())
614+
}
603615
_ => Err(JitCompileError::NotSupported),
604616
}
605617
}

0 commit comments

Comments
 (0)
0