summaryrefslogtreecommitdiff
path: root/allchblk.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-02-20 22:02:46 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:42 +0400
commitb381c0a0d59bb2cffde9a8a6f4919c5454ac9e84 (patch)
tree3d58d37234715598de9fe90bef03303b5fe6383f /allchblk.c
parentbd4938762e45fdf3210af6223b4d0280b3936d48 (diff)
downloadbdwgc-b381c0a0d59bb2cffde9a8a6f4919c5454ac9e84.tar.gz
2008-02-20 Hans Boehm <Hans.Boehm@hp.com>
* allchblk.c (add_to_fl): disable assertions with USE_MUNMAP, and refine assertions to handle huge unmergable blocks. (GC_allochblk_nth): Add comment.
Diffstat (limited to 'allchblk.c')
-rw-r--r--allchblk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/allchblk.c b/allchblk.c
index ed6a60b1..8d326e53 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -363,13 +363,16 @@ void GC_add_to_fl(struct hblk *h, hdr *hhdr)
int index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
struct hblk *second = GC_hblkfreelist[index];
hdr * second_hdr;
-# ifdef GC_ASSERTIONS
+# if defined(GC_ASSERTIONS) && !defined(USE_MUNMAP)
struct hblk *next = (struct hblk *)((word)h + hhdr -> hb_sz);
hdr * nexthdr = HDR(next);
struct hblk *prev = GC_free_block_ending_at(h);
hdr * prevhdr = HDR(prev);
- GC_ASSERT(nexthdr == 0 || !HBLK_IS_FREE(nexthdr) || !IS_MAPPED(nexthdr));
- GC_ASSERT(prev == 0 || !HBLK_IS_FREE(prevhdr) || !IS_MAPPED(prevhdr));
+ GC_ASSERT(nexthdr == 0 || !HBLK_IS_FREE(nexthdr)
+ || (signed_word)GC_heapsize < 0);
+ /* In the last case, blocks may be too large to merge. */
+ GC_ASSERT(prev == 0 || !HBLK_IS_FREE(prevhdr)
+ || (signed_word)GC_heapsize < 0);
# endif
GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0);
GC_hblkfreelist[index] = h;
@@ -765,6 +768,7 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, GC_bool may_split)
if (!IS_MAPPED(hhdr)) {
GC_remap((ptr_t)hbp, hhdr -> hb_sz);
hhdr -> hb_flags &= ~WAS_UNMAPPED;
+ /* Note: This may leave adjacent, mapped free blocks. */
}
# endif
/* hbp may be on the wrong freelist; the parameter n */