increemntal GC: compact when a major GC is forced early

This change further defends against fragmentation when
incremental mode isn't working well.
This commit is contained in:
Matthew Flatt 2015-12-04 16:15:07 -05:00
parent b5131321d7
commit e44926fcee
2 changed files with 6 additions and 3 deletions

View File

@ -4833,7 +4833,7 @@ inline static void do_heap_compact(NewGC *gc)
int tic_tock = gc->num_major_collects % 2;
/* incremental mode disables old-generation compaction: */
if (gc->started_incremental)
if (gc->started_incremental && !gc->compact_even_incremental)
return;
mmu_prep_for_compaction(gc->mmu);
@ -5975,8 +5975,10 @@ static void garbage_collect(NewGC *gc, int force_full, int no_full, int switchin
if (gc->full_needed_for_finalization && gc->gc_full)
gc->full_needed_for_finalization= 0;
if (gc->gc_full)
if (gc->gc_full) {
gc->compact_even_incremental = !gc->finishing_incremental;
gc->finishing_incremental = 0;
}
#ifdef GC_DEBUG_PAGES
if (gc->gc_full == 1) {

View File

@ -219,6 +219,7 @@ typedef struct NewGC {
unsigned char during_backpointer :1;
unsigned char incremental_requested :1;
unsigned char high_fragmentation :1;
unsigned char compact_even_incremental :1;
/* blame the child */
unsigned int doing_memory_accounting :1;