static void page_range_add(Page_Range *pr, void *_start, unsigned long len, int writeable) { GC_MP_CNT_INC(mp_pr_add_cnt); if (!page_range_add_worker(pr, _start, len)) { GC_MP_CNT_INC(mp_pr_ff_cnt); page_range_flush(pr, writeable); page_range_add_worker(pr, _start, len); } }
static void zero_weak_boxes(GCTYPE *gc, int is_late, int force_zero) { GC_Weak_Box *wb; wb = gc->weak_boxes[is_late]; while (wb) { if (force_zero || !is_marked(gc, wb->val)) { wb->val = NULL; if (wb->secondary_erase) { void **p; mpage *page; /* it's possible for the secondary to be in an old generation and therefore on an mprotected page: */ page = pagemap_find_page(gc->page_maps, wb->secondary_erase); if (page->mprotected) { page->mprotected = 0; mmu_write_unprotect_page(gc->mmu, page->addr, APAGE_SIZE); GC_MP_CNT_INC(mp_mark_cnt); } p = (void **)GC_resolve2(wb->secondary_erase, gc); *(p + wb->soffset) = NULL; wb->secondary_erase = NULL; } } wb = wb->next; } /* reset, in case we have a second round */ gc->weak_boxes[is_late] = NULL; }
static void page_range_flush(Page_Range *pr, int writeable) { Range *work; page_range_compact(pr); for (work = pr->range_start; work; work = work->next) { os_protect_pages((void *)work->start, work->len, writeable); GC_MP_CNT_INC(mp_pr_call_cnt); } page_range_reset(pr); }