Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 2 additions & 4 deletions crates/codegen/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,6 @@ impl CodeInfo {
/// This is a reference counting optimization in CPython; in RustPython
/// we implement it for bytecode compatibility.
fn optimize_load_fast_borrow(&mut self) {
use rustpython_compiler_core::bytecode::InstructionMetadata;

// NOT_LOCAL marker: instruction didn't come from a LOAD_FAST
const NOT_LOCAL: usize = usize::MAX;

Expand Down Expand Up @@ -733,7 +731,7 @@ impl CodeInfo {
// is pop 2 push 1, not pop 1 push 0). We list those explicitly;
// the fallback under-pops and under-pushes, which is conservative
// (may miss optimisation opportunities but never miscompiles).
let effect = instr.stack_effect(info.arg);
let effect = instr.stack_effect(info.arg.into());
let (pops, pushes) = match instr {
// --- pop 2, push 1 ---
Instruction::BinaryOp { .. }
Expand Down Expand Up @@ -866,7 +864,7 @@ impl CodeInfo {
let block = &self.blocks[block_idx];
for ins in &block.instructions {
let instr = &ins.instr;
let effect = instr.stack_effect(ins.arg);
let effect = instr.stack_effect(ins.arg.into());
if DEBUG {
let display_arg = if ins.target == BlockIdx::NULL {
ins.arg
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler-core/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustpython_wtf8::{Wtf8, Wtf8Buf};

pub use crate::bytecode::{
instruction::{
AnyInstruction, Arg, Instruction, InstructionMetadata, PseudoInstruction,
AnyInstruction, Arg, Instruction, InstructionMetadata, PseudoInstruction, StackEffect,
decode_load_attr_arg, decode_load_super_attr_arg, encode_load_attr_arg,
encode_load_super_attr_arg,
},
Expand Down
Loading
Loading