MCPcopy Index your code
hub / github.com/RustPython/RustPython / fixup_deref_opargs

Function fixup_deref_opargs

crates/codegen/src/ir.rs:3124–3144  ·  view source on GitHub ↗

Convert DEREF instruction opargs from cell-relative indices to localsplus indices using the cellfixedoffsets mapping.

(blocks: &mut [Block], cellfixedoffsets: &[u32])

Source from the content-addressed store, hash-verified

3122/// Convert DEREF instruction opargs from cell-relative indices to localsplus indices
3123/// using the cellfixedoffsets mapping.
3124pub(crate) fn fixup_deref_opargs(blocks: &mut [Block], cellfixedoffsets: &[u32]) {
3125 for block in blocks.iter_mut() {
3126 for info in &mut block.instructions {
3127 let Some(instr) = info.instr.real() else {
3128 continue;
3129 };
3130 let needs_fixup = matches!(
3131 instr,
3132 Instruction::LoadDeref { .. }
3133 | Instruction::StoreDeref { .. }
3134 | Instruction::DeleteDeref { .. }
3135 | Instruction::LoadFromDictOrDeref { .. }
3136 | Instruction::MakeCell { .. }
3137 );
3138 if needs_fixup {
3139 let cell_relative = u32::from(info.arg) as usize;
3140 info.arg = OpArg::new(cellfixedoffsets[cell_relative]);
3141 }
3142 }
3143 }
3144}

Callers 1

finalize_codeMethod · 0.85

Calls 3

newFunction · 0.85
iter_mutMethod · 0.45
realMethod · 0.45

Tested by

no test coverage detected