* debug_counter.h: new debug counters obj_promote, obj_wb_unprotect
  and obj_struct_(ptr|embed) are added.

* gc.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2018-09-26 07:28:04 +00:00
Родитель bc2d493e0d
Коммит ee819b0ddb
2 изменённых файлов: 14 добавлений и 0 удалений

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

@ -81,6 +81,8 @@ RB_DEBUG_COUNTER(lvar_set_slowpath)
* * obj_newobj_slowpath: newobj with slowpath counts
* * obj_newobj_wb_unprotected: newobj for wb_unprotecte.
* * obj_free: obj_free() counts
* * obj_promote: promoted counts (oldgen)
* * obj_wb_unprotect: wb unprotect counts
*
* * obj_[type]_[attr]: free'ed counts for each type.
* * [type]
@ -88,6 +90,7 @@ RB_DEBUG_COUNTER(lvar_set_slowpath)
* * _str: T_STRING
* * _ary: T_ARRAY
* * _hash: T_HASH
* * _struct: T_STRUCT
*
* * [attr]
* * _ptr: R?? is not embed.
@ -105,6 +108,8 @@ RB_DEBUG_COUNTER(obj_newobj)
RB_DEBUG_COUNTER(obj_newobj_slowpath)
RB_DEBUG_COUNTER(obj_newobj_wb_unprotected)
RB_DEBUG_COUNTER(obj_free)
RB_DEBUG_COUNTER(obj_promote)
RB_DEBUG_COUNTER(obj_wb_unprotect)
RB_DEBUG_COUNTER(obj_obj_ptr)
RB_DEBUG_COUNTER(obj_obj_embed)
@ -123,6 +128,9 @@ RB_DEBUG_COUNTER(obj_hash_under4)
RB_DEBUG_COUNTER(obj_hash_ge4)
RB_DEBUG_COUNTER(obj_hash_ge8)
RB_DEBUG_COUNTER(obj_struct_ptr)
RB_DEBUG_COUNTER(obj_struct_embed)
/* heap function counts
*
* * heap_xmalloc/realloc/xfree: call counts

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

@ -1200,6 +1200,7 @@ RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, struct heap_page *pag
static inline void
RVALUE_OLD_UNCOLLECTIBLE_SET(rb_objspace_t *objspace, VALUE obj)
{
RB_DEBUG_COUNTER_INC(obj_promote);
RVALUE_PAGE_OLD_UNCOLLECTIBLE_SET(objspace, GET_HEAP_PAGE(obj), obj);
}
@ -2366,7 +2367,11 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 &&
RANY(obj)->as.rstruct.as.heap.ptr) {
xfree((void *)RANY(obj)->as.rstruct.as.heap.ptr);
RB_DEBUG_COUNTER_INC(obj_struct_ptr);
}
else {
RB_DEBUG_COUNTER_INC(obj_struct_embed);
}
break;
case T_SYMBOL:
@ -6053,6 +6058,7 @@ rb_gc_writebarrier_unprotect(VALUE obj)
RVALUE_AGE_RESET(obj);
}
RB_DEBUG_COUNTER_INC(obj_wb_unprotect);
MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
}
}