]> Repositorios git - scryer-prolog.git/commitdiff
remove tidy_trail
authorMark Thom <[email protected]>
Sun, 7 Feb 2021 22:39:48 +0000 (15:39 -0700)
committerMark Thom <[email protected]>
Sun, 7 Feb 2021 22:39:48 +0000 (15:39 -0700)
src/machine/machine_state.rs
src/machine/machine_state_impl.rs

index 6fedf6bbf8333781c18ea8cb815057afc77cf6fe..96964b1e1e7e3204d07f9160662d6f3bfd0031e1 100644 (file)
@@ -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();
                 }
             }
             _ => {
index c7075940fe3e44f9b78e60fd6b9fbf9bf5b46cc7..d92a4f6f51a63e27a78701072bd7bb9149c4a795 100644 (file)
@@ -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);