summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-05-07 14:06:25 +0900
committerKoichi Sasada <ko1@atdot.net>2019-05-07 14:10:43 +0900
commit4dc5d3c5dd43b4cc54517e604c16ecfc808e5481 (patch)
tree1df2d0be74238f4b6e411282577d8d732d428747 /gc.c
parent7e72ce0f734113e3e215a74b440092443e957d45 (diff)
add new debug_counters about is_pointer_to_heap().
is_pointer_to_heap() is used for conservative marking. To analyze this function's behavior, introduce some debug_counters.
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index cf3bb3fac2..5bd0cf75b6 100644
--- a/gc.c
+++ b/gc.c
@@ -2191,8 +2191,13 @@ is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
register struct heap_page *page;
register size_t hi, lo, mid;
+ RB_DEBUG_COUNTER_INC(gc_isptr_trial);
+
if (p < heap_pages_lomem || p > heap_pages_himem) return FALSE;
+ RB_DEBUG_COUNTER_INC(gc_isptr_range);
+
if ((VALUE)p % sizeof(RVALUE) != 0) return FALSE;
+ RB_DEBUG_COUNTER_INC(gc_isptr_align);
/* check if p looks like a pointer using bsearch*/
lo = 0;
@@ -2202,6 +2207,7 @@ is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
page = heap_pages_sorted[mid];
if (page->start <= p) {
if (p < page->start + page->total_slots) {
+ RB_DEBUG_COUNTER_INC(gc_isptr_maybe);
return TRUE;
}
lo = mid + 1;