From 4e23f516343597c843fbfd8be0838612ec9579e0 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Mon, 2 Oct 2023 19:27:30 -0500 Subject: [PATCH] :construction: this seemed to improve perf a little but idk why --- lunar_wave_vm/src/state.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lunar_wave_vm/src/state.rs b/lunar_wave_vm/src/state.rs index f4265e2..89682d8 100644 --- a/lunar_wave_vm/src/state.rs +++ b/lunar_wave_vm/src/state.rs @@ -510,9 +510,9 @@ impl State { self.current_block = Rc::clone (&self.chunk.blocks [frame.block_idx]); } - fn fetch (&self) -> Instruction { + fn fetch (&self) -> &Instruction { match self.current_block.instructions.get (self.stack_top.program_counter) { - Some (x) => *x, + Some (x) => x, None => { dbg! (&self.stack, &self.stack_top); panic! ("program_counter went out of bounds"); @@ -532,7 +532,7 @@ impl State { self.make_step_error (msg, &instruction) }; - match instruction { + match *instruction { Instruction::Add (a, b, c) => { if self.op_add (a, b, c) { self.stack_top.program_counter += 1;