Fix liblumen_alloc gc tests
Fixes
Explicitly wrap roots in a RootSet since Rust won't convert an array to
a slice to allow the `From` impl to work.
@@ -5,6 +5,7 @@ use core::ops::Deref;
use core::ptr::NonNull;
use crate::erts::process::alloc::TermAlloc;
+use crate::erts::process::gc::RootSet;
use crate::erts::process::test::process;
use crate::erts::term::closure::*;
use crate::erts::term::prelude::*;
@@ -146,14 +147,16 @@ fn simple_gc_test(process: Process) {
// Run garbage collection
let mut roots = [tuple_term, list_term, closure_term];
- process.garbage_collect(0, &mut roots).unwrap();
+ let root_set = RootSet::new(&mut roots);
+ process.garbage_collect(0, root_set).unwrap();
process.set_flags(ProcessFlags::NeedFullSweep);
// Grab post-collection size
let collected_size_first = process.young_heap_used();
//dbg!(process.acquire_heap().heap().young_generation());
// Run it again and make sure the heap size stays the same
- process.garbage_collect(0, &mut roots).unwrap();
+ let root_set = RootSet::new(&mut roots);
+ process.garbage_collect(0, root_set).unwrap();
let collected_size_second = process.young_heap_used();
assert_eq!(collected_size_first, collected_size_second);
@@ -297,7 +300,8 @@ fn tenuring_gc_test(process: Process, _perform_fullsweep: bool) {
let peak_size = process.young_heap_used();
// Run first garbage collection
let mut roots = [];
- process.garbage_collect(0, &mut roots).unwrap();
+ let root_set = RootSet::new(&mut roots);
+ process.garbage_collect(0, root_set).unwrap();
// Verify size of garbage collected meets expectation
let collected_size = process.young_heap_used();
@@ -386,7 +390,8 @@ fn tenuring_gc_test(process: Process, _perform_fullsweep: bool) {
// allocated
let second_peak_size = process.young_heap_used();
let mut roots = [];
- process.garbage_collect(0, &mut roots).unwrap();
+ let root_set = RootSet::new(&mut roots);
+ process.garbage_collect(0, root_set).unwrap();
// Verify no garbage was collected, we should have just tenured some data,
// the only data on the young heap should be a single cons cell
