inline static void clean_up_account_hooks(NewGC *gc) { AccountHook *work = gc->hooks; AccountHook *prev = NULL; while(work) { if((!work->c1 || marked(gc, work->c1)) && marked(gc, work->c2)) { work->c1 = GC_resolve(work->c1); work->c2 = GC_resolve(work->c2); prev = work; work = work->next; } else { /* remove work hook */ AccountHook *next = work->next; if(prev) prev->next = next; if(!prev) gc->hooks = next; free(work); work = next; } } }
static void FIXUP_jmpup(Scheme_Jumpup_Buf *buf, struct NewGC *gc) { void *new_stack; new_stack = GC_resolve(buf->stack_copy); gcFIXUP2_TYPED_NOW(void *, buf->stack_copy, gc); gcFIXUP2(buf->cont, gc); gcFIXUP2(buf->external_stack, gc); if (buf->stack_copy) GC_fixup2_variable_stack(buf->gc_var_stack, (intptr_t)new_stack - (intptr_t)buf->stack_from, /* FIXME: stack direction */ (char *)new_stack + buf->stack_size, new_stack, gc); }
static void zero_weak_boxes() { GC_Weak_Box *wb; wb = weak_boxes; while (wb) { if (!is_marked(wb->val)) { wb->val = NULL; if (wb->secondary_erase) { void **p; p = (void **)GC_resolve(wb->secondary_erase); *(p + wb->soffset) = NULL; wb->secondary_erase = NULL; } } wb = wb->next; } }
inline static void clean_up_thread_list(NewGC *gc) { GC_Thread_Info *work = gc->thread_infos; GC_Thread_Info *prev = NULL; while(work) { if(!pagemap_find_page(gc->page_maps, work->thread) || marked(gc, work->thread)) { work->thread = GC_resolve(work->thread); prev = work; work = work->next; } else { GC_Thread_Info *next = work->next; if(prev) prev->next = next; if(!prev) gc->thread_infos = next; free(work); work = next; } } }
inline static void clean_up_owner_table(NewGC *gc) { OTEntry **owner_table = gc->owner_table; const int table_size = gc->owner_table_size; int i; for(i = 1; i < table_size; i++) if(owner_table[i]) { /* repair or delete the originator */ if(!marked(gc, owner_table[i]->originator)) { owner_table[i]->originator = NULL; } else owner_table[i]->originator = GC_resolve(owner_table[i]->originator); /* potential delete */ if(i != 1) if((owner_table[i]->memory_use == 0) && !owner_table[i]->originator) free_owner_set(gc, i); } }