summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-04-20 09:12:47 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-04-20 19:18:42 +0400
commite67ab084068f6fc192b3d7505565f7d825cb82da (patch)
tree1b0df11c6d51e4dcb3715466a3af3e4351b3898e /alloc.c
parent490bf2992e2d2a0b115bb53f15aaab592f02ef8b (diff)
downloadbdwgc-e67ab084068f6fc192b3d7505565f7d825cb82da.tar.gz
Code refactoring of GC_check_tls_for/GC_check_fl_marks
* alloc.c (GC_check_fl_marks): Change prototype (pass pointer to "freelist" element instead of value); do not define the function if THREAD_LOCAL_ALLOC undefined. * include/private/gc_priv.h (GC_check_fl_marks): Likewise. * alloc.c (GC_check_fl_marks): Skip check if the argument points to a special (non-pointer) value; update comment; rename "q" local variable to "list". * thread_local_alloc.c (GC_check_tls_for): Update code according to GC_check_fl_marks functionality change (remove checks for special value).
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/alloc.c b/alloc.c
index ac019079..1d365f4d 100644
--- a/alloc.c
+++ b/alloc.c
@@ -729,20 +729,24 @@ GC_INNER void GC_set_fl_marks(ptr_t q)
}
}
-#ifdef GC_ASSERTIONS
- /* Check that all mark bits for the free list whose first entry is q */
- /* are set. */
- void GC_check_fl_marks(ptr_t q)
+#if defined(GC_ASSERTIONS) && defined(THREADS) && defined(THREAD_LOCAL_ALLOC)
+ /* Check that all mark bits for the free list whose first entry is */
+ /* (*pfreelist) are set. Check skipped if points to a special value. */
+ void GC_check_fl_marks(void **pfreelist)
{
- ptr_t p;
- for (p = q; p != 0; p = obj_link(p)) {
+ ptr_t list = *pfreelist;
+ ptr_t p;
+
+ if ((word)list <= HBLKSIZE) return;
+
+ for (p = list; p != 0; p = obj_link(p)) {
if (!GC_is_marked(p)) {
- GC_err_printf("Unmarked object %p on list %p\n", p, q);
+ GC_err_printf("Unmarked object %p on list %p\n", p, list);
ABORT("Unmarked local free list entry");
}
- }
+ }
}
-#endif
+#endif /* GC_ASSERTIONS && THREAD_LOCAL_ALLOC */
/* Clear all mark bits for the free list whose first entry is q */
/* Decrement GC_bytes_found by number of bytes on free list. */