Implements the `StoreArray` opcode.
(&mut self, instr: u32, heap: &mut Heap)
| 1095 | |
| 1096 | /// Implements the `StoreArray` opcode. |
| 1097 | pub(super) fn do_store_array(&mut self, instr: u32, heap: &mut Heap) { |
| 1098 | let (arr_reg, val_reg, first_sub_reg) = bytecode::parse_store_array(instr); |
| 1099 | |
| 1100 | let value = self.get_reg(val_reg); |
| 1101 | if let Some((heap_idx, flat_idx)) = self.resolve_array_index(arr_reg, first_sub_reg, heap) { |
| 1102 | let array = match heap.get_mut(heap_idx) { |
| 1103 | HeapDatum::Array(a) => a, |
| 1104 | _ => unreachable!("Register must point to an array"), |
| 1105 | }; |
| 1106 | array.values[flat_idx] = value; |
| 1107 | self.pc += 1; |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | /// Implements the `SubtractDouble` opcode. |
| 1112 | pub(super) fn do_subtract_double(&mut self, instr: u32) { |
no test coverage detected