X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=cacao.git;a=blobdiff_plain;f=src%2Fmm%2Fboehm-gc%2Fheaders.c;h=774cf8d43a061e2dd38e8963db523d95bee12704;hp=72b16e2b6e6d498782d8dbbfdc0b464b4107e5db;hb=c83bff94e40ee0a218a39931af17814d1a42cb5c;hpb=db5750e3eaf39a47dbccccfe7cdd180fb686aac6 diff --git a/src/mm/boehm-gc/headers.c b/src/mm/boehm-gc/headers.c index 72b16e2b6..774cf8d43 100644 --- a/src/mm/boehm-gc/headers.c +++ b/src/mm/boehm-gc/headers.c @@ -21,16 +21,14 @@ * Access speed is crucial. We implement an index structure based on a 2 * level tree. */ - -#include "config.h" # include "private/gc_priv.h" -bottom_index * GC_all_bottom_indices = 0; +STATIC bottom_index * GC_all_bottom_indices = 0; /* Pointer to first (lowest addr) */ /* bottom_index. */ -bottom_index * GC_all_bottom_indices_end = 0; +STATIC bottom_index * GC_all_bottom_indices_end = 0; /* Pointer to last (highest addr) */ /* bottom_index. */ @@ -52,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 @@ -72,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. */ @@ -183,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