* gc.c (gc_page_sweep): refactoring.

* gc.c (gc_page_sweep): should not set, but add final_slots into
  sweep_page->final_slots.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2014-06-05 07:14:53 +00:00
Родитель a4d7e42888
Коммит 72a77c25e5
2 изменённых файлов: 33 добавлений и 18 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Thu Jun 5 16:08:39 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (gc_page_sweep): refactoring.
* gc.c (gc_page_sweep): should not set, but add final_slots into
sweep_page->final_slots.
Thu Jun 5 14:36:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (jemalloc): check for the header regardless drop-in

18
gc.c
Просмотреть файл

@ -2810,8 +2810,9 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
if (bitset) {
p = offset + i * BITS_BITLENGTH;
do {
if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) {
if (p->as.basic.flags) {
if (bitset & 1) {
switch (BUILTIN_TYPE(p)) {
default: { /* majority case */
rgengc_report(3, objspace, "page_sweep: free %p (%s)\n", p, obj_type_name((VALUE)p));
#if USE_RGENGC && RGENGC_CHECK_MODE
if (objspace->rgengc.during_minor_gc && RVALUE_OLD_P((VALUE)p)) rb_bug("page_sweep: %p (%s) is old while minor GC.", p, obj_type_name((VALUE)p));
@ -2826,9 +2827,16 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
rgengc_report(3, objspace, "page_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p));
freed_slots++;
}
break;
}
else {
empty_slots++;
/* minor cases */
case T_ZOMBIE:
/* already counted */
break;
case T_NONE:
empty_slots++; /* already freed */
break;
}
}
p++;
@ -2864,7 +2872,7 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
heap_pages_swept_slots += freed_slots + empty_slots;
objspace->profile.total_freed_object_num += freed_slots;
heap_pages_final_slots += final_slots;
sweep_page->final_slots = final_slots;
sweep_page->final_slots += final_slots;
if (0) fprintf(stderr, "gc_page_sweep(%d): freed?: %d, limt: %d, freed_slots: %d, empty_slots: %d, final_slots: %d\n",
(int)rb_gc_count(),