From: Mark Thom Date: Mon, 19 Mar 2018 01:25:45 +0000 (-0600) Subject: remove redundant code from arith_eval_by_metacall X-Git-Tag: v0.8.110~518 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=612835500cc95e7a47594039f91d865685c1bf36;p=scryer-prolog.git remove redundant code from arith_eval_by_metacall --- diff --git a/src/prolog/machine/machine_state_impl.rs b/src/prolog/machine/machine_state_impl.rs index 640495f4..c32a8a49 100644 --- a/src/prolog/machine/machine_state_impl.rs +++ b/src/prolog/machine/machine_state_impl.rs @@ -301,10 +301,6 @@ impl MachineState { let instantiation_err = functor!("instantiation_error", 1, [heap_atom!("(is)/2")]); let a = self[r].clone(); - if let &Addr::Con(Constant::Number(ref n)) = &a { - return Ok(n.clone()); - } - let mut interms: Vec = Vec::with_capacity(64); for heap_val in self.post_order_iter(a) { @@ -1202,17 +1198,17 @@ impl MachineState { pub(super) fn execute_inlined(&mut self, inlined: &InlinedClauseType, rs: &Vec) { let r1 = rs[0].clone(); - + match inlined { &InlinedClauseType::CompareNumber(cmp) => { let r2 = rs[1].clone(); - + let n1 = try_or_fail!(self, self.arith_eval_by_metacall(r1)); let n2 = try_or_fail!(self, self.arith_eval_by_metacall(r2)); self.compare_numbers(cmp, n1, n2); }, - &InlinedClauseType::IsAtom => { + &InlinedClauseType::IsAtom => { let d = self.store(self.deref(self[r1].clone())); match d { @@ -1283,10 +1279,10 @@ impl MachineState { Addr::HeapCell(_) | Addr::StackCell(_,_) => self.p += 1, _ => self.fail = true }; - }, + }, } } - + pub(super) fn execute_built_in_instr<'a>(&mut self, code_dirs: CodeDirs<'a>, call_policy: &mut Box, cut_policy: &mut Box, @@ -1294,7 +1290,7 @@ impl MachineState { { match instr { &BuiltInInstruction::CallInlined(ref inlined, ref rs) => - self.execute_inlined(inlined, rs), + self.execute_inlined(inlined, rs), &BuiltInInstruction::CompareNumber(cmp, ref at_1, ref at_2) => { let n1 = try_or_fail!(self, self.get_number(at_1)); let n2 = try_or_fail!(self, self.get_number(at_2)); @@ -1327,7 +1323,7 @@ impl MachineState { } else { self.p += 1; } - + val }), &BuiltInInstruction::GetCurrentBlock => {