diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-25 08:41:37 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-05-25 09:54:42 +0300 |
commit | faa3bafd2da2d814b6ee1e99e38c44f3a54eed10 (patch) | |
tree | 9d9d8785e811314b1e0f25fb9d60604e24155aad /mark_rts.c | |
parent | 218e2571035ac6cea9633f713b5a4137bc8f3372 (diff) | |
download | bdwgc-faa3bafd2da2d814b6ee1e99e38c44f3a54eed10.tar.gz |
Ensure GC is initialized when GC_push_all_stacks() is called
(refactoring)
Also, remove an unnecessary lock in GC pthread_create (of
pthread_support.c), and ensure that GC_thr_init() is called only once.
* alloc.c (GC_try_to_collect_inner, GC_collect_a_little_inner,
GC_stopped_mark, GC_collect_or_expand, GC_allocobj): Add assertion that
GC is initialized.
* finalize.c (GC_register_disappearing_link_inner,
GC_register_finalizer_inner): Likewise.
* mark.c (GC_clear_marks, GC_initiate_gc): Likewise.
* mark_rts.c (GC_push_roots): Likewise.
* alloc.c (GC_collect_a_little): Call GC_init if GC is not initialized.
* alloc.c (GC_expand_hp): Move part of comment to gc.h.
* include/gc/gc.h (GC_expand_hp): Reformat comment.
* darwin_stop_world.c (GC_push_all_stacks): Replace GC_init() call with
the assertion that GC_thr_initialized.
* pthread_stop_world.c (GC_push_all_stacks): Likewise.
* pthread_support.c (pthread_create): Likewise.
* darwin_stop_world.c (GC_stop_world): Add assertion that
GC_thr_initialized.
* pthread_stop_world.c (GC_stop_world): Likewise.
* win32_threads.c (GC_push_all_stacks): Likewise.
* finalize.c (GC_register_finalizer_inner): Add assertion (after LOCK)
that obj points to the base address of the object.
* include/private/pthread_support.h (GC_thr_initialized): Declare only
if GC_ASSERTIONS.
* pthread_support.c (GC_thr_initialized): Define only if GC_ASSERTIONS.
* win32_threads.c (GC_thr_initialized): Likewise.
* pthread_support.c (GC_thr_init): Add assertion that
GC_thr_initialized is not set on entry; set GC_thr_initialized only
if GC_ASSERTIONS.
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (pthread_create): Remove LOCK/UNLOCK around setup
of si.
* win32_threads.c (GC_stop_world): Replace ABORT (about
GC_thr_initialized) with the assertion.
* win32_threads.c (GC_CreateThread): Add assertion that
GC_thr_initialized after GC_init_parallel() call.
* win32_threads.c [!CYGWIN32 && !MSWINCE && !MSWIN_XBOX1 && !NO_CRT]
(GC_beginthreadex): Likewise.
* win32_threads.c [GC_PTHREADS] (GC_pthread_create): Likewise.
* win32_threads.c [!CYGWIN32 && !MSWINCE && !MSWIN_XBOX1 && !NO_CRT]
(GC_beginthreadex): Remove comment duplicating that in GC_CreateThread.
* win32_threads.c [GC_PTHREADS] (GC_pthread_create): Likewise.
Diffstat (limited to 'mark_rts.c')
-rw-r--r-- | mark_rts.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -886,6 +886,7 @@ GC_INNER void GC_push_roots(GC_bool all, ptr_t cold_gc_frame GC_ATTR_UNUSED) unsigned kind; GC_ASSERT(I_HOLD_LOCK()); + GC_ASSERT(GC_is_initialized); /* needed for GC_push_all_stacks */ /* Next push static data. This must happen early on, since it is */ /* not robust against mark stack overflow. */ |