From ecca88e85c0f8bafea9be8c03cee793657168baf Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Wed, 24 Apr 2013 13:13:50 -0400 Subject: [PATCH] gencgc: Compute bytes_allocated correctly during dynamic space pickup. * Rather than computing bytes_allocated based on the number of pages prior to the "alloc pointer" (really the heap high-water mark), accumulate it based on the number of ALLOCATED pages. * Fixes some lossage in write_generation_stats(), which seems to be the only place where this value is checked against reality. --- src/runtime/gencgc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index f4ffd2f..ec21162 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -4130,6 +4130,9 @@ gencgc_pickup_dynamic(void) void *alloc_ptr = (void *)get_alloc_pointer(); lispobj *prev=(lispobj *)page_address(page); generation_index_t gen = PSEUDO_STATIC_GENERATION; + + bytes_allocated = 0; + do { lispobj *first,*ptr= (lispobj *)page_address(page); @@ -4143,6 +4146,8 @@ gencgc_pickup_dynamic(void) page_table[page].write_protected_cleared = 0; page_table[page].dont_move = 0; page_table[page].need_to_zero = 1; + + bytes_allocated += GENCGC_CARD_BYTES; } if (!gencgc_partial_pickup) { @@ -4158,8 +4163,7 @@ gencgc_pickup_dynamic(void) last_free_page = page; - generations[gen].bytes_allocated = npage_bytes(page); - bytes_allocated = npage_bytes(page); + generations[gen].bytes_allocated = bytes_allocated; gc_alloc_update_all_page_tables(); write_protect_generation_pages(gen); -- 1.7.10.4