summaryrefslogtreecommitdiff
path: root/alloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-05-05 21:39:33 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-05-06 10:03:39 +0300
commit750d393b91161c036bbd680054515587e9bfbc16 (patch)
treefd1e9e4805fe014fc1f1e5a2bd85dbfc245a0562 /alloc.c
parent4c21deefd01a6687708c1116263316918d7b2650 (diff)
downloadbdwgc-750d393b91161c036bbd680054515587e9bfbc16.tar.gz
Add assertions about GC_mark_state to alloc.c and mark.c
* alloc.c (GC_collect_a_little_inner): Add assertion the collection is not in progress; refine comment. * alloc.c (GC_stopped_mark): Add assertion about allowed GC_mark_state values on entry. * mark.c (GC_initiate_gc): Replace conditional abort with an assertion (about GC_mark_state value). * mark.c (GC_mark_some_inner): Add assertion about possible GC_mark_state values before every break in switch (i.e. on returning FALSE).
Diffstat (limited to 'alloc.c')
-rw-r--r--alloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/alloc.c b/alloc.c
index a0b01c4b..a5325563 100644
--- a/alloc.c
+++ b/alloc.c
@@ -712,7 +712,8 @@ GC_INNER void GC_collect_a_little_inner(int n)
# endif
if (i < max_deficit) {
- /* Need to finish a collection. */
+ GC_ASSERT(!GC_collection_in_progress());
+ /* Need to follow up with a full collection. */
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
@@ -800,6 +801,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
# endif
GC_ASSERT(I_HOLD_LOCK());
+ GC_ASSERT(GC_mark_state == MS_NONE || GC_mark_state == MS_INVALID);
# if !defined(REDIRECT_MALLOC) && defined(USE_WINALLOC)
GC_add_current_malloc_heap();
# endif