@@ -420,6 +420,12 @@ impl<'a, ElideLists: ListElisionPolicy> StackfulPreOrderHeapIter<'a, ElideLists>
|
|||||||
let loc = IterStackLoc::iterable_loc(vh, HeapOrStackTag::Heap);
|
let loc = IterStackLoc::iterable_loc(vh, HeapOrStackTag::Heap);
|
||||||
|
|
||||||
self.forward_if_referent_marked(loc);
|
self.forward_if_referent_marked(loc);
|
||||||
|
|
||||||
|
if self.read_cell(h).get_forwarding_bit() {
|
||||||
|
self.stack.push(h);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
self.push_if_unmarked(loc);
|
self.push_if_unmarked(loc);
|
||||||
|
|
||||||
self.stack.push(IterStackLoc::pending_mark_loc(vh + 1, HeapOrStackTag::Heap));
|
self.stack.push(IterStackLoc::pending_mark_loc(vh + 1, HeapOrStackTag::Heap));
|
||||||
@@ -2138,9 +2144,6 @@ mod tests {
|
|||||||
list_loc_as_cell!(1)
|
list_loc_as_cell!(1)
|
||||||
);
|
);
|
||||||
assert_eq!(iter.next().unwrap(), cyclic_link);
|
assert_eq!(iter.next().unwrap(), cyclic_link);
|
||||||
assert_eq!(iter.next().unwrap(), cyclic_link);
|
|
||||||
assert_eq!(iter.next().unwrap(), cyclic_link);
|
|
||||||
|
|
||||||
assert_eq!(iter.next(), None);
|
assert_eq!(iter.next(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -873,18 +873,6 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
var_opt => {
|
var_opt => {
|
||||||
if is_cyclic && cell.is_compound(self.iter.heap) {
|
if is_cyclic && cell.is_compound(self.iter.heap) {
|
||||||
// self-referential variables are marked "cyclic".
|
// self-referential variables are marked "cyclic".
|
||||||
read_heap_cell!(cell,
|
|
||||||
(HeapCellValueTag::Lis, vh) => {
|
|
||||||
if self.iter.heap[vh].get_forwarding_bit() {
|
|
||||||
self.iter.pop_stack();
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.iter.heap[vh+1].get_forwarding_bit() {
|
|
||||||
self.iter.pop_stack();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
);
|
|
||||||
|
|
||||||
match var_opt {
|
match var_opt {
|
||||||
Some(var) => {
|
Some(var) => {
|
||||||
@@ -903,32 +891,23 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
|
|||||||
} else {
|
} else {
|
||||||
debug_assert!(cell.is_ref());
|
debug_assert!(cell.is_ref());
|
||||||
|
|
||||||
let h = if cell.get_tag() == HeapCellValueTag::PStrLoc {
|
let h = match cell.get_tag() {
|
||||||
self.state_stack
|
HeapCellValueTag::Lis | HeapCellValueTag::PStrLoc => {
|
||||||
.push(TokenOrRedirect::Atom(atom!("...")));
|
self.iter.focus().value() as usize
|
||||||
return None;
|
}
|
||||||
} else {
|
_ => cell.get_value() as usize,
|
||||||
cell.get_value()
|
};
|
||||||
} as usize;
|
|
||||||
|
|
||||||
// as usual, the WAM's
|
match cell.get_tag() {
|
||||||
// optimization of the Lis tag
|
HeapCellValueTag::Lis => {
|
||||||
// (conflating the location of
|
|
||||||
// the list and that of its
|
|
||||||
// first element) needs
|
|
||||||
// special consideration here
|
|
||||||
// lest we find ourselves in
|
|
||||||
// an infinite loop.
|
|
||||||
if cell.get_tag() == HeapCellValueTag::Lis {
|
|
||||||
if self.iter.heap[cell.get_value() as usize]
|
|
||||||
.get_forwarding_bit()
|
|
||||||
{
|
|
||||||
self.state_stack
|
self.state_stack
|
||||||
.push(TokenOrRedirect::Atom(atom!("...")));
|
.push(TokenOrRedirect::Atom(atom!("...")));
|
||||||
return None;
|
return None;
|
||||||
} else {
|
}
|
||||||
|
HeapCellValueTag::PStrLoc => {
|
||||||
*max_depth -= 1;
|
*max_depth -= 1;
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.iter.push_stack(IterStackLoc::iterable_loc(
|
self.iter.push_stack(IterStackLoc::iterable_loc(
|
||||||
|
|||||||
Reference in New Issue
Block a user