mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
a4d7e42888
commit
72a77c25e5
2 changed files with 33 additions and 18 deletions
|
@ -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>
|
Thu Jun 5 14:36:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (jemalloc): check for the header regardless drop-in
|
* configure.in (jemalloc): check for the header regardless drop-in
|
||||||
|
|
44
gc.c
44
gc.c
|
@ -2810,25 +2810,33 @@ gc_page_sweep(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *sweep_
|
||||||
if (bitset) {
|
if (bitset) {
|
||||||
p = offset + i * BITS_BITLENGTH;
|
p = offset + i * BITS_BITLENGTH;
|
||||||
do {
|
do {
|
||||||
if ((bitset & 1) && BUILTIN_TYPE(p) != T_ZOMBIE) {
|
if (bitset & 1) {
|
||||||
if (p->as.basic.flags) {
|
switch (BUILTIN_TYPE(p)) {
|
||||||
rgengc_report(3, objspace, "page_sweep: free %p (%s)\n", p, obj_type_name((VALUE)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 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));
|
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));
|
||||||
if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %p (%s) is remembered.", p, obj_type_name((VALUE)p));
|
if (rgengc_remembered(objspace, (VALUE)p)) rb_bug("page_sweep: %p (%s) is remembered.", p, obj_type_name((VALUE)p));
|
||||||
#endif
|
#endif
|
||||||
if (obj_free(objspace, (VALUE)p)) {
|
if (obj_free(objspace, (VALUE)p)) {
|
||||||
final_slots++;
|
final_slots++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
|
(void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
|
||||||
heap_page_add_freeobj(objspace, sweep_page, (VALUE)p);
|
heap_page_add_freeobj(objspace, sweep_page, (VALUE)p);
|
||||||
rgengc_report(3, objspace, "page_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p));
|
rgengc_report(3, objspace, "page_sweep: %p (%s) is added to freelist\n", p, obj_type_name((VALUE)p));
|
||||||
freed_slots++;
|
freed_slots++;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else {
|
}
|
||||||
empty_slots++;
|
|
||||||
|
/* minor cases */
|
||||||
|
case T_ZOMBIE:
|
||||||
|
/* already counted */
|
||||||
|
break;
|
||||||
|
case T_NONE:
|
||||||
|
empty_slots++; /* already freed */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p++;
|
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;
|
heap_pages_swept_slots += freed_slots + empty_slots;
|
||||||
objspace->profile.total_freed_object_num += freed_slots;
|
objspace->profile.total_freed_object_num += freed_slots;
|
||||||
heap_pages_final_slots += final_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",
|
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(),
|
(int)rb_gc_count(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue