Convert DEREF instruction opargs from cell-relative indices to localsplus indices using the cellfixedoffsets mapping.
(blocks: &mut [Block], cellfixedoffsets: &[u32])
| 3122 | /// Convert DEREF instruction opargs from cell-relative indices to localsplus indices |
| 3123 | /// using the cellfixedoffsets mapping. |
| 3124 | pub(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 | } |
no test coverage detected