Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/bdwgc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-08-19 18:46:59 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-08-19 18:46:59 +0300
commitf5e3318adf3c8e31fb1dd314a323281c5fa3c3f2 (patch)
tree954a85f79f3a581e114b12ab77053267ec2ad878 /alloc.c
parentf6e3d2ae6a02ae0659942386fe048f4156f844a5 (diff)
Add assertion that no hb_n_marks underflow occurs
Issue #177 (bdwgc). * alloc.c (GC_clear_fl_marks): Add GC_ASSERT that hhdr->hb_n_marks is non-zero before decrementing it. * mark.c (GC_clear_mark_bit): Likewise.
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/alloc.c b/alloc.c
index b038940e..c492f015 100644
--- a/alloc.c
+++ b/alloc.c
@@ -393,7 +393,7 @@ STATIC void GC_maybe_gc(void)
}
/* We try to mark with the world stopped. */
/* If we run out of time, this turns into */
- /* incremental marking. */
+ /* incremental marking. */
# ifndef NO_CLOCK
if (GC_time_limit != GC_TIME_UNLIMITED) { GET_TIME(GC_start_time); }
# endif
@@ -855,8 +855,11 @@ STATIC void GC_clear_fl_marks(ptr_t q)
unsigned bit_no = MARK_BIT_NO((ptr_t)q - (ptr_t)h, sz);
if (mark_bit_from_hdr(hhdr, bit_no)) {
- size_t n_marks = hhdr -> hb_n_marks - 1;
+ size_t n_marks = hhdr -> hb_n_marks;
+
+ GC_ASSERT(n_marks != 0);
clear_mark_bit_from_hdr(hhdr, bit_no);
+ n_marks--;
# ifdef PARALLEL_MARK
/* Appr. count, don't decrement to zero! */
if (0 != n_marks || !GC_parallel) {