🚧 this seemed to improve perf a little but idk why
parent
b35dc346e8
commit
4e23f51634
|
@ -510,9 +510,9 @@ impl State {
|
||||||
self.current_block = Rc::clone (&self.chunk.blocks [frame.block_idx]);
|
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) {
|
match self.current_block.instructions.get (self.stack_top.program_counter) {
|
||||||
Some (x) => *x,
|
Some (x) => x,
|
||||||
None => {
|
None => {
|
||||||
dbg! (&self.stack, &self.stack_top);
|
dbg! (&self.stack, &self.stack_top);
|
||||||
panic! ("program_counter went out of bounds");
|
panic! ("program_counter went out of bounds");
|
||||||
|
@ -532,7 +532,7 @@ impl State {
|
||||||
self.make_step_error (msg, &instruction)
|
self.make_step_error (msg, &instruction)
|
||||||
};
|
};
|
||||||
|
|
||||||
match instruction {
|
match *instruction {
|
||||||
Instruction::Add (a, b, c) => {
|
Instruction::Add (a, b, c) => {
|
||||||
if self.op_add (a, b, c) {
|
if self.op_add (a, b, c) {
|
||||||
self.stack_top.program_counter += 1;
|
self.stack_top.program_counter += 1;
|
||||||
|
|
Loading…
Reference in New Issue