summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-08-21 21:06:56 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:43 +0400
commite1c47cb7d70756e93a1f43b7ac9593d4425f8e9a (patch)
tree188bd2eb66222657718f686bbb573cd4bc184f21 /headers.c
parente31af3519672189fafcdc9ee4d72a453fab83d4e (diff)
downloadbdwgc-e1c47cb7d70756e93a1f43b7ac9593d4425f8e9a.tar.gz
2008-08-21 Hans Boehm <Hans.Boehm@hp.com>
* mark.c: (GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Never invoke GC_push_marked on free hblk. * headers.c: Test COUNT_HDR_CACHE_HITS not USE_HDR_CACHE. (GC_header_cache_miss): Always blacklist pointers for free hblks. Add assertion and comment. * pthread_support.c (GC_register_my_thread): Fix #if indentation. * include/private/gc_hdrs.h: USE_HDR_CACHE is no longer tested. Delete it. * include/private/gc_pmark.h: (PUSH_OBJ): Add assertion. 2008-08-21 Hans Boehm <Hans.Boehm@hp.com> * alloc.c, include/gc_mark.h, Makefile.direct: Improve comments.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/headers.c b/headers.c
index 9735d4b0..774cf8d4 100644
--- a/headers.c
+++ b/headers.c
@@ -50,6 +50,7 @@ hdr * GC_find_header(ptr_t h)
/* GUARANTEED to return 0 for a pointer past the first page */
/* of an object unless both GC_all_interior_pointers is set */
/* and p is in fact a valid object pointer. */
+/* Never returns a pointer to a free hblk. */
#ifdef PRINT_BLACK_LIST
hdr * GC_header_cache_miss(ptr_t p, hdr_cache_entry *hce, ptr_t source)
#else
@@ -70,17 +71,19 @@ hdr * GC_find_header(ptr_t h)
hhdr = HDR(current);
} while(IS_FORWARDING_ADDR_OR_NIL(hhdr));
/* current points to near the start of the large object */
- if (hhdr -> hb_flags & IGNORE_OFF_PAGE
- || HBLK_IS_FREE(hhdr))
+ if (hhdr -> hb_flags & IGNORE_OFF_PAGE)
return 0;
- if (p - current >= (ptrdiff_t)(hhdr->hb_sz)) {
+ if (HBLK_IS_FREE(hhdr)
+ || p - current >= (ptrdiff_t)(hhdr->hb_sz)) {
GC_ADD_TO_BLACK_LIST_NORMAL(p, source);
/* Pointer past the end of the block */
return 0;
}
} else {
GC_ADD_TO_BLACK_LIST_NORMAL(p, source);
+ /* And return zero: */
}
+ GC_ASSERT(hhdr == 0 || !HBLK_IS_FREE(hhdr));
return hhdr;
/* Pointers past the first page are probably too rare */
/* to add them to the cache. We don't. */
@@ -181,7 +184,7 @@ static void free_hdr(hdr * hhdr)
hdr_free_list = hhdr;
}
-#ifdef USE_HDR_CACHE
+#ifdef COUNT_HDR_CACHE_HITS
word GC_hdr_cache_hits = 0;
word GC_hdr_cache_misses = 0;
#endif