(code refactoring of commit
5e6cc59b0)
* alloc.c (GC_stopped_mark, GC_finish_collection): Add assertion (at
the beginning of the function) that the allocation lock is held.
* backgraph.c [MAKE_BACK_GRAPH] (GC_build_back_graph,
GC_traverse_back_graph): Likewise.
* mark.c (GC_initiate_gc): Likewise.
* alloc.c (GC_stopped_mark): Remove comment about the held lock
(because there is an assertion about it).
#endif
/*
- * Assumes lock is held. We stop the world and mark from all roots.
+ * We stop the world and mark from all roots.
* If stop_func() ever returns TRUE, we may fail and return FALSE.
* Increment GC_gc_no if we succeed.
*/
CLOCK_TYPE start_time = 0; /* initialized to prevent warning. */
# endif
+ GC_ASSERT(I_HOLD_LOCK());
# if !defined(REDIRECT_MALLOC) && defined(USE_WINALLOC)
GC_add_current_malloc_heap();
# endif
CLOCK_TYPE finalize_time = 0;
# endif
+ GC_ASSERT(I_HOLD_LOCK());
# if defined(GC_ASSERTIONS) \
&& defined(THREAD_LOCAL_ALLOC) && !defined(DBG_HDRS_ALL)
/* Check that we marked some of our own data. */
/* Does not examine mark bits. Can be called before GC. */
GC_INNER void GC_build_back_graph(void)
{
+ GC_ASSERT(I_HOLD_LOCK());
GC_apply_to_each_object(add_back_edges);
}
GC_INNER void GC_traverse_back_graph(void)
{
+ GC_ASSERT(I_HOLD_LOCK());
GC_max_height = 0;
GC_apply_to_each_object(update_max_height);
if (0 != GC_deepest_obj)
/* mark state is invalid. */
GC_INNER void GC_initiate_gc(void)
{
+ GC_ASSERT(I_HOLD_LOCK());
# ifndef GC_DISABLE_INCREMENTAL
if (GC_incremental) {
# ifdef CHECKSUMS