From: Mark Thom Date: Sun, 7 Feb 2021 22:39:48 +0000 (-0700) Subject: remove tidy_trail X-Git-Tag: v0.9.0~150^2~65^2~3 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=1dabe958997712bd7a6a8599dbb85bae0fb9f791;p=scryer-prolog.git remove tidy_trail --- diff --git a/src/machine/machine_state.rs b/src/machine/machine_state.rs index 6fedf6bb..96964b1e 100644 --- a/src/machine/machine_state.rs +++ b/src/machine/machine_state.rs @@ -1367,7 +1367,6 @@ fn cut_body(machine_st: &mut MachineState, addr: &Addr) -> bool { &Addr::CutPoint(b0) | &Addr::Usize(b0) => { if b > b0 { machine_st.b = b0; - machine_st.tidy_trail(); } } _ => { @@ -1455,7 +1454,6 @@ impl CutPolicy for SCCCutPolicy { Addr::Usize(b0) | Addr::CutPoint(b0) => { if b > b0 { machine_st.b = b0; - machine_st.tidy_trail(); } } _ => { diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index c7075940..d92a4f6f 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -588,7 +588,8 @@ impl MachineState { } } - pub(super) fn trail(&mut self, r: TrailRef) { + pub(super) + fn trail(&mut self, r: TrailRef) { match r { TrailRef::Ref(Ref::HeapCell(h)) => { if h < self.hb { @@ -668,41 +669,6 @@ impl MachineState { } } - pub(super) fn tidy_trail(&mut self) { - if self.b == 0 { - return; - } - - let b = self.b; - let hb = self.hb; - let mut offset = 0; - - for i in self.stack.index_or_frame(b).prelude.tr..self.tr { - match self.trail[i] { - TrailRef::Ref(Ref::AttrVar(tr_i)) - | TrailRef::Ref(Ref::HeapCell(tr_i)) - | TrailRef::AttrVarHeapLink(tr_i) - | TrailRef::AttrVarListLink(tr_i, _) => { - if tr_i >= hb { - offset += 1; - } else { - self.trail[i - offset] = self.trail[i]; - } - } - TrailRef::Ref(Ref::StackCell(b, _)) => { - if b < self.b { - self.trail[i - offset] = self.trail[i]; - } else { - offset += 1; - } - } - } - } - - self.tr -= offset; - self.trail.truncate(self.tr); - } - pub(super) fn match_partial_string(&mut self, addr: Addr, string: &String, has_tail: bool) { let mut heap_pstr_iter = self.heap_pstr_iter(addr); @@ -3120,7 +3086,6 @@ impl MachineState { if b > b0 { self.b = b0; - self.tidy_trail(); if b > self.e { self.stack.truncate(b);