MCPcopy Index your code
hub / github.com/endbasic/endbasic / do_store_array

Method do_store_array

core/src/vm/context.rs:1097–1109  ·  view source on GitHub ↗

Implements the `StoreArray` opcode.

(&mut self, instr: u32, heap: &mut Heap)

Source from the content-addressed store, hash-verified

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) {

Callers 1

execMethod · 0.80

Calls 3

get_regMethod · 0.80
resolve_array_indexMethod · 0.80
get_mutMethod · 0.45

Tested by

no test coverage detected