From 45a55eb12ece91d7b4cc3f11276e8a351d318db4 Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 29 Nov 2024 12:07:58 -0500 Subject: [PATCH] Clean up VM jump hanlding --- dust-lang/src/vm.rs | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/dust-lang/src/vm.rs b/dust-lang/src/vm.rs index 1a11d2b..3930a00 100644 --- a/dust-lang/src/vm.rs +++ b/dust-lang/src/vm.rs @@ -121,7 +121,7 @@ impl<'a> Vm<'a> { self.set_register(register_index, register)?; if jump_next { - self.ip += 1 + self.jump(1, true); } } Operation::LoadList => { @@ -285,14 +285,6 @@ impl<'a> Vm<'a> { if boolean == test_value { self.jump(1, true); - } else { - let jump = self.read()?; - let Jump { - offset, - is_positive, - } = Jump::from(&jump); - - self.jump(offset as usize, is_positive); } } Operation::TestSet => { @@ -354,14 +346,6 @@ impl<'a> Vm<'a> { if is_equal == value { self.jump(1, true); - } else { - let jump = self.read()?; - let Jump { - offset, - is_positive, - } = Jump::from(&jump); - - self.jump(offset as usize, is_positive); } } Operation::Less => { @@ -384,14 +368,6 @@ impl<'a> Vm<'a> { if is_less_than == value { self.jump(1, true); - } else { - let jump = self.read()?; - let Jump { - offset, - is_positive, - } = Jump::from(&jump); - - self.jump(offset as usize, is_positive); } } Operation::LessEqual => { @@ -418,14 +394,6 @@ impl<'a> Vm<'a> { if is_less_than_or_equal == value { self.jump(1, true); - } else { - let jump = self.read()?; - let Jump { - offset, - is_positive, - } = Jump::from(&jump); - - self.jump(offset as usize, is_positive); } } Operation::Negate => {