]> Repositorios git - scryer-prolog.git/commitdiff
check for PStr in eager stackful preorder iterator before adding tail of PStrOffset...
authorMark <[email protected]>
Tue, 9 Jan 2024 00:36:41 +0000 (17:36 -0700)
committerMark <[email protected]>
Tue, 9 Jan 2024 00:36:41 +0000 (17:36 -0700)
src/heap_iter.rs
src/machine/system_calls.rs

index 4713aa63159ab3458d258f7b349d63b453606d54..9c9d417c44f3d0cef9c3afe7f5c4424cdd5bac7f 100644 (file)
@@ -108,7 +108,7 @@ impl<'a> EagerStackfulPreOrderHeapIter<'a> {
                     let var_value = self.heap[h];
                     self.heap[h].set_mark_bit(self.mark_phase);
 
-                    if !(self.heap[h].is_var() && self.heap[h].get_value() as usize == h) {
+                    if var_value.get_mark_bit() || !(self.heap[h].is_var() && self.heap[h].get_value() as usize == h) {
                         self.iter_stack.push(var_value);
                         continue;
                     }
@@ -125,12 +125,13 @@ impl<'a> EagerStackfulPreOrderHeapIter<'a> {
                         continue;
                     }
 
-                    let value = self.heap[h+1];
-
                     self.heap[h].set_mark_bit(self.mark_phase);
-                    self.heap[h+1].set_mark_bit(self.mark_phase);
 
-                    self.iter_stack.push(value);
+                    if self.heap[h].get_tag() == HeapCellValueTag::PStr {
+                        let value = self.heap[h+1];
+                        self.heap[h+1].set_mark_bit(self.mark_phase);
+                        self.iter_stack.push(value);
+                    }
                 }
                 _ => {
                 }
index dbcbacd06366d15fdeabc56d39a2f94642a3eb59..f6c8388e93d4302cdf39f85d339a3b8c8fee1a9e 100644 (file)
@@ -578,6 +578,7 @@ impl MachineState {
         )
     }
 
+
     #[inline]
     pub(crate) fn variable_set<S: BuildHasher>(
         &mut self,