From ad4236263a0b8d89e0a0f7d9adef1901487f0c01 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Fri, 19 Oct 2018 16:55:07 +0200 Subject: [PATCH] Don't update PC on every instruction (#130) --- src/runner.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/runner.rs b/src/runner.rs index 8fa1a6d..d2b1ce4 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -237,12 +237,9 @@ impl Interpreter { let instruction = iter.next().expect("instruction"); match self.run_instruction(function_context, instruction)? { - InstructionOutcome::RunNextInstruction => { - function_context.position = iter.position(); - }, + InstructionOutcome::RunNextInstruction => {}, InstructionOutcome::Branch(target) => { - function_context.position = target.dst_pc; - iter = instructions.iterate_from(function_context.position); + iter = instructions.iterate_from(target.dst_pc); self.value_stack.drop_keep(target.drop_keep); }, InstructionOutcome::ExecuteCall(func_ref) => {