@@ -1,5 +1,3 @@
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::machine::gc::{IteratorUMP};
|
||||
pub(crate) use crate::machine::gc::{CycleDetectorUMP, StacklessPreOrderHeapIter};
|
||||
|
||||
use crate::atom_table::*;
|
||||
@@ -505,24 +503,14 @@ impl<'a, ElideLists: ListElisionPolicy> Iterator for StackfulPreOrderHeapIter<'a
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[inline(always)]
|
||||
pub(crate) fn stackless_preorder_iter(
|
||||
heap: &mut Vec<HeapCellValue>,
|
||||
start: usize,
|
||||
) -> StacklessPreOrderHeapIter<IteratorUMP> {
|
||||
StacklessPreOrderHeapIter::<IteratorUMP>::new(heap, start)
|
||||
}
|
||||
|
||||
|
||||
pub(crate) fn cycle_detecting_stackless_preorder_iter(
|
||||
heap: &mut Heap,
|
||||
heap: &mut Vec<HeapCellValue>,
|
||||
start: usize,
|
||||
) -> StacklessPreOrderHeapIter<CycleDetectorUMP> {
|
||||
StacklessPreOrderHeapIter::<CycleDetectorUMP>::new(heap, start)
|
||||
}
|
||||
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn stackful_preorder_iter<'a, ElideLists: ListElisionPolicy>(
|
||||
heap: &'a mut Vec<HeapCellValue>,
|
||||
@@ -665,23 +653,30 @@ pub(crate) fn stackful_post_order_iter<'a, ElideLists: ListElisionPolicy>(
|
||||
PostOrderIterator::new(StackfulPreOrderHeapIter::new(heap, stack, cell))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) type RightistPostOrderHeapIter<'a> =
|
||||
PostOrderIterator<StacklessPreOrderHeapIter<'a, IteratorUMP>>;
|
||||
|
||||
#[cfg(test)]
|
||||
#[inline]
|
||||
pub(crate) fn stackless_post_order_iter<'a>(
|
||||
heap: &'a mut Heap,
|
||||
start: usize,
|
||||
) -> RightistPostOrderHeapIter<'a> {
|
||||
PostOrderIterator::new(stackless_preorder_iter(heap, start))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::machine::mock_wam::*;
|
||||
use crate::machine::gc::{IteratorUMP};
|
||||
|
||||
pub(crate) type RightistPostOrderHeapIter<'a> =
|
||||
PostOrderIterator<StacklessPreOrderHeapIter<'a, IteratorUMP>>;
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn stackless_preorder_iter(
|
||||
heap: &mut Vec<HeapCellValue>,
|
||||
start: usize,
|
||||
) -> StacklessPreOrderHeapIter<IteratorUMP> {
|
||||
StacklessPreOrderHeapIter::<IteratorUMP>::new(heap, start)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn stackless_post_order_iter<'a>(
|
||||
heap: &'a mut Heap,
|
||||
start: usize,
|
||||
) -> RightistPostOrderHeapIter<'a> {
|
||||
PostOrderIterator::new(stackless_preorder_iter(heap, start))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn heap_stackless_iter_tests() {
|
||||
@@ -1267,6 +1262,10 @@ mod tests {
|
||||
unmark_cell_bits!(iter.next().unwrap()),
|
||||
list_loc_as_cell!(1)
|
||||
);
|
||||
assert_eq!(
|
||||
unmark_cell_bits!(iter.next().unwrap()),
|
||||
list_loc_as_cell!(1)
|
||||
);
|
||||
|
||||
assert_eq!(iter.next(), None);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user