summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-01-17 07:38:18 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-01-17 19:40:09 +0300
commitf2a2e55e4206529782cdad538adc260439cd9cd2 (patch)
tree87befc48bc393bf8520fdbaf8077b6a7a7ec2467 /mark_rts.c
parent703232dd4131d247a43a0b0506ffc5ab5669a191 (diff)
downloadbdwgc-f2a2e55e4206529782cdad538adc260439cd9cd2.tar.gz
Add I_HOLD_LOCK assertion to scratch_alloc/recycle and their callers
(refactoring) * allchblk.c (setup_header, GC_get_first_part, GC_allochblk_nth): Add assertion that the GC lock is held (I_HOLD_LOCK). * alloc.c (GC_add_to_heap, GC_scratch_recycle_inner): Likewise. * backgraph.c (push_in_progress, backwards_height): Likewise. * blacklst.c (GC_bl_init_no_interiors, GC_bl_init): Likewise. * dyn_load.c (GC_register_dynamic_libraries): Likewise. * finalize.c (push_and_mark_object): Likewise. * finalize.c [!GC_TOGGLE_REFS_NOT_NEEDED] (GC_mark_togglerefs): Likewise. * headers.c (GC_scratch_alloc, alloc_hdr, GC_init_headers, GC_install_header): Likewise. * include/private/gc_pmark.h (GC_MARK_FO): Likewise. * malloc.c (GC_alloc_reclaim_list): Likewise. * mark.c (GC_mark_some_inner, alloc_mark_stack): Likewise. * mark_rts.c [DYNAMIC_LOADING || MSWIN32 || MSWINCE || PCR || CYGWIN32] (GC_remove_tmp_roots): Likewise. * mark_rts.c (GC_cond_register_dynamic_libraries, GC_push_roots): Likewise. * obj_map.c [MARK_BIT_PER_GRANULE] (GC_add_map_entry): Likewise. * os_dep.c [NEED_PROC_MAPS && IA64] (backing_store_base_from_proc): Likewise. * os_dep.c [LINUX_STACKBOTTOM && IA64] (GC_get_register_stack_base): Likewise. * os_dep.c [MSWIN32] (GC_register_root_section): Likewise. * os_dep.c [!OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32] (GC_register_data_segments): Likewise. * os_dep.c [GWW_VDB] (GC_gww_dirty_init, GC_gww_read_dirty): Likewise. * os_dep.c (GC_dirty_init): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * os_dep.c [SOFT_VDB] (soft_dirty_init, GC_soft_read_dirty): Likewise. * os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_read_dirty): Likewise. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Round up size of buf local variable to multiple of 8 bytes. * headers.c (GC_install_header): Use EXPECT(). * malloc.c (GC_alloc_reclaim_list): Likewise. * obj_map.c [MARK_BIT_PER_GRANULE] (GC_add_map_entry): Likewise. * mark_rts.c [DYNAMIC_LOADING || MSWIN32 || MSWINCE || PCR || CYGWIN32] (GC_remove_tmp_roots, GC_push_roots): Remove redundant comment. * misc.c [GC_ASSERTIONS && GC_ALWAYS_MULTITHREADED] (GC_init): Wrap calls of GC_get_main_stack_base(), GC_get_register_stack_base(), GC_init_headers(), GC_dirty_init(), GC_register_data_segments(), GC_bl_init(), GC_mark_init() into LOCK/UNLOCK. * os_dep.c [OPENBSD] (GC_skip_hole_openbsd): Move sysconf() call to be after the assertion that the GC lock is held. * os_dep.c [HPUX_STACKBOTTOM] (GC_get_register_stack_base): Add assertion that GC_stackbottom is set.
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mark_rts.c b/mark_rts.c
index 6acd80f5..710d4e95 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -317,7 +317,6 @@ STATIC void GC_remove_root_at_pos(int i)
#if defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \
|| defined(PCR) || defined(CYGWIN32)
-/* Internal use only; lock held. */
STATIC void GC_remove_tmp_roots(void)
{
int i;
@@ -325,6 +324,7 @@ STATIC void GC_remove_tmp_roots(void)
int old_n_roots = n_root_sets;
# endif
+ GC_ASSERT(I_HOLD_LOCK());
for (i = 0; i < n_root_sets; ) {
if (GC_static_roots[i].r_tmp) {
GC_remove_root_at_pos(i);
@@ -853,6 +853,7 @@ GC_INNER void (*GC_push_typed_structures)(void) = 0;
GC_INNER void GC_cond_register_dynamic_libraries(void)
{
+ GC_ASSERT(I_HOLD_LOCK());
# if (defined(DYNAMIC_LOADING) && !defined(MSWIN_XBOX1)) \
|| defined(CYGWIN32) || defined(MSWIN32) || defined(MSWINCE) \
|| defined(PCR)
@@ -877,13 +878,14 @@ STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame)
/* accessible pointer. If all is false, arrange to push only possibly */
/* altered values. Cold_gc_frame is an address inside a GC frame that */
/* remains valid until all marking is complete; a NULL value indicates */
-/* that it is OK to miss some register values. Called with the */
-/* allocation lock held. */
+/* that it is OK to miss some register values. */
GC_INNER void GC_push_roots(GC_bool all, ptr_t cold_gc_frame GC_ATTR_UNUSED)
{
int i;
unsigned kind;
+ GC_ASSERT(I_HOLD_LOCK());
+
/* Next push static data. This must happen early on, since it is */
/* not robust against mark stack overflow. */
/* Re-register dynamic libraries, in case one got added. */