]> Repositorios git - scryer-prolog.git/commitdiff
correct is_cyclic again for non-variable ref cells (#2116)
authorMark <[email protected]>
Sun, 15 Oct 2023 07:28:42 +0000 (01:28 -0600)
committerMark <[email protected]>
Sun, 15 Oct 2023 07:28:42 +0000 (01:28 -0600)
src/machine/gc.rs
src/tests/acyclic_term.pl

index 7958cf67b55638e1d6bd5ea4756af78a01d951af..25f30a0062e21099e78ecc87f60f20331b7e378c 100644 (file)
@@ -273,8 +273,10 @@ impl<'a, UMP: UnmarkPolicy> StacklessPreOrderHeapIter<'a, UMP> {
     fn is_cyclic(&self, var_current: usize, var_next: usize) -> bool {
         if self.heap[var_next].is_var() {
             !self.heap[var_next].get_forwarding_bit() && var_current != var_next
+        } else if self.heap[var_next].is_ref() {
+            self.heap[var_next].get_mark_bit()
         } else {
-            self.heap[var_next].is_ref()
+            false
         }
     }
 
index fd8ad229ed8c52bfaa7fd8ed4f0e15c3c757a601..cbbf2466d947ca34d5d9cd6e6cb831f6aab533f4 100644 (file)
@@ -173,6 +173,10 @@ test("acyclic_term#2114", (
     A=B*B, acyclic_term(A)
 )).
 
+test("acyclic_term#2116", (
+    A=B*B,B=[]*[], acyclic_term(A)
+)).
+
 main :-
     findall(test(Name, Goal), test(Name, Goal), Tests),
     run_tests(Tests, Failed),