fn evac_roots(&mut self, type_info: &GcTypeInfo, arenas: &mut Arenas, free: &mut FreeList) {
        log::trace!("evac_roots: {}", type_info.type_name);
        let Collection {
            handler, condemned, ..
        } = self;

        fn er(
            header: *const HeaderUnTyped,
            type_info: &GcTypeInfo,
            handler: &mut HandlerManager,
            arenas: &mut Arenas,
            free: &mut FreeList,
        ) {
            let Arenas { full, partial, .. } = arenas;
            log::trace!("header: {:?}", header);
            let mut roots = unsafe { &*header }
                .roots
                .lock()
                .expect("Could not unlock roots, in TypeState::step");

            roots.drain().for_each(|(idx, root_ptr)| {
                let GcTypeInfo { align, size, .. } = *type_info;
                let high =
                    header as *const _ as usize + HeaderUnTyped::high_offset(align, size) as usize;
                let gc = (high - ((idx as usize) * size as usize)) as *const u8;
                let HandlerManager {
                    invariant,
                    handlers,
                    evacuate_fn,
                    ..
                } = handler;
                evacuate_fn(gc, 0, invariant.grey_fields, invariant, handlers);

                let root = unsafe { &mut *(root_ptr as *mut RootIntern<u8>) };
                if root.ref_count.load(Ordering::Relaxed) == 0 {
                    unsafe { ptr::drop_in_place(root) }
                } else {
                    let (next, top) = partial.remove_arena(type_info, free);

                    unsafe { ptr::copy(gc, next as _, 1) }

                    let to_header =
                        unsafe { &mut *(HeaderUnTyped::from(next) as *mut HeaderUnTyped) };
                    let mut roots = to_header.roots.lock().unwrap();

                    if !roots.insert(index(next, size, align), root_ptr).is_none() {
                        panic!("Not possible");
                    };

                    let ptr = bump_down(next, size, align);

                    if arena::full(ptr, align) {
                        full.insert(header, top);
                    } else {
                        log::trace!(
                            "Evacuated root to Arena {{header: {:?}, next: {:?}}}",
                            to_header as *const _,
                            next
                        );
                        partial.0.insert(header, (ptr, top));
                    }
                };
            });
            assert_eq!(0, roots.len());
        };

        condemned
            .partial
            .0
            .keys()
            .cloned()
            .for_each(|header| er(header, type_info, handler, arenas, free));

        log::trace!("evaced root's in partial: {:?}", condemned.partial.0);

        condemned
            .full
            .keys()
            .cloned()
            .map(|h| h as *const _)
            .for_each(|header| er(header, type_info, handler, arenas, free));

        log::trace!("evaced root's in full: {:?}", condemned.full);

        condemned
            .worker
            .keys()
            .cloned()
            .for_each(|header| er(header, type_info, handler, arenas, free));
        log::trace!("evaced root's in worker: {:?}", condemned.worker);
    }
/// Evacuate rooted objects from condemned `Arenas`.
Evacuate rooted objects from condemned `Arenas`.
Evacuate rooted objects from condemned ` Arenas ` .
fn evac_roots(&mut self, type_info: &GcTypeInfo, arenas: &mut Arenas, free: &mut FreeList) {
        log::trace!("evac_roots: {}", type_info.type_name);
        let Collection {
            handler, condemned, ..
        } = self;
        fn er(
            header: *const HeaderUnTyped,
            type_info: &GcTypeInfo,
            handler: &mut HandlerManager,
            arenas: &mut Arenas,
            free: &mut FreeList,
        ) {
            let Arenas { full, partial, .. } = arenas;
            log::trace!("header: {:?}", header);
            let mut roots = unsafe { &*header }
                .roots
                .lock()
                .expect("Could not unlock roots, in TypeState::step");
            roots.drain().for_each(|(idx, root_ptr)| {
                let GcTypeInfo { align, size, .. } = *type_info;
                let high =
                    header as *const _ as usize + HeaderUnTyped::high_offset(align, size) as usize;
                let gc = (high - ((idx as usize) * size as usize)) as *const u8;
                let HandlerManager {
                    invariant,
                    handlers,
                    evacuate_fn,
                    ..
                } = handler;
                evacuate_fn(gc, 0, invariant.grey_fields, invariant, handlers);
                let root = unsafe { &mut *(root_ptr as *mut RootIntern<u8>) };
                if root.ref_count.load(Ordering::Relaxed) == 0 {
                    unsafe { ptr::drop_in_place(root) }
                } else {
                    let (next, top) = partial.remove_arena(type_info, free);
                    unsafe { ptr::copy(gc, next as _, 1) }
                    let to_header =
                        unsafe { &mut *(HeaderUnTyped::from(next) as *mut HeaderUnTyped) };
                    let mut roots = to_header.roots.lock().unwrap();
                    if !roots.insert(index(next, size, align), root_ptr).is_none() {
                        panic!("Not possible");
                    };
                    let ptr = bump_down(next, size, align);
                    if arena::full(ptr, align) {
                        full.insert(header, top);
                    } else {
                        log::trace!(
                            "Evacuated root to Arena {{header: {:?}, next: {:?}}}",
                            to_header as *const _,
                            next
                        );
                        partial.0.insert(header, (ptr, top));
                    }
                };
            });
            assert_eq!(0, roots.len());
        };
        condemned
            .partial
            .0
            .keys()
            .cloned()
            .for_each(|header| er(header, type_info, handler, arenas, free));
        log::trace!("evaced root's in partial: {:?}", condemned.partial.0);
        condemned
            .full
            .keys()
            .cloned()
            .map(|h| h as *const _)
            .for_each(|header| er(header, type_info, handler, arenas, free));
        log::trace!("evaced root's in full: {:?}", condemned.full);
        condemned
            .worker
            .keys()
            .cloned()
            .for_each(|header| er(header, type_info, handler, arenas, free));
        log::trace!("evaced root's in worker: {:?}", condemned.worker);
    }
fn evac_roots ( & mut self , type_info : & GcTypeInfo , arenas : & mut Arenas , free : & mut FreeList ) { log :: trace ! ( " " type_info type_name ) ; let Collection { handler , condemned , .. } = self ; fn er ( header : * const HeaderUnTyped , type_info : & GcTypeInfo , handler : & mut HandlerManager , arenas : & mut Arenas , free : & mut FreeList , ) { let Arenas { full , partial , .. } = arenas ; log :: trace ! ( " " header ) ; let mut roots = unsafe { & * header } . roots . lock ( ) . expect ( " " ) ; roots . drain ( ) . for_each ( | ( idx , root_ptr ) | { let GcTypeInfo { align , size , .. } = * type_info ; let high = header as * const _ as usize + HeaderUnTyped :: high_offset ( align , size ) as usize ; let gc = ( high - ( ( idx as usize ) * size as usize ) ) as * const u8 ; let HandlerManager { invariant , handlers , evacuate_fn , .. } = handler ; evacuate_fn ( gc , 0 , invariant . grey_fields , invariant , handlers ) ; let root = unsafe { & mut * ( root_ptr as * mut RootIntern < u8 > ) } ; if root . ref_count . load ( Ordering :: Relaxed ) == 0 { unsafe { ptr :: drop_in_place ( root ) } } else { let ( next , top ) = partial . remove_arena ( type_info , free ) ; unsafe { ptr :: copy ( gc , next as _ , 1 ) } let to_header = unsafe { & mut * ( HeaderUnTyped :: from ( next ) as * mut HeaderUnTyped ) } ; let mut roots = to_header . roots . lock ( ) . unwrap ( ) ; if ! roots . insert ( index ( next , size , align ) , root_ptr ) . is_none ( ) { panic ! ( " " ) ; } ; let ptr = bump_down ( next , size , align ) ; if arena :: full ( ptr , align ) { full . insert ( header , top ) ; } else { log :: trace ! ( " " to_header as const next ) ; partial . 0 . insert ( header , ( ptr , top ) ) ; } } ; } ) ; assert_eq ! ( 0 roots len ( ) ) ; } ; condemned . partial . 0 . keys ( ) . cloned ( ) . for_each ( | header | er ( header , type_info , handler , arenas , free ) ) ; log :: trace ! ( " " condemned partial 0 ) ; condemned . full . keys ( ) . cloned ( ) . map ( | h | h as * const _ ) . for_each ( | header | er ( header , type_info , handler , arenas , free ) ) ; log :: trace ! ( " " condemned full ) ; condemned . worker . keys ( ) . cloned ( ) . for_each ( | header | er ( header , type_info , handler , arenas , free ) ) ; log :: trace ! ( " " condemned worker ) ; }
Evacuate rooted objects from condemned `Arenas`.
Evacuate rooted objects from condemned ` Arenas ` .
&mut self
type_info
&GcTypeInfo
arenas
&mut Arenas
free
&mut FreeList
&mut self
type_info
&GcTypeInfo
arenas
&mut Arenas
free
&mut FreeList