summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-12-06 09:54:13 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-12-06 09:54:13 +0300
commitbc1866b1405ce88d1acfcc05289f75b7ca4ad4e4 (patch)
tree40c702b9db55b3b454badd4213246c93cccd3070 /Makefile.am
parent92ba44158ca276ff397fb55081ff371811a7b939 (diff)
downloadbdwgc-bc1866b1405ce88d1acfcc05289f75b7ca4ad4e4.tar.gz
Avoid code duplication between pthread_support.c and win32_threads.c
(refactoring) * CMakeLists.txt [CMAKE_USE_PTHREADS_INIT || CMAKE_USE_WIN32_THREADS_INIT] (SRC): Include pthread_start.c and pthread_support.c for Win32 platform. * Makefile.am [THREADS] (libgc_la_SOURCES): Likewise. * NT_MAKEFILE [ENABLE_STATIC] (OBJS): Add pthread_start.obj, pthread_support.obj. * include/private/gc_locks.h [LINT2 || GC_WIN32_THREADS] (NO_PTHREAD_TRYLOCK): Do not define if already defined; add comment. * include/private/gcconfig.h [GC_PTHREADS && !GC_PTHREADS_PARAMARK && !__MINGW32__] (GC_PTHREADS_PARAMARK): Do not define unless PARALLEL_MARK. * include/private/pthread_support.h (thread_id_self, THREAD_ID_EQUAL, ADDR_LIMIT, MAX_MARKERS, GC_PTHREAD_PTRVAL): Define macro. * include/private/pthread_support.h (GC_win32_dll_threads, GC_available_markers_m1, GC_required_markers_cnt, GC_marker_sp, GC_marker_last_stack_min, GC_marker_Id): Declare global variable. * include/private/pthread_support.h (GC_init_win32_thread_naming, GC_mark_thread, GC_new_thread, GC_record_stack_base, GC_register_my_thread_inner, GC_lookup_by_pthread, GC_setup_atfork, GC_win32_cache_self_pthread, GC_delete_gc_thread_no_free, GC_win32_dll_lookup_thread, GC_delete_thread, GC_win32_unprotect_thread, GC_wait_for_gc_completion): Declare. * include/private/pthread_support.h [GC_PTHREADS] (GC_pthread_start_inner, GC_start_rtn_prepare_thread): Declare even for GC_WIN32_THREADS. * misc.c [!THREADS] (GC_call_with_gc_active, GC_do_blocking_inner): Update comment to refer to pthread_support.c. * pthread_start.c [GC_PTHREADS] (GC_pthread_start_inner): Define even for GC_WIN32_THREADS. * pthread_support.c: Do not skip this file for GC_WIN32_THREADS; adjust includes for Win32. * pthread_support.c (GC_INNER_WIN32THREAD): New macro. * pthread_support.c (GC_init_win32_thread_naming, GC_win32_unprotect_thread): New function. * pthread_support.c (setThreadDescription_fn, set_marker_thread_name): Move from win32_threads.c. * pthread_support.c (available_markers_m1): Rename to GC_available_markers_m1. * win32_threads.c (available_markers_m1): Likewise. * pthread_support.c (required_markers_cnt): Rename to GC_required_markers_cnt. * win32_threads.c (required_markers_cnt): Likewise. * pthread_support.c (GC_mark_thread, GC_start_mark_threads_inner, GC_push_thread_structures, GC_count_threads, GC_new_thread, GC_delete_thread, GC_delete_gc_thread_no_free, GC_lookup_thread, GC_reset_finalizer_nested, GC_check_finalizer_nested, GC_is_thread_tsd_valid, GC_thread_is_registered, GC_register_altstack, GC_segment_is_thread_stack, GC_wait_for_gc_completion, GC_remove_all_threads_but_me, fork_child_proc, GC_record_stack_base, GC_init_parallel, GC_pthread_sigmask, GC_set_stackbottom, GC_get_my_stackbottom, GC_call_with_gc_active, GC_unregister_my_thread, GC_unregister_my_thread_inner, GC_thread_exit_proc, GC_pthread_join, GC_pthread_detach, GC_pthread_sigmask, GC_pthread_create): Adjust function for Win32. * win32_threads.c (GC_lock_holder, GC_win32_dll_threads, IE_t, GC_thr_initialized, GC_need_to_lock, ADDR_LIMIT, GC_thread, GC_vthread, GC_threads, first_thread, GC_new_thread, GC_in_thread_creation, GC_record_stack_base, GC_lookup_thread, CHECK_LOOKUP_MY_THREAD, GC_reset_finalizer_nested, GC_check_finalizer_nested, GC_is_thread_tsd_valid, GC_thread_is_registered, GC_register_altstack, UNPROTECT_THREAD, GC_PTHREAD_PTRVAL, GC_delete_gc_thread_no_free, GC_delete_thread, GC_allow_register_threads, GC_register_my_thread, GC_set_stackbottom, GC_wait_for_gc_completion, GC_unregister_my_thread, GC_do_blocking_inner, GC_call_with_gc_active, GC_get_my_stackbottom, GC_remove_all_threads_but_me, fork_prepare_proc, fork_parent_proc, fork_child_proc, GC_atfork_prepare, GC_atfork_parent, GC_atfork_child, GC_setup_atfork, GC_push_thread_structures, marker_sp, set_marker_thread_name, setThreadDescription_fn, GC_mark_thread, required_markers_cnt, GC_set_markers_count, START_MARK_THREADS, start_info, GC_pthread_join, GC_pthread_create, GC_pthread_start_inner, GC_pthread_start, GC_thread_exit_proc, GC_pthread_detach, GC_check_tls, GC_init_parallel, GC_lock, GC_mark_thread_local_free_lists): Remove. * win32_threads.c [GC_PTHREADS_PARAMARK] (mark_cv, GC_start_mark_threads_inner, GC_mark_lock_holder, SET_MARK_LOCK_HOLDER, UNSET_MARK_LOCK_HOLDER, mark_mutex, builder_cv, GC_acquire_mark_lock, GC_release_mark_lock, GC_wait_builder, GC_wait_for_reclaim, GC_notify_all_builder, GC_wait_marker, GC_notify_all_marker, * win32_threads.c [GC_PTHREADS] (pthread_create, pthread_join, pthread_detach, pthread_sigmask): Do not undefine. * win32_threads.c [CAN_CALL_ATFORK]: Do not include unistd.h. * win32_threads.c (GC_register_my_thread_inner): Change type of me local variable from GC_vthread to GC_thread. * win32_threads.c (GC_win32_dll_lookup_thread, GC_win32_cache_self_pthread): New GC_INNER function. * win32_threads.c (GC_suspend, GC_start_world, GC_push_stack_for): Use GC_win32_unprotect_thread() instead of UNPROTECT_THREAD(). * win32_threads.c (marker_last_stack_min): Rename to GC_marker_last_stack_min. * win32_threads.c (GC_thr_init): Call GC_init_win32_thread_naming().
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am14
1 files changed, 8 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 0d2b3853..5425fb43 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,22 +70,24 @@ libgc_la_SOURCES = \
# C Library: Architecture Dependent
# ---------------------------------
+if THREADS
+
+libgc_la_SOURCES += pthread_start.c pthread_support.c
+
+if THREAD_LOCAL_ALLOC
+libgc_la_SOURCES += thread_local_alloc.c
+endif
+
if WIN32_THREADS
libgc_la_SOURCES += win32_threads.c
else
-if PTHREADS
-# Not Cygwin or MinGW.
-libgc_la_SOURCES += pthread_start.c pthread_support.c
if DARWIN_THREADS
libgc_la_SOURCES += darwin_stop_world.c
else
libgc_la_SOURCES += pthread_stop_world.c
endif
endif
-endif
-if THREAD_LOCAL_ALLOC
-libgc_la_SOURCES += thread_local_alloc.c
endif
if MAKE_BACK_GRAPH