mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (gc_page_sweep): return free slots count.
* gc.c (gc_sweep_step): use returned free slots count. * gc.c (gc_sweep_step): change variable name `next' to `next_sweep_page'. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7d5b9cd3f6
commit
f46b5bcfaf
2 changed files with 18 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
|||
Thu Mar 31 15:48:18 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c (gc_page_sweep): return free slots count.
|
||||
|
||||
* gc.c (gc_sweep_step): use returned free slots count.
|
||||
|
||||
* gc.c (gc_sweep_step): change variable name `next'
|
||||
to `next_sweep_page'.
|
||||
|
||||
Thu Mar 31 11:33:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/date/date_core.c (d_lite_strftime, dt_lite_strftime): [DOC]
|
||||
|
|
18
gc.c
18
gc.c
|
@ -3367,9 +3367,7 @@ gc_setup_mark_bits(struct heap_page *page)
|
|||
#endif
|
||||
}
|
||||
|
||||
/* TRUE : has empty slots */
|
||||
/* FALSE: no empty slots (or move to tomb heap because no live slots) */
|
||||
static inline void
|
||||
static inline int
|
||||
gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_page)
|
||||
{
|
||||
int i;
|
||||
|
@ -3458,6 +3456,8 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
|
|||
}
|
||||
|
||||
gc_report(2, objspace, "page_sweep: end.\n");
|
||||
|
||||
return freed_slots + empty_slots;
|
||||
}
|
||||
|
||||
/* allocate additional minimum page to work */
|
||||
|
@ -3577,7 +3577,7 @@ gc_sweep_finish(rb_objspace_t *objspace)
|
|||
static int
|
||||
gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||
{
|
||||
struct heap_page *sweep_page = heap->sweep_pages, *next;
|
||||
struct heap_page *sweep_page = heap->sweep_pages;
|
||||
int unlink_limit = 3;
|
||||
#if GC_ENABLE_INCREMENTAL_MARK
|
||||
int need_pool = will_be_incremental_marking(objspace) ? TRUE : FALSE;
|
||||
|
@ -3594,17 +3594,17 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
#endif
|
||||
|
||||
while (sweep_page) {
|
||||
heap->sweep_pages = next = sweep_page->next;
|
||||
gc_page_sweep(objspace, heap, sweep_page);
|
||||
struct heap_page *next_sweep_page = heap->sweep_pages = sweep_page->next;
|
||||
int free_slots = gc_page_sweep(objspace, heap, sweep_page);
|
||||
|
||||
if (sweep_page->final_slots + sweep_page->free_slots == sweep_page->total_slots &&
|
||||
if (sweep_page->final_slots + free_slots == sweep_page->total_slots &&
|
||||
unlink_limit > 0) {
|
||||
unlink_limit--;
|
||||
/* there are no living objects -> move this page to tomb heap */
|
||||
heap_unlink_page(objspace, heap, sweep_page);
|
||||
heap_add_page(objspace, heap_tomb, sweep_page);
|
||||
}
|
||||
else if (sweep_page->free_slots > 0) {
|
||||
else if (free_slots > 0) {
|
||||
#if GC_ENABLE_INCREMENTAL_MARK
|
||||
if (need_pool) {
|
||||
if (heap_add_poolpage(objspace, heap, sweep_page)) {
|
||||
|
@ -3624,7 +3624,7 @@ gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
|
|||
sweep_page->free_next = NULL;
|
||||
}
|
||||
|
||||
sweep_page = next;
|
||||
sweep_page = next_sweep_page;
|
||||
}
|
||||
|
||||
if (heap->sweep_pages == NULL) {
|
||||
|
|
Loading…
Reference in a new issue