summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-01-26 09:13:48 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-01-26 18:07:23 +0400
commit94ef2ff7ffb6afc8fad3248bd22e81bb43283676 (patch)
tree0f32641055bd6882d929451031c2505328b8887d /mark_rts.c
parent3210b488b43e7d433c3ce4508005cfb41f97e43f (diff)
downloadbdwgc-94ef2ff7ffb6afc8fad3248bd22e81bb43283676.tar.gz
Add debug logging on data roots addition or removal (enabled by
DEBUG_ADD_DEL_ROOTS new macro) * mark_rts.c (GC_add_roots_inner): Debug logging at adding new entry to GC_static_roots (only if DEBUG_ADD_DEL_ROOTS). * mark_rts.c (GC_clear_roots, GC_remove_root_at_pos): Add debug logging (only if DEBUG_ADD_DEL_ROOTS).
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mark_rts.c b/mark_rts.c
index 58f31df2..e95067ef 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -229,6 +229,11 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
if (n_root_sets == MAX_ROOT_SETS) {
ABORT("Too many root sets");
}
+
+# ifdef DEBUG_ADD_DEL_ROOTS
+ GC_log_printf("Adding data root section %d: %p .. %p\n",
+ n_root_sets, b, e);
+# endif
GC_static_roots[n_root_sets].r_start = (ptr_t)b;
GC_static_roots[n_root_sets].r_end = (ptr_t)e;
GC_static_roots[n_root_sets].r_tmp = tmp;
@@ -254,12 +259,19 @@ GC_API void GC_CALL GC_clear_roots(void)
# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
BZERO(GC_root_index, RT_SIZE * sizeof(void *));
# endif
+# ifdef DEBUG_ADD_DEL_ROOTS
+ GC_log_printf("Clear all data root sections\n");
+# endif
UNLOCK();
}
/* Internal use only; lock held. */
STATIC void GC_remove_root_at_pos(int i)
{
+# ifdef DEBUG_ADD_DEL_ROOTS
+ GC_log_printf("Remove data root section %d: %p .. %p\n",
+ i, GC_static_roots[i].r_start, GC_static_roots[i].r_end);
+# endif
GC_root_size -= (GC_static_roots[i].r_end - GC_static_roots[i].r_start);
GC_static_roots[i].r_start = GC_static_roots[n_root_sets-1].r_start;
GC_static_roots[i].r_end = GC_static_roots[n_root_sets-1].r_end;