From bfad0eb3d323bf609f0fe071b20518c23c1baf73 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 29 Jan 2023 00:21:31 +0300 Subject: Remove unused DCL_LOCK_STATE (refactoring) * alloc.c (GC_set_disable_automatic_collection, GC_set_stop_func, GC_get_disable_automatic_collection, GC_get_stop_func, GC_set_start_callback, GC_get_start_callback, GC_set_on_collection_event, GC_get_on_collection_event, GC_collect_a_little, GC_try_to_collect_general, GC_expand_hp): Remove DCL_LOCK_STATE. * alloc.c [!GC_DISABLE_INCREMENTAL] (GC_start_incremental_collection): Likewise. * dbg_mlc.c (GC_generate_random_backtrace, store_debug_info, GC_debug_register_displacement): Likewise. * dyn_load.c [DARWIN_DEBUG && !NO_DEBUGGING] (GC_dyld_image_add, GC_dyld_image_remove): Likewise. * finalize.c (GC_register_disappearing_link_inner, GC_unregister_disappearing_link, GC_complete_ongoing_collection, GC_set_toggleref_func, GC_get_toggleref_func, GC_toggleref_add, GC_set_await_finalize_proc, GC_get_await_finalize_proc, GC_unregister_long_link, GC_move_disappearing_link, GC_move_long_link, GC_register_finalizer_inner, GC_finalize, GC_invoke_finalizers, GC_notify_or_invoke_finalizers): Likewise. * fnlz_mlc.c (GC_init_finalized_malloc): Likewise. * gc_dlopen.c [!USE_PROC_FOR_LIBRARIES] (disable_gc_for_dlopen): Likewise. * gcj_mlc.c (GC_init_gcj_malloc, maybe_finalize, GC_core_gcj_malloc, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * malloc.c (GC_alloc_large, GC_generic_malloc_inner, GC_generic_malloc_aligned, GC_malloc_kind_global, GC_generic_malloc_uncollectable, GC_free): Likewise. * mallocx.c (GC_realloc, GC_generic_malloc_ignore_off_page, GC_generic_malloc_many): Likewise. * mark.c (GC_print_trace): Likewise. * mark_rts.c (GC_add_roots, GC_clear_roots, GC_remove_roots): Likewise. * misc.c (GC_get_heap_usage_safe, GC_get_heap_usage_safe, GC_is_init_called, GC_init, GC_enable_incremental, GC_start_mark_threads, GC_set_warn_proc, GC_get_warn_proc, GC_set_abort_func, GC_get_abort_func, GC_enable, GC_disable, GC_new_free_list, GC_new_kind, GC_new_proc, GC_call_with_alloc_lock, GC_dump, GC_get_memory_use, GC_alloc_lock, GC_set_on_thread_event, GC_get_on_thread_event, GC_set_oom_fn, GC_get_oom_fn, GC_set_on_heap_resize, GC_get_on_heap_resize, GC_set_finalizer_notifier, GC_get_finalizer_notifier, GC_set_all_interior_pointers): Likewise. * obj_map.c (GC_register_displacement): Likewise. * os_dep.c (GC_get_stack_base, GC_print_callers): Likewise. * pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread, GC_resume_thread, GC_is_thread_suspended): Likewise. * pthread_support.c (GC_is_thread_tsd_valid, GC_thread_is_registered, GC_register_altstack, GC_wait_for_gc_completion, GC_init_parallel, GC_do_blocking_inner, GC_suspend_self_blocked, GC_get_my_stackbottom, GC_call_with_gc_active, GC_unregister_my_thread, GC_pthread_cancel, GC_pthread_exit, GC_allow_register_threads, GC_register_my_thread, GC_thread_exit_proc, GC_pthread_join, GC_pthread_detach, GC_start_rtn_prepare_thread): Likewise. * ptr_chck.c (GC_set_same_obj_print_proc, GC_get_same_obj_print_proc, GC_set_is_valid_displacement_print_proc, GC_set_is_visible_print_proc, GC_get_is_valid_displacement_print_proc, GC_get_is_visible_print_proc): Likewise. * reclaim.c (GC_print_all_errors): Likewise. * typd_mlc.c (GC_add_ext_descriptor, GC_make_descriptor, GC_malloc_explicitly_typed_ignore_off_page, GC_calloc_explicitly_typed): Likewise. * alloc.c (GC_max_retries): Change type from GC_word to word. * include/private/gc_locks.h: Remove DCL_LOCK_STATE from comment, * include/private/gc_locks.h (DCL_LOCK_STATE): Do not define. --- pthread_support.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'pthread_support.c') diff --git a/pthread_support.c b/pthread_support.c index bf7b6c28..a0923e65 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -879,7 +879,6 @@ GC_INNER GC_thread GC_lookup_thread(thread_id_t id) GC_bool GC_is_thread_tsd_valid(void *tsd) { GC_thread me; - DCL_LOCK_STATE; LOCK(); me = GC_lookup_thread(thread_id_self()); @@ -893,7 +892,6 @@ GC_API int GC_CALL GC_thread_is_registered(void) { thread_id_t self_id = thread_id_self(); GC_thread me; - DCL_LOCK_STATE; LOCK(); me = GC_lookup_thread(self_id); @@ -914,7 +912,6 @@ GC_API void GC_CALL GC_register_altstack(void *normstack, GC_thread me; GC_stack_context_t crtn; thread_id_t self_id = thread_id_self(); - DCL_LOCK_STATE; LOCK(); me = GC_lookup_thread(self_id); @@ -1182,8 +1179,6 @@ GC_INNER void GC_wait_for_gc_completion(GC_bool wait_for_all) /* Make sure that no part of our stack is still on the mark */ /* stack, since it's about to be unmapped. */ do { - DCL_LOCK_STATE; - ENTER_GC(); GC_ASSERT(!GC_in_thread_creation); GC_in_thread_creation = TRUE; @@ -1701,7 +1696,6 @@ GC_INNER void GC_init_parallel(void) { # ifdef THREAD_LOCAL_ALLOC GC_thread me; - DCL_LOCK_STATE; GC_ASSERT(GC_is_initialized); LOCK(); @@ -1817,7 +1811,6 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void *context) struct blocking_data *d = (struct blocking_data *)data; GC_thread me; GC_bool topOfStackUnset; - DCL_LOCK_STATE; UNUSED_ARG(context); LOCK(); @@ -1867,7 +1860,6 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void *context) { GC_thread me = (GC_thread)thread_me; GC_bool topOfStackUnset; - DCL_LOCK_STATE; UNUSED_ARG(context); GC_ASSERT(I_HOLD_LOCK()); @@ -1929,7 +1921,6 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb) { thread_id_t self_id = thread_id_self(); GC_thread me; - DCL_LOCK_STATE; LOCK(); me = GC_lookup_thread(self_id); @@ -1971,7 +1962,6 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, # ifdef E2K size_t stack_size; # endif - DCL_LOCK_STATE; LOCK(); /* This will block if the world is stopped. */ me = GC_lookup_thread(self_id); @@ -2107,7 +2097,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void) thread_id_t self_id = thread_id_self(); GC_thread me; IF_CANCEL(int cancel_state;) - DCL_LOCK_STATE; /* Client should not unregister the thread explicitly if it */ /* is registered by DllMain, except for the main thread. */ @@ -2147,7 +2136,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void) { # ifdef CANCEL_SAFE GC_thread t; - DCL_LOCK_STATE; # endif INIT_REAL_SYMS(); @@ -2172,7 +2160,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void) { thread_id_t self_id = thread_id_self(); GC_thread me; - DCL_LOCK_STATE; INIT_REAL_SYMS(); LOCK(); @@ -2192,8 +2179,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void) GC_API void GC_CALL GC_allow_register_threads(void) { # ifdef GC_ASSERTIONS - DCL_LOCK_STATE; - /* Check GC is initialized and the current thread is registered. */ LOCK(); /* needed for Win32 */ GC_ASSERT(GC_lookup_thread(thread_id_self()) != 0); @@ -2208,7 +2193,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) { thread_id_t self_id = thread_id_self(); GC_thread me; - DCL_LOCK_STATE; if (GC_need_to_lock == FALSE) ABORT("Threads explicit registering is not previously enabled"); @@ -2278,7 +2262,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) { GC_thread me = (GC_thread)arg; IF_CANCEL(int cancel_state;) - DCL_LOCK_STATE; # ifdef DEBUG_THREADS GC_log_printf("Called GC_thread_exit_proc on %p, gc_thread= %p\n", @@ -2296,7 +2279,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) { int result; GC_thread t; - DCL_LOCK_STATE; INIT_REAL_SYMS(); # ifdef DEBUG_THREADS @@ -2350,7 +2332,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) { int result; GC_thread t; - DCL_LOCK_STATE; INIT_REAL_SYMS(); LOCK(); @@ -2389,7 +2370,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb) struct start_info *psi = (struct start_info *)arg; thread_id_t self_id = thread_id_self(); GC_thread me; - DCL_LOCK_STATE; # ifdef DEBUG_THREADS GC_log_printf("Starting thread %p, sp= %p\n", -- cgit v1.2.1