remove list remnants from stack iteration in printer when cyclic (#2131)

This commit is contained in:
Mark
2023-10-24 14:10:11 -06:00
parent 4ab3e23b1f
commit 773d3f81fd
4 changed files with 27 additions and 11 deletions

View File

@@ -175,6 +175,15 @@ impl<'a, const STOP_AT_CYCLES: bool> CycleDetectingIter<'a, STOP_AT_CYCLES> {
None => return None,
};
if self.cycle_detection_active() {
for idx in (self.next as usize .. last_cell_loc).rev() {
if self.heap[idx].get_forwarding_bit() {
self.cycle_found = true;
return None;
}
}
}
if (last_cell_loc + 1) as u64 == self.next {
if self.backward() {
return None;
@@ -186,15 +195,6 @@ impl<'a, const STOP_AT_CYCLES: bool> CycleDetectingIter<'a, STOP_AT_CYCLES> {
self.heap[last_cell_loc].set_mark_bit(self.mark_phase);
}
if self.cycle_detection_active() {
for idx in (self.next as usize .. last_cell_loc).rev() {
if self.heap[idx].get_forwarding_bit() {
self.cycle_found = true;
return None;
}
}
}
self.heap[last_cell_loc].set_forwarding_bit(true);
self.next = self.heap[last_cell_loc].get_value();