diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-01-07 01:29:56 -0800 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-01-07 01:29:56 -0800 |
| commit | bcabae43a4e327418c9297f5b63f64f41e9befbd (patch) | |
| tree | 0061d908e3ae55879dfbeec118c0d30b0405c515 | |
| parent | 52d654b9963ae02d63d226b94f80cd1248cb28ec (diff) | |
| parent | 542eda83abda4bcbc6ac7fa28a5ed8ae28ccb9bb (diff) | |
| download | mruby-bcabae43a4e327418c9297f5b63f64f41e9befbd.tar.gz mruby-bcabae43a4e327418c9297f5b63f64f41e9befbd.zip | |
Merge pull request #703 from authorNari/skip_sweeping_old
Skip sweeping old slots which don't contain any young object in the minor GC
| -rw-r--r-- | src/gc.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -208,6 +208,7 @@ struct heap_page { struct heap_page *next; struct heap_page *free_next; struct heap_page *free_prev; + unsigned int old:1; RVALUE objects[MRB_HEAP_PAGE_SIZE]; }; @@ -764,6 +765,11 @@ incremental_sweep_phase(mrb_state *mrb, size_t limit) int dead_slot = 1; int full = (page->freelist == NULL); + if (is_minor_gc(mrb) && page->old) { + /* skip a slot which doesn't contain any young object */ + p = e; + dead_slot = 0; + } while (p<e) { if (is_dead(mrb, &p->as.basic)) { if (p->as.basic.tt != MRB_TT_FREE) { @@ -794,6 +800,10 @@ incremental_sweep_phase(mrb_state *mrb, size_t limit) if (full && freed > 0) { link_free_heap_page(mrb, page); } + if (page->freelist == NULL && is_minor_gc(mrb)) + page->old = TRUE; + else + page->old = FALSE; page = page->next; } tried_sweep += MRB_HEAP_PAGE_SIZE; |
