Feature #17002 ยป 0001-Expand-heap-pages-to-be-exactly-16kb.patch
| gc.c | ||
|---|---|---|
|
enum {
|
||
|
HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG),
|
||
|
HEAP_PAGE_ALIGN_MASK = (~(~0UL << HEAP_PAGE_ALIGN_LOG)),
|
||
|
REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5),
|
||
|
HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC),
|
||
|
HEAP_PAGE_SIZE = HEAP_PAGE_ALIGN,
|
||
|
HEAP_PAGE_OBJ_LIMIT = (unsigned int)((HEAP_PAGE_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)),
|
||
|
HEAP_PAGE_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_PAGE_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH),
|
||
|
HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT),
|
||
| ... | ... | |
|
{
|
||
|
int i;
|
||
|
int empty_slots = 0, freed_slots = 0, final_slots = 0;
|
||
|
RVALUE *p, *pend,*offset;
|
||
|
RVALUE *p, *offset;
|
||
|
bits_t *bits, bitset;
|
||
|
gc_report(2, objspace, "page_sweep: start.\n");
|
||
|
sweep_page->flags.before_sweep = FALSE;
|
||
|
p = sweep_page->start; pend = p + sweep_page->total_slots;
|
||
|
p = sweep_page->start;
|
||
|
offset = p - NUM_IN_PAGE(p);
|
||
|
bits = sweep_page->mark_bits;
|
||
|
/* create guard : fill 1 out-of-range */
|
||
|
bits[BITMAP_INDEX(p)] |= BITMAP_BIT(p)-1;
|
||
|
bits[BITMAP_INDEX(pend)] |= ~(BITMAP_BIT(pend) - 1);
|
||
|
bits[BITMAP_INDEX(p) + sweep_page->total_slots / BITS_BITLENGTH] |= ~((1 << ((NUM_IN_PAGE(p) + sweep_page->total_slots) % BITS_BITLENGTH)) - 1);
|
||
|
for (i=0; i < HEAP_PAGE_BITMAP_LIMIT; i++) {
|
||
|
bitset = ~bits[i];
|
||