From bf62fd7f7804b434834eb2de66edf0798bb92b20 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Tue, 19 Feb 2019 22:01:50 -0700 Subject: [PATCH] refactor parts of machine_state_impl.rs that consume copier.rs --- src/prolog/machine/machine_state_impl.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/prolog/machine/machine_state_impl.rs b/src/prolog/machine/machine_state_impl.rs index a4634776..c990b7ac 100644 --- a/src/prolog/machine/machine_state_impl.rs +++ b/src/prolog/machine/machine_state_impl.rs @@ -1348,9 +1348,7 @@ impl MachineState { pub(super) fn set_ball(&mut self) { let addr = self[temp_v!(1)].clone(); self.ball.boundary = self.heap.h; - - let duplicator = CopyBallTerm::new(self); - copy_term(duplicator, addr); + copy_term(CopyBallTerm::new(self), addr); } pub(super) fn setup_call_n(&mut self, arity: usize) -> Option @@ -2029,13 +2027,7 @@ impl MachineState { let a1 = self[temp_v!(1)].clone(); let a2 = self[temp_v!(2)].clone(); - // drop the mutable references contained in gadget - // once the term has been duplicated. - { - let gadget = CopyTerm::new(self); - copy_term(gadget, a1); - } - + copy_term(CopyTerm::new(self), a1); self.unify(Addr::HeapCell(old_h), a2); } @@ -2290,7 +2282,7 @@ impl MachineState { &ChoiceInstruction::TryMeElse(offset) => { let n = self.num_of_args; let gi = self.next_global_index(); - + self.or_stack.push(gi, self.e, self.cp.clone(), -- 2.54.0